From c41bb8f6a3276daa0852274efd805820df3403b0 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 6 Jan 2003 13:51:26 +0000 Subject: [PATCH] Deal with lazy class verification. PR: 15377 Submitted by: David Konecny git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273760 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/install.html | 4 ++-- .../apache/tools/ant/util/regexp/RegexpFactory.java | 5 ++++- .../tools/ant/util/regexp/RegexpMatcherFactory.java | 13 ++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/manual/install.html b/docs/manual/install.html index 93942043f..af31b337e 100644 --- a/docs/manual/install.html +++ b/docs/manual/install.html @@ -288,7 +288,7 @@ Installing Ant / Optional Tasks section above.

jakarta.apache.org/regexp/ - jakarta-oro-2.0.4.jar + jakarta-oro-2.0.6.jar regexp type with mappers and the perforce tasks jakarta.apache.org/oro/ @@ -408,7 +408,7 @@ Installing Ant / Optional Tasks section above.



-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.

diff --git a/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java b/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java index 4af37ca39..38e6e6d94 100644 --- a/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java +++ b/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java @@ -1,7 +1,7 @@ /* * 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. * * Redistribution and use in source and binary forms, with or without @@ -95,14 +95,17 @@ public class RegexpFactory extends RegexpMatcherFactory { } try { + testAvailability("java.util.regex.Matcher"); return createRegexpInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"); } catch (BuildException be) {} try { + testAvailability("org.apache.oro.text.regex.Pattern"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaOroRegexp"); } catch (BuildException be) {} try { + testAvailability("org.apache.regexp.RE"); return createRegexpInstance("org.apache.tools.ant.util.regexp.JakartaRegexpRegexp"); } catch (BuildException be) {} diff --git a/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java b/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java index 6d70bcbb0..9eab16b58 100644 --- a/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java +++ b/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java @@ -1,7 +1,7 @@ /* * 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. * * Redistribution and use in source and binary forms, with or without @@ -100,14 +100,17 @@ public class RegexpMatcherFactory { } try { + testAvailability("java.util.regex.Matcher"); return createInstance("org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher"); } catch (BuildException be) {} try { + testAvailability("org.apache.oro.text.regex.Pattern"); return createInstance("org.apache.tools.ant.util.regexp.JakartaOroMatcher"); } catch (BuildException be) {} try { + testAvailability("org.apache.regexp.RE"); return createInstance("org.apache.tools.ant.util.regexp.JakartaRegexpMatcher"); } catch (BuildException be) {} @@ -123,4 +126,12 @@ public class RegexpMatcherFactory { throw new BuildException(t); } } + + protected void testAvailability(String className) throws BuildException { + try { + Class implClass = Class.forName(className); + } catch (Throwable t) { + throw new BuildException(t); + } + } }