-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4
-
1.1.6
-
sparc
-
solaris_2.5
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2016911 | 1.2.0 | Brian Beck | P3 | Resolved | Fixed | 1.2beta3 |
Name: mgC56079 Date: 09/12/97
The constructor RuleBasedCollator("< a < c & ch < c") throws ParseException.
But using the reset character in such a way seems to be allowed by the specification
(as the initial substring of "ch" is already in the sequence).
The user might use this rule and expect 'ch' to be collated just before 'c'
(the same as "a < ch < c"). He can't use either "& a < ch" or "& b < ch" as
he may not be aware of the character to use (the rule "< a < c" possibly came
from otherCollator.getRules())
--- javadoc comment ---
* <LI><strong>Reset</strong>: There is a single reset
* which is used primarily for contractions and expansions, but which
* can also be used to add a modification at the end of a set of rules.
* <p>'&' : Indicates that the next rule follows the position to where
* the reset text-argument would be sorted.
* </UL>
[skip]
* Either the text-argument must already be present in the sequence, or some
* initial substring of the text-argument must be present. (e.g. "a < b & ae <
* e" is valid since "a" is present in the sequence before "ae" is reset). In
* this latter case, "ae" is not entered and treated as a single character;
* instead, "e" is sorted as if it were expanded to two characters: "a"
* followed by an "e". This difference appears in natural languages: in
* traditional Spanish "ch" is treated as though it contracts to a single
* character (expressed as "c < ch < d"), while in traditional German "ä"
* (a-umlaut) is treated as though it expands to two characters (expressed as
* "a & ae ; ä < b").
[skip]
* <p><strong>Errors</strong>
* <p>
* The following are errors:
* <UL Type=round>
* <LI>A text-argument not preceded by either a reset or relation character
* (e.g. "a < b c < d").
* <LI>A relation or reset character not followed by a text-argument
* (e.g. "a < , b").
* <LI>A reset where the text-argument (or an initial substring of the
* text-argument) is not already in the sequence.
* (e.g. "a < b & e < f")
* </UL>
* If you produce one of these errors, a <code>RuleBasedCollator</code> throws
* a <code>ParseException</code>.
----- Here is the test ------
import java.text.*;
public class RBC {
public static void main(String args[]) {
try {
RuleBasedCollator rbc=new RuleBasedCollator("< a < c & ch < c");
}
catch (ParseException e) {
System.out.println(e);
}
}
}
---- Output of the test -----
% java RBC
java.text.ParseException: couldn't find: &ch
-----------------------------
======================================================================
- backported by
-
JDK-2016911 java.text.RuleBasedCollator constructor breaks on "< a < c & ch < c" rule
-
- Resolved
-