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=39772>.
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=39772

           Summary: RE internal error: Invalid opcode '0'
           Product: Regexp
           Version: unspecified
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Other
        AssignedTo: regexp-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


I have a Web application using struts, the page parses a date string, 
intermittently, I am getting following error:

java.lang.Error: RE internal error: Invalid opcode '0'
        at org.apache.regexp.RE.internalError(Unknown Source)
        at org.apache.regexp.RE.matchNodes(Unknown Source)
        at org.apache.regexp.RE.matchNodes(Unknown Source)
        at org.apache.regexp.RE.matchAt(Unknown Source)
        at org.apache.regexp.RE.match(Unknown Source)
        at org.apache.regexp.RE.match(Unknown Source)
        at org.apache.regexp.RE.match(Unknown Source)
        at com.ew.util.Regex.getDatePattern(Regex.java:95)
        at com.ew.util.DateUtil.parse(DateUtil.java:69)
        at com.parser.ReportParser.parseReport(ReportParser.java:40)

the getDatePattern code looks like:

public static String getDatePattern(String dateStr) throws EWException {
  
        RE regexp = new RE();
        String datePattern = null;
 
        try {
           // if no data string, throw exception
           if (StringUtils.isEmpty(dateStr)) {
              throw new EWException(new IllegalArgumentException(       
                                    "The date string is empty"));
           } else {
              // if one Date REProgram is null, consider all of them are
              // yet instatiated.
                
              if (dateFormatMap.size() == 0) {
                 dateFormatMap.put(DATE_PATTERN_0, compiler.compile(DATE_0));
                 dateFormatMap.put(DATE_PATTERN_1, compiler.compile(DATE_1));
                 dateFormatMap.put(DATE_PATTERN_2, compiler.compile(DATE_2));
                 dateFormatMap.put(DATE_PATTERN_3, compiler.compile(DATE_3));
                 dateFormatMap.put(DATE_PATTERN_4, compiler.compile(DATE_4));
                 dateFormatMap.put(DATE_PATTERN_5, compiler.compile(DATE_5));
                 dateFormatMap.put(DATE_PATTERN_6, compiler.compile(DATE_6));
                 dateFormatMap.put(DATE_PATTERN_7, compiler.compile(DATE_7));
                 dateFormatMap.put(DATE_PATTERN_8, compiler.compile(DATE_8));
                 dateFormatMap.put(DATE_PATTERN_9, compiler.compile(DATE_9));
                        
               }
        
               // find the pattern that matches the date string
               Iterator keys = dateFormatMap.keySet().iterator();
               String pattern;
               while(keys.hasNext()) {
                   pattern = (String) keys.next();
                   regexp.setProgram((REProgram)dateFormatMap.get(pattern));
                   if (regexp.match(dateStr)){
                      datePattern = pattern;
                      break;
                   }                
               }

       ..................

Once the problem happens, we have to restart the server. Sometimes, we have to 
restart the server couple of times to remove the error. But the problem is not 
that easy to reproduce. it happens intermittently in production. We could not 
reproduce it in QA.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to