Please find enclosed a patch for bug 16563.
Regards,
Khaled
---
D:\cvswork\xml-xerces\java\src\org\apache\xerces\impl\xpath\regex\message.properties
2003-03-21 12:21:39.000000000 -0500
+++ message.properties 2003-03-21 12:21:25.000000000 -0500
@@ -22,8 +22,10 @@
parser.cc.5=']' is expected.
parser.cc.6='[' is invalid in a characer class. Write '\\['.
parser.cc.7=']' is invalid in a characer class. Write '\\]'.
+parser.cc.8='-' is an invalid character range. Write '\\-'.
parser.ope.1='[' is expected.
parser.ope.2=')' or '-[' or '+[' or '&[' is expected.
+parser.ope.3=The range end code point is less than the start code point.
parser.descape.1=Invalid Unicode hex notation.
parser.descape.2=Overflow in a hex notation.
parser.descape.3='\\x{' must be closed by '}'.
---
D:\cvswork\xml-xerces\java\src\org\apache\xerces\impl\xpath\regex\ParserForXMLSchema.java
2002-08-26 13:55:05.000000000 -0400
+++ ParserForXMLSchema.java 2003-03-20 16:11:40.000000000 -0500
@@ -275,8 +275,12 @@
this.next();
if (!end) { // if not shorthands...
if (type == T_CHAR) {
- if (c == '[') throw this.ex("parser.cc.6", this.offset-2);
- if (c == ']') throw this.ex("parser.cc.7", this.offset-2);
+ if (c == '[')
+ throw this.ex("parser.cc.6", this.offset-2);
+ else if (c == ']')
+ throw this.ex("parser.cc.7", this.offset-2);
+ else if (c == '-')
+ throw this.ex("parser.cc.8", this.offset-2);
}
if (this.read() != T_CHAR || this.chardata != '-') { // Here is no
'-'.
tok.addRange(c, c);
@@ -285,23 +289,24 @@
this.next(); // Skips '-'
if ((type = this.read()) == T_EOF) throw this.ex("parser.cc.2",
this.offset);
// c '-' ']' -> '-' is a single-range.
- if (type == T_CHAR && this.chardata == ']') {
- tok.addRange(c, c);
- tok.addRange('-', '-');
- }
- // c '-' '-[' -> '-' is a
single-range.
- else if (type == T_XMLSCHEMA_CC_SUBTRACTION) {
- tok.addRange(c, c);
- tok.addRange('-', '-');
+ if ((type == T_CHAR && this.chardata == ']')
+ || type == T_XMLSCHEMA_CC_SUBTRACTION) {
+ throw this.ex("parser.cc.8", this.offset-1);
} else {
int rangeend = this.chardata;
if (type == T_CHAR) {
- if (rangeend == '[') throw this.ex("parser.cc.6",
this.offset-1);
- if (rangeend == ']') throw this.ex("parser.cc.7",
this.offset-1);
+ if (rangeend == '[')
+ throw this.ex("parser.cc.6", this.offset-1);
+ else if (rangeend == ']')
+ throw this.ex("parser.cc.7", this.offset-1);
+ else if (rangeend == '-')
+ throw this.ex("parser.cc.8", this.offset-1);
}
- if (type == T_BACKSOLIDUS)
+ else if (type == T_BACKSOLIDUS)
rangeend = this.decodeEscaped();
this.next();
+
+ if (c > rangeend) throw this.ex("parser.ope.3",
this.offset-1);
tok.addRange(c, rangeend);
}
}
@@ -356,18 +361,23 @@
case 'n': c = '\n'; break; // LINE FEED U+000A
case 'r': c = '\r'; break; // CRRIAGE RETURN U+000D
case 't': c = '\t'; break; // HORIZONTAL TABULATION U+0009
-
- case 'e':
- case 'f':
- case 'x':
- case 'u':
- case 'v':
- throw ex("parser.process.1", this.offset-2);
- case 'A':
- case 'Z':
- case 'z':
- throw ex("parser.descape.5", this.offset-2);
+ case '\\':
+ case '|':
+ case '.':
+ case '^':
+ case '-':
+ case '?':
+ case '*':
+ case '+':
+ case '{':
+ case '}':
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ break; // return actucal char
default:
+ throw ex("parser.process.1", this.offset-2);
}
return c;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]