jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 5055] New: - reproducable StackOverflowError
Date Fri, 23 Nov 2001 21:27:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5055>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5055

reproducable StackOverflowError

           Summary: reproducable StackOverflowError
           Product: ORO
           Version: 2.0.4
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Main
        AssignedTo: oro-dev@jakarta.apache.org
        ReportedBy: loz@cable.a2000.nl


Using the program below you get the following error:

Exception in thread "main" java.lang.StackOverflowError
        at org.apache.oro.text.regex.Perl5Matcher.__compare(Perl5Matcher.java:98
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:929)

        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1144
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1195
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1156
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1195
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1156
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1195
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1156
)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:1195


The funny thing is that you can delete any few characters from the input string 
and then the program will work correctly. I encountered this error using 2.0.3, 
but it's also in 2.0.4. 

---------------------------------------------------------

import org.apache.oro.text.regex.*;

public class TestORO
{
    public static void main(String[] args) {
        String input = "&lt;box&gt;\n"
                    + "    <table cellspacing=\"0\" cellpadding=\"0\" border=\"0
\" width=\"100%\">\n"
                    + "      <tr>\n"
                    + "        <td valign=\"top\"><img 
src=\"/xxx/xxxxxx/xxxxxx/xxxxx/xxxxx.gif\" alt=\"\" align=\"top\" /></td>\n"
                    + "        <td class=\"content\" width=\"100%\">\n"
                    + "<br />  bla bla1\n"
                    + "        </td>\n"
                    + "      </tr>\n"
                    + "    </table>    <table cellspacing=\"0\" cellpadding=\"0
\" border=\"0\" width=\"100%\">\n"
                    + "      <tr>\n"
                    + "        <td valign=\"top\"><img 
src=\"/xxx/xxxxxx/xxxxxx/xxxxx/xxxxx.gif\" alt=\"\" align=\"top\" /></td>\n"
                    + "        <td class=\"content\" width=\"100%\">\n"
                    + "<br />  bla bla2\n"
                    + "        </td>\n"
                    + "      </tr>\n"
                    + "    </table>    <table cellspacing=\"0\" cellpadding=\"0
\" border=\"0\" width=\"100%\">\n"
                    + "      <tr>\n"
                    + "        <td valign=\"top\"><img 
src=\"/xxx/xxxxxx/xxxxxx/xxxxx/xxxxx.gif\" alt=\"\" align=\"top\" /></td>\n"
                    + "        <td class=\"content\" width=\"100%\">\n"
                    + "<br />  Bla Blablabla bla bla blablabla bla bla blabla 
blablablabla blablabla\n"
                    + "        </td>\n"
                    + "      </tr>\n"
                    + "    </table>    <table cellspacing=\"0\" cellpadding=\"0
\" border=\"0\" width=\"100%\">\n"
                    + "      <tr>\n"
                    + "        <td valign=\"top\"><img 
src=\"/xxx/xxxxxx/xxxxxx/xxxxx/xxxxx.gif\" alt=\"\" align=\"top\" /></td>\n"
                    + "        <td class=\"content\" width=\"100%\">\n"
                    + "<br />  Blabla blablablabla bla blablabla bla bla 
blablabla bla blablablabla blabla\n"
                    + "        </td>\n"
                    + "      </tr>\n"
                    + "    </table>    <table cellspacing=\"0\" cellpadding=\"0
\" border=\"0\" width=\"100%\">\n"
                    + "      <tr>\n"
                    + "        <td valign=\"top\"><img 
src=\"/xxx/xxxxxx/xxxxxx/xxxxx/xxxxx.gif\" alt=\"\" align=\"top\" /></td>\n"
                    + "        <td class=\"content\" width=\"100%\">\n"
                    + "<br />  bla bla5\n"
                    + "        </td>\n"
                    + "      </tr>\n"
                    + "    </table>&lt;/box&gt;\n";

        input = substitute(input, "&lt;box&gt;((.|\n)*?)&lt;/box&gt;", new

StringSubstitution("foobar"));

        System.out.println(input);

        System.out.println("\nDone!\n");
    }

    private static String substitute(String input, String expression, 
Substitution sub) {
        // Create Perl5Compiler and Perl5Matcher instances.
        PatternCompiler compiler = new Perl5Compiler();
        PatternMatcher  matcher  = new Perl5Matcher();
        Pattern         pattern  = null;

        // Attempt to compile the pattern.
        try {
            pattern = compiler.compile(expression, 
Perl5Compiler.CASE_INSENSITIVE_MASK);
        } catch (MalformedPatternException e) {
            System.err.println("Bad pattern.");
            System.err.println(e.getMessage());
            return "";
        }

        return Util.substitute(matcher, pattern, sub, input, 
Util.SUBSTITUTE_ALL);
    }
}

--
To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>


Mime
View raw message