ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: AW: svn commit: r420305 - in /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition: ConditionBase.java HasMethod.java
Date Mon, 10 Jul 2006 19:57:54 GMT
Jan.Materne@rzf.fin-nrw.de wrote:
>>+public class HasMethod extends ProjectComponent implements Condition {
>>+    private Class loadClass(String classname) {
>>+        try {
>>+            if (ignoreSystemClasses) {
>>+                loader = getProject().createClassLoader(classpath);
>>+                loader.setParentFirst(false);
>>+                loader.addJavaLibraries();
>>+                if (loader != null) {
>>+                    try {
>>+                        return loader.findClass(classname);
>>+                    } catch (SecurityException se) {
>>+                        // class found but restricted name; this is
>>+                        // actually the case we're looking for in JDK
> 
> 1.3+,
> 
>>+                        // so catch the exception and return
>>+                        return null;
>>+                    }
>>+                } else {
>>+                    return null;
>>+                }
>>+            } else if (loader != null) {
>>+                return loader.loadClass(classname);
>>+            } else {
>>+                ClassLoader l = this.getClass().getClassLoader();
>>+                // Can return null to represent the bootstrap class
> 
> loader.
> 
>>+                // see API docs of Class.getClassLoader.
>>+                if (l != null) {
>>+                    return Class.forName(classname, true, l);
>>+                } else {
>>+                    return Class.forName(classname);
>>+                }
>>+            }
>>+        } catch (ClassNotFoundException e) {
>>+            throw new BuildException("class \"" + classname + "\" was
> 
> not found");
> 
>>+        } catch (NoClassDefFoundError e) {
>>+            throw new BuildException("Could not load dependent class
> 
> \"" + e.getMessage()
> 
>>+                    + "\" for class \"" + classname + "\"");
>>+        }
>>+    }
> 
> 
> 
> Maybe a candidate for org.apache.tools.ant.util.ClasspathUtils ?

feel free ...

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


Mime
View raw message