You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by df...@apache.org on 2004/06/15 04:55:42 UTC

cvs commit: jakarta-oro/src/java/org/apache/oro/text PatternMatchingEngineFactory.java

dfs         2004/06/14 19:55:42

  Modified:    src/java/org/apache/oro/text
                        PatternMatchingEngineFactory.java
  Log:
  Implemented dynamic detection and addition of JavaEngine factory.
  
  Revision  Changes    Path
  1.3       +17 -1     jakarta-oro/src/java/org/apache/oro/text/PatternMatchingEngineFactory.java
  
  Index: PatternMatchingEngineFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/PatternMatchingEngineFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PatternMatchingEngineFactory.java	18 Feb 2004 07:10:09 -0000	1.2
  +++ PatternMatchingEngineFactory.java	15 Jun 2004 02:55:42 -0000	1.3
  @@ -46,6 +46,22 @@
       put(PERL5_KEY, new Perl5Engine());
       put(AWK_KEY,   new AwkEngine());
       put(GLOB_KEY,  new GlobEngine());
  +
  +    try {
  +      Class.forName("java.util.regex.Pattern");
  +      put(JAVA_KEY,
  +          (PatternMatchingEngine)
  +          Class.forName("org.apache.oro.text.java.JavaEngine").newInstance());
  +    } catch(ClassNotFoundException cnfe) {
  +      // Don't do anything.  java.util.regex package doesn't exist.
  +    } catch(InstantiationException ie) {
  +      // This will never happen.  Could use an assertion but that locks us
  +      // into J2SE 1.4.
  +    } catch(IllegalAccessException iae) {
  +      // This will never happen.  Could use an assertion but that locks us
  +      // into J2SE 1.4.
  +    }
  +
     }
   
     public PatternMatchingEngine get(String key) {
  
  
  

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