You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by bu...@apache.org on 2005/01/11 20:24:53 UTC

DO NOT REPLY [Bug 33051] New: - StringIndexOutOfBoundsException and RESyntaxException in RE.java

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33051>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33051

           Summary: StringIndexOutOfBoundsException and RESyntaxException in
                    RE.java
           Product: Regexp
           Version: unspecified
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Other
        AssignedTo: regexp-dev@jakarta.apache.org
        ReportedBy: ybh_6336@yahoo.com


Hello all

I would not term these as Jakarta issues straightaway, but please do take a look
at these, our application is severely being hampered because of these. I
apologize I cannot give direct steps to reproduce these issues, but I would
really appreciate any help if any of the developers is aware of anything like
this from the top of their heads.

This is a B2B application that I am talking about, and I came across these
issues while validating the XML response against certain regular expressions.

1) StringIndexOutOfBoundsException: Following is the sequence of steps my code
follows:
...
(AlphaLength3to3.java)
JakartaRegExpEvaluator regExp = new JakartaRegExpEvaluator();
regExp.setExpression("[a-zA-Z]{3}");
...
...
(JakartaRegExpEvaluator.java: setExpression(String s))
regexp = new RE("^" + s + "$");
...
I get the following stack trace:
NESTED EXCEPTION #1:java.lang.StringIndexOutOfBoundsException: String index out
of range: 14
/atg/dynamo/server/DrpServer            at java.lang.String.charAt(String.java:444)
/atg/dynamo/server/DrpServer            at
org.apache.regexp.RECompiler.compile(RECompiler.java:1286)
/atg/dynamo/server/DrpServer            at org.apache.regexp.RE.<init>(RE.java:490)
/atg/dynamo/server/DrpServer            at org.apache.regexp.RE.<init>(RE.java:475)

2) RESyntaxException: Following is the piece of code:

try
{
  JakartaRegExpEvaluator regExp = new JakartaRegExpEvaluator();
  regExp.setExpression("[0-9A-Z]{1,3}");
  if(!regExp.matches(tempPatternString))
     throw new
ValidationException("org.opentravel.schemas.OTA.n2002.n11.types.OTA_CodeType::validate:
Value " + val + " did not conform to the pattern facet constraint of
[0-9A-Z]{1,3}.");
}
catch(RegExpException re)
{
  throw new
ValidationException("org.opentravel.schemas.OTA.n2002.n11.types.OTA_CodeType::validate:
Serious problem constructing regular expression from pattern \"[0-9A-Z]{1,3}\":
" + re.getMessage());
}

"setExpression()" then calls:
regexp = new RE("^" + s + "$");

Following is the stack trace that I get:
com.commerceone.xdk.castor.excp.ConstraintValidationException:
OTA_CodeType::set(String): The value 10 was not a valid value for this
simpleType: org.opentravel.schemas.OTA.n2002.n11.types.OTA_CodeType::validate:
Serious problem constructing regular expression from pattern "[0-9A-Z]{1,3}":
RegExp Syntax error: Syntax error: Bad range ; error occured with the following
regular expression: [0-9A-Z]{1,3}

So, I presume, for some reason, RE.java is throwing RESyntaxException.

The most weird thing is, that the above 2 issues work perfectly fine most of the
times for the SAME EXACT regular expression, but sometimes throw these
exceptions. I understand this might not be sufficient information, but that is
all I have, please let me know what other information might be helpful in
solving this. Any ideas would be appreciated.

Thanks
-Yogesh

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org