Bug 34536 - Perl5Util fall into endless loop
Summary: Perl5Util fall into endless loop
Status: RESOLVED DUPLICATE of bug 34309
Alias: None
Product: ORO
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.0.8
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-20 02:47 UTC by Fumihiko Yamamoto
Modified: 2005-04-20 12:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fumihiko Yamamoto 2005-04-20 02:47:25 UTC
When I write a complicated regular expression on Perl5Util, sometimes
there is no response.
In other threads, there was similar answer which said " the way of regular
expression is not good"
but as far as regular expression library of JDK is response correctly, it
may say that this is bag of ORO.

So complicated regular expression takes time that it may not use for
enterprise.
Also if I could not get the response on given period, do I have the way to
get "Time out"?

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

1.HTML is downloaded by way of HTTP.
2.The regular expression is tested by using the regular expression library of 
JDK.
 ->Response correctly
3.The regular expression is tested by using ORO.
 ->No response.


import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.oro.text.perl.Perl5Util;
public class FreezeSample {

 public static void main(String[] args) throws Exception{

        HostConfiguration config = new HostConfiguration();
        config.setProxy("myproxy",8080);

        String p =
"/.*?<TABLE.*?<TABLE.*?<TR>.*?<TR>.*?<TD.*?<TD.*?<B>\\[.*?Km(.*?)\\]</B>/is"
;
        String srcSite = "http://jakarta.apache.org/oro/";

        HttpClient client = new HttpClient();
        client.setHostConfiguration(config);
        GetMethod m = new GetMethod(srcSite);
        client.executeMethod(m);

        String src = m.getResponseBodyAsString();

  System.out.println("pattern:" + p);
  System.out.println("src:" + src);

  //Test JDK Regexp
  System.out.println("javareg:" + src.matches(p));

  //Test ORO Regexp
  Perl5Util perl = new Perl5Util();
  if (perl.match(p, src)) {
   System.out.println("Match Ok");
   System.out.println(perl.getMatch());
  } else {
   System.out.println("Match NG");
  }

 }
}
---------------------------
Comment 1 Daniel F. Savarese 2005-04-20 20:45:50 UTC

*** This bug has been marked as a duplicate of 34309 ***