@@ -15,7 +15,6 @@
* limitations under the License.
*
*/
package org.apache.tools.ant.util.regexp;
import org.apache.tools.ant.Project;
@@ -25,14 +24,13 @@ import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.JavaEnvUtils;
/**
* Simple Factory Class that produces an implementation of
* RegexpMatcher based on the system property
* <code>ant.regexp.regexpimpl</code> and the classes
* available.
*
* <p>In a more general framework this class would be abstract and
* have a static newInstance method.</p>
*
* Simple Factory Class that produces an implementation of RegexpMatcher based on the system
* property <code>ant.regexp.regexpimpl</code> and the classes available.
*
* <p>
* In a more general framework this class would be abstract and have a static newInstance method.
* </p>
*
*/
public class RegexpMatcherFactory {
@@ -56,8 +54,7 @@ public class RegexpMatcherFactory {
* @return the matcher
* @throws BuildException on error
*/
public RegexpMatcher newRegexpMatcher(Project p)
throws BuildException {
public RegexpMatcher newRegexpMatcher(Project p) throws BuildException {
String systemDefault = null;
if (p == null) {
systemDefault = System.getProperty(MagicNames.REGEXP_IMPL);
@@ -93,11 +90,9 @@ public class RegexpMatcherFactory {
} catch (BuildException be) {
cause = orCause(cause, be, true);
}
throw new BuildException(
"No supported regular expression matcher found"
+ (cause != null ? ": " + cause : ""), cause);
}
throw new BuildException("No supported regular expression matcher found"
+ (cause != null ? ": " + cause : ""), cause);
}
static Throwable orCause(Throwable deflt, BuildException be, boolean ignoreCnfe) {
if (deflt != null) {
@@ -114,10 +109,9 @@ public class RegexpMatcherFactory {
* @return a <code>RegexpMatcher</code> value
* @exception BuildException if an error occurs
*/
protected RegexpMatcher createInstance(String className)
throws BuildException {
return (RegexpMatcher) ClasspathUtils.newInstance(className,
RegexpMatcherFactory.class.getClassLoader(), RegexpMatcher.class);
protected RegexpMatcher createInstance(String className) throws BuildException {
return (RegexpMatcher) ClasspathUtils.newInstance(className, RegexpMatcherFactory.class
.getClassLoader(), RegexpMatcher.class);
}
/**
@@ -143,7 +137,7 @@ public class RegexpMatcherFactory {
try {
// The factory throws a BuildException if no usable matcher
// cant be instantiated. We dont need the matcher itself here.
( new RegexpMatcherFactory() ).newRegexpMatcher(project);
new RegexpMatcherFactory().newRegexpMatcher(project);
return true;
} catch (Throwable ex) {
return false;