Author: knoaman
Date: Thu Feb 11 20:31:12 2010
New Revision: 909133
URL: http://svn.apache.org/viewvc?rev=909133&view=rev
Log:
Fix problem in Regex, in normal mode with multi-line option, when last
character is a new line and we are matching a '^'. The match should fail.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?rev=909133&r1=909132&r2=909133&view=diff
==============================================================================
---
xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
(original)
+++
xerces/java/trunk/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java
Thu Feb 11 20:31:12 2010
@@ -959,7 +959,7 @@
case '^':
if (isSet(opts, MULTIPLE_LINES)) {
if (!(offset == con.start
- || offset > con.start && isEOLChar( target [
offset-1 ] )))
+ || offset > con.start && offset < con.limit &&
isEOLChar( target [ offset-1 ] )))
return -1;
} else {
if (offset != con.start)
@@ -1532,14 +1532,8 @@
*/
private int matchString (Context con, Op op, int offset, int dx, int opts)
{
-
-
-
String target = con.strTarget;
-
-
-
while (true) {
if (op == null)
return isSet(opts, XMLSCHEMA_MODE) && offset != con.limit ? -1
: offset;
@@ -1646,7 +1640,7 @@
case '^':
if (isSet(opts, MULTIPLE_LINES)) {
if (!(offset == con.start
- || offset > con.start && isEOLChar( target
.charAt( offset-1 ) )))
+ || offset > con.start && offset < con.limit &&
isEOLChar( target .charAt( offset-1 ) )))
return -1;
} else {
if (offset != con.start)
@@ -2258,7 +2252,7 @@
case '^':
if (isSet(opts, MULTIPLE_LINES)) {
if (!(offset == con.start
- || offset > con.start && isEOLChar( target
.setIndex( offset-1 ) )))
+ || offset > con.start && offset < con.limit &&
isEOLChar( target .setIndex( offset-1 ) )))
return -1;
} else {
if (offset != con.start)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]