-
Bug
-
Resolution: Won't Fix
-
P4
-
7
-
generic
-
generic
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.
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.