-
Bug
-
Resolution: Fixed
-
P2
-
1.1.1
-
1.1.6
-
x86
-
windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2017401 | 1.2.0 | Brian Beck | P2 | Resolved | Fixed | 1.2beta3 |
Name: bb33257 Date: 10/14/97
MessageFormat::parse does not return the last value for patterns
which end with a placeholder, like "{1},{2}" (end with '}').
SOURCE CODE: The bug appears when the following test executes
for the pattern: "There are {1} files on {2} at {3}"
---------------------------------------------------
public void TestMSGPatternTest() throws Exception {// only here temporary, as a convenience for a first test
Object[] testArgs = {
new Double (1), new Double(3456),
"Disk", new Date(10000000000)};
String[] testCases = {
"Quotes '', '{', 'a' {0} '{0}'",
"Quotes '', '{', 'a' {0,number} '{0}'",
"'{'1,number,'#',##} {1,number,'#',##}",
"There are {1} files on {2} at {3}",
"On {2}, there are {1} files, with {0,number,currency}.",
"'{1,number,percent}', {1,number,percent}, ",
"'{1,date,full}', {1,date,full}, ",
"'{3,date,full}', {3,date,full}, ",
"'{1,number,#,##}' {1,number,#,##}",
};
for (int i = 0; i < testCases.length; ++i) {
try {
logln("");
logln( i + " Pat in: " + testCases[i]);
MessageFormat form = new MessageFormat(testCases[i]);
logln( i + " Pat out: " + form.toPattern());
String result = form.format(testArgs);
logln( i + " Result: " + result);
Object[] values = form.parse(result);
for (int j = 0; j < testArgs.length; ++j) {
if (testArgs[j] == null && values[j] != null
|| testArgs[j] != null && !testArgs[j].equals(values[j])) {
logln( i + " " + j + " old: " + testArgs[j]);
logln( i + " " + j + " new: " + values[j]);
}
}
} catch (Exception foo) {
foo.printStackTrace();
}
}
}
======================================================================
- backported by
-
JDK-2017401 MessageFormat::parse doesn't parse last value if the pattern ends with its '}'
-
- Resolved
-