Browse Source

Deal with lazy class verification.

PR: 15377
Submitted by:	David Konecny <david.konecny at volny.cz>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273760 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
c41bb8f6a3
3 changed files with 18 additions and 4 deletions
  1. +2
    -2
      docs/manual/install.html
  2. +4
    -1
      src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java
  3. +12
    -1
      src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java

+ 2
- 2
docs/manual/install.html View File

@@ -288,7 +288,7 @@ Installing Ant / Optional Tasks</a> section above.</p>
<td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td> <td><a href="http://jakarta.apache.org/regexp/" target="_top">jakarta.apache.org/regexp/</a></td>
</tr> </tr>
<tr> <tr>
<td>jakarta-oro-2.0.4.jar</td>
<td>jakarta-oro-2.0.6.jar</td>
<td>regexp type with mappers and the perforce tasks</td> <td>regexp type with mappers and the perforce tasks</td>
<td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td> <td><a href="http://jakarta.apache.org/oro/" target="_top">jakarta.apache.org/oro/</a></td>
</tr> </tr>
@@ -408,7 +408,7 @@ Installing Ant / Optional Tasks</a> section above.</p>
</table> </table>
<br> <br>
<hr> <hr>
<p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights
<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
Reserved.</p> Reserved.</p>


</body> </body>


+ 4
- 1
src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -95,14 +95,17 @@ public class RegexpFactory extends RegexpMatcherFactory {
} }


try { try {
testAvailability("java.util.regex.Matcher");
return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp");
} catch (BuildException be) {} } catch (BuildException be) {}
try { try {
testAvailability("org.apache.oro.text.regex.Pattern");
return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp");
} catch (BuildException be) {} } catch (BuildException be) {}
try { try {
testAvailability("org.apache.regexp.RE");
return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp");
} catch (BuildException be) {} } catch (BuildException be) {}




+ 12
- 1
src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -100,14 +100,17 @@ public class RegexpMatcherFactory {
} }


try { try {
testAvailability("java.util.regex.Matcher");
return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher");
} catch (BuildException be) {} } catch (BuildException be) {}
try { try {
testAvailability("org.apache.oro.text.regex.Pattern");
return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher");
} catch (BuildException be) {} } catch (BuildException be) {}
try { try {
testAvailability("org.apache.regexp.RE");
return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher");
} catch (BuildException be) {} } catch (BuildException be) {}


@@ -123,4 +126,12 @@ public class RegexpMatcherFactory {
throw new BuildException(t); throw new BuildException(t);
} }
} }
protected void testAvailability(String className) throws BuildException {
try {
Class implClass = Class.forName(className);
} catch (Throwable t) {
throw new BuildException(t);
}
}
} }

Loading…
Cancel
Save