You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/01/09 10:03:04 UTC
svn commit: r1896857 - /xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java
Author: fanningpj
Date: Sun Jan 9 10:03:04 2022
New Revision: 1896857
URL: http://svn.apache.org/viewvc?rev=1896857&view=rev
Log:
sonar issues
Modified:
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java
Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java?rev=1896857&r1=1896856&r2=1896857&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/regex/RegularExpression.java Sun Jan 9 10:03:04 2022
@@ -1122,27 +1122,29 @@ public class RegularExpression implement
if (refno <= 0 || refno >= this.nofparen) {
throw new RuntimeException("Internal Error: Reference number must be more than zero: "+refno);
}
- if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) {
- returned = true;
- break;
- }
- int o2 = con.match.getBeginning(refno);
- int literallen = con.match.getEnd(refno)-o2;
- if (dx > 0) {
- if (!target.regionMatches(isSetIgnoreCase, offset, con.limit, o2, literallen)) {
+ if (con.match != null) {
+ if (con.match.getBeginning(refno) < 0 || con.match.getEnd(refno) < 0) {
returned = true;
break;
}
- offset += literallen;
- }
- else {
- if (!target.regionMatches(isSetIgnoreCase, offset-literallen, con.limit, o2, literallen)) {
- returned = true;
- break;
+ int o2 = con.match.getBeginning(refno);
+ int literallen = con.match.getEnd(refno)-o2;
+ if (dx > 0) {
+ if (!target.regionMatches(isSetIgnoreCase, offset, con.limit, o2, literallen)) {
+ returned = true;
+ break;
+ }
+ offset += literallen;
}
- offset -= literallen;
+ else {
+ if (!target.regionMatches(isSetIgnoreCase, offset-literallen, con.limit, o2, literallen)) {
+ returned = true;
+ break;
+ }
+ offset -= literallen;
+ }
+ op = op.next;
}
- op = op.next;
}
break;
@@ -1271,7 +1273,7 @@ public class RegularExpression implement
if (cop.refNumber >= this.nofparen) {
throw new RuntimeException("Internal Error: Reference number must be more than zero: "+cop.refNumber);
}
- if (con.match.getBeginning(cop.refNumber) >= 0
+ if (con.match != null && con.match.getBeginning(cop.refNumber) >= 0
&& con.match.getEnd(cop.refNumber) >= 0) {
op = cop.yes;
}
@@ -1347,7 +1349,7 @@ public class RegularExpression implement
case Op.CAPTURE:
final int refno = op.getData();
final int saved = dataStack.pop();
- if (retValue < 0) {
+ if (con.match != null && retValue < 0) {
if (refno > 0) {
con.match.setBeginning(refno, saved);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org