-
Bug
-
Resolution: Fixed
-
P3
-
6
-
None
-
b43
-
generic
-
generic
From ###@###.###:
The logic in the javax.management.MatchQueryExp.wildmatch() method
appears to be flawed with respect to character range matching.
wildmatch( "2[7-9]", "21" ) incorrectly returns 'true'
The problem lies in the following code block:
while (++pi < plen && (c = p.charAt(pi)) != ']') {
if (p.charAt(pi) == '-' && pi+1 < plen) {
if (s.charAt(si) >= c && s.charAt(si) <= p.charAt(pi+1)) {
seenit = true;
}
pi += 1;
} else {
if (c == s.charAt(si)) {
seenit = true;
}
}
}
The comparison expression 's.charAt(si) >= c' in the third line will
incorrectly compare the character 's.charAt(si)' against '-'.
When I modified the expression to 's.charAt(si) >= p.charAt(pi-1)',
the example above correctly returned 'false'.
###@###.### 2005-05-06 11:24:50 GMT
The logic in the javax.management.MatchQueryExp.wildmatch() method
appears to be flawed with respect to character range matching.
wildmatch( "2[7-9]", "21" ) incorrectly returns 'true'
The problem lies in the following code block:
while (++pi < plen && (c = p.charAt(pi)) != ']') {
if (p.charAt(pi) == '-' && pi+1 < plen) {
if (s.charAt(si) >= c && s.charAt(si) <= p.charAt(pi+1)) {
seenit = true;
}
pi += 1;
} else {
if (c == s.charAt(si)) {
seenit = true;
}
}
}
The comparison expression 's.charAt(si) >= c' in the third line will
incorrectly compare the character 's.charAt(si)' against '-'.
When I modified the expression to 's.charAt(si) >= p.charAt(pi-1)',
the example above correctly returned 'false'.
###@###.### 2005-05-06 11:24:50 GMT