-
Enhancement
-
Resolution: Fixed
-
P3
-
7
-
b118
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2202432 | 6u25 | Michael Fang | P3 | Closed | Fixed | b03 |
Oracle translation factory does not support variables and
functions in message values. The file Converter.java contains a
variable that is used for adding platform independent line
separator.
-------------------------------------
private static String newline = System.getProperty("line.separator");
private static Object[][] contents = {
{ "key1", "This is a text." + newline + " This is another text." + newline }
};
-------------------------------------
We should change the code to avoid variables in the
message text. We can do it this way:
-------------------------------------
private static Object[][] contents = {
{ "key1", "This is a text.\n This is another text.\n" }
};
// platform independent line separator
static {
String ls = System.getProperty("line.separator");
for(int i=0;i<contents.length;i++) {
if(contents[i][1] instanceof String){
contents[i][1] = contents[i][1].toString().replaceAll("\n",ls);
}
}
}
If the type of the entry is not String, it will not be changed. So, anything like mnemonic key will not be affected.
affected file is deploy/src/plugin/share/converter/sun/plugin/converter/resources/Converter.java
functions in message values. The file Converter.java contains a
variable that is used for adding platform independent line
separator.
-------------------------------------
private static String newline = System.getProperty("line.separator");
private static Object[][] contents = {
{ "key1", "This is a text." + newline + " This is another text." + newline }
};
-------------------------------------
We should change the code to avoid variables in the
message text. We can do it this way:
-------------------------------------
private static Object[][] contents = {
{ "key1", "This is a text.\n This is another text.\n" }
};
// platform independent line separator
static {
String ls = System.getProperty("line.separator");
for(int i=0;i<contents.length;i++) {
if(contents[i][1] instanceof String){
contents[i][1] = contents[i][1].toString().replaceAll("\n",ls);
}
}
}
If the type of the entry is not String, it will not be changed. So, anything like mnemonic key will not be affected.
affected file is deploy/src/plugin/share/converter/sun/plugin/converter/resources/Converter.java
- backported by
-
JDK-2202432 NLS: Variables in messages - ListResourceBundle
- Closed
- relates to
-
JDK-7000757 NLS: Converter.java and Deployment.java cannot be processed by translation team
- Closed