Bug 328707 - [nls tooling] Improve properties file document partitioning
Summary: [nls tooling] Improve properties file document partitioning
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-26 09:33 EDT by Raksha Vasisht CLA
Modified: 2020-04-30 12:50 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raksha Vasisht CLA 2010-10-26 09:33:09 EDT
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?
Comment 1 Deepak Azad CLA 2010-10-26 11:09:16 EDT
(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.
Comment 2 Deepak Azad CLA 2010-10-26 11:14:22 EDT
(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.
Comment 3 Markus Keller CLA 2010-10-26 12:15:14 EDT
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);
    }
}
Comment 4 Deepak Azad CLA 2010-10-26 13:02:30 EDT
(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 "". "
Comment 5 Deepak Azad CLA 2010-11-29 21:47:59 EST
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
Comment 6 Eclipse Genie CLA 2020-04-30 12:50:36 EDT
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.