>+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 ? Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]