Community
Participate
Working Groups
I20101025-1800 Steps : 1) Copy some non-ascii characters into the Properties File Editor, leave no space or semi colon at the end (dont type a '=' in the beginning either, just paste the string) 2) Hover over the new converted string => Shows the real string (good) but also the next key string in the file(bad) Also hyperlink is disabled for the next key. This case would make an invalid key but it could probably be handled better?
(In reply to comment #0) > This case would make an invalid key but it could probably be handled better? Yes, the key is indeed invalid. If the key needs to be spilt across multiple lines then the line terminator character needs to be escaped using \. > Also hyperlink is disabled for the next key. Also this is an old problem in the properties file editor - the document partitioning would have to be tweaked, both the hyperlinks and the new hover relies on document partitions.
(In reply to comment #1) > Yes, the key is indeed invalid. If the key needs to be spilt across multiple > lines then the line terminator character needs to be escaped using \. I should also add that even if you escape the line terminator character, the hyperlink and hover are still broken.
Note that the key is not invalid in that case. In a .properties file like ... key1\u2603 = abc\u2603 \u2603 key3\u2603: 123\u2603 key4\u2603 val4 \u2603 ... the second property is perfectly valid: It has key "\u2603" and value "". Properties#load(Reader) is our spec: package mess; import java.io.IOException; import java.util.Properties; public class Test { public static void main(String[] args) throws IOException { Properties properties= new Properties(); properties.load(Test.class.getResourceAsStream("m.properties")); //Note: To see the output, select UTF-8 as encoding on the Common tab // of the launch configuration System.out.println(properties); } }
(In reply to comment #3) > Note that the key is not invalid in that case. In a .properties file like ... > > key1\u2603 = abc\u2603 > \u2603 > key3\u2603: 123\u2603 > key4\u2603 val4 \u2603 > > ... the second property is perfectly valid: It has key "\u2603" and value "". > Properties#load(Reader) is our spec: Right, the javadoc for that says: " The key contains all of the characters in the line starting with the first non-white space character and up to, but not including, the first unescaped '=', ':', or *white space character other than a line terminator.* " which is a bit confusing, but it also includes an example which settles it (I had missed seeing the example at first) " As a third example, the line: cheeses specifies that the key is "cheeses" and the associated element is the empty string "". "
The problem described here is because of the way a properties file is partitioned. There are a couple more issues with the partitioning logic, I will take a look at them as well as part of this bug. - Currently property keys are part of the default partition, they could be made part of a PROPERTY_KEY partition instead. Or the line terminator character which immediately follows a property key could be made part of the PROPERTY_VALUE partition. - The PROPERTY_VALUE partition includes the key and value separator characters ':', '='. This could also be improved. - Situation described in bug 328524 comment 27
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.