git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270450 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -15,13 +15,12 @@ import java.io.IOException; | |||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.MalformedURLException; | import java.net.MalformedURLException; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -369,17 +368,15 @@ public class XMLValidateTask | |||||
| // load the parser class | // load the parser class | ||||
| // with JAXP, we would use a SAXParser factory | // with JAXP, we would use a SAXParser factory | ||||
| Class readerClass = null; | Class readerClass = null; | ||||
| //Class readerImpl = null; | |||||
| //Class parserImpl = null; | |||||
| if( classpath != null ) | if( classpath != null ) | ||||
| { | { | ||||
| AntClassLoader loader = new AntClassLoader( getProject(), classpath ); | |||||
| // loader.addSystemPackageRoot("org.xml"); // needed to avoid conflict | |||||
| readerClass = loader.loadClass( readerClassName ); | |||||
| AntClassLoader.initializeClass( readerClass ); | |||||
| final ClassLoader classLoader = new URLClassLoader( classpath.toURLs() ); | |||||
| readerClass = classLoader.loadClass( readerClassName ); | |||||
| } | } | ||||
| else | else | ||||
| { | |||||
| readerClass = Class.forName( readerClassName ); | readerClass = Class.forName( readerClassName ); | ||||
| } | |||||
| // then check it implements XMLReader | // then check it implements XMLReader | ||||
| if( XMLReader.class.isAssignableFrom( readerClass ) ) | if( XMLReader.class.isAssignableFrom( readerClass ) ) | ||||
| @@ -8,10 +8,10 @@ | |||||
| package org.apache.antlib.xml; | package org.apache.antlib.xml; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -378,10 +378,8 @@ public class XSLTProcess | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| AntClassLoader al = new AntClassLoader( getProject(), m_classpath ); | |||||
| Class c = al.loadClass( classname ); | |||||
| AntClassLoader.initializeClass( c ); | |||||
| return c; | |||||
| final ClassLoader classLoader = new URLClassLoader( m_classpath.toURLs() ); | |||||
| return classLoader.loadClass( classname ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -8,8 +8,9 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -29,22 +30,22 @@ public class Available | |||||
| extends Task | extends Task | ||||
| implements Condition | implements Condition | ||||
| { | { | ||||
| private String value = "true"; | |||||
| private String classname; | |||||
| private Path classpath; | |||||
| private String file; | |||||
| private Path filepath; | |||||
| private AntClassLoader loader; | |||||
| private String m_value = "true"; | |||||
| private String m_classname; | |||||
| private Path m_classpath; | |||||
| private String m_file; | |||||
| private Path m_filepath; | |||||
| private ClassLoader m_classLoader; | |||||
| private String property; | |||||
| private String resource; | |||||
| private FileDir type; | |||||
| private String m_property; | |||||
| private String m_resource; | |||||
| private FileDir m_type; | |||||
| public void setClassname( String classname ) | public void setClassname( String classname ) | ||||
| { | { | ||||
| if( !"".equals( classname ) ) | if( !"".equals( classname ) ) | ||||
| { | { | ||||
| this.classname = classname; | |||||
| m_classname = classname; | |||||
| } | } | ||||
| } | } | ||||
| @@ -62,7 +63,7 @@ public class Available | |||||
| public void setFile( String file ) | public void setFile( String file ) | ||||
| { | { | ||||
| this.file = file; | |||||
| m_file = file; | |||||
| } | } | ||||
| public void setFilepath( Path filepath ) | public void setFilepath( Path filepath ) | ||||
| @@ -73,102 +74,98 @@ public class Available | |||||
| public void setProperty( String property ) | public void setProperty( String property ) | ||||
| { | { | ||||
| this.property = property; | |||||
| m_property = property; | |||||
| } | } | ||||
| public void setResource( String resource ) | public void setResource( String resource ) | ||||
| { | { | ||||
| this.resource = resource; | |||||
| m_resource = resource; | |||||
| } | } | ||||
| public void setType( FileDir type ) | public void setType( FileDir type ) | ||||
| { | { | ||||
| this.type = type; | |||||
| m_type = type; | |||||
| } | } | ||||
| public void setValue( String value ) | public void setValue( String value ) | ||||
| { | { | ||||
| this.value = value; | |||||
| m_value = value; | |||||
| } | } | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( this.classpath == null ) | |||||
| if( m_classpath == null ) | |||||
| { | { | ||||
| this.classpath = new Path(); | |||||
| m_classpath = new Path(); | |||||
| } | } | ||||
| return this.classpath.createPath(); | |||||
| return m_classpath.createPath(); | |||||
| } | } | ||||
| public Path createFilepath() | public Path createFilepath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( this.filepath == null ) | |||||
| if( m_filepath == null ) | |||||
| { | { | ||||
| this.filepath = new Path(); | |||||
| m_filepath = new Path(); | |||||
| } | } | ||||
| return this.filepath.createPath(); | |||||
| return m_filepath.createPath(); | |||||
| } | } | ||||
| public boolean eval() | public boolean eval() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( classname == null && file == null && resource == null ) | |||||
| if( m_classname == null && m_file == null && m_resource == null ) | |||||
| { | { | ||||
| throw new TaskException( "At least one of (classname|file|resource) is required" ); | throw new TaskException( "At least one of (classname|file|resource) is required" ); | ||||
| } | } | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| if( file == null ) | |||||
| if( m_file == null ) | |||||
| { | { | ||||
| throw new TaskException( "The type attribute is only valid when specifying the file attribute." ); | throw new TaskException( "The type attribute is only valid when specifying the file attribute." ); | ||||
| } | } | ||||
| } | } | ||||
| if( classpath != null ) | |||||
| if( m_classpath != null ) | |||||
| { | { | ||||
| this.loader = new AntClassLoader( getProject(), classpath ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| m_classLoader = new URLClassLoader( urls ); | |||||
| } | } | ||||
| if( ( classname != null ) && !checkClass( classname ) ) | |||||
| if( ( m_classname != null ) && !checkClass( m_classname ) ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to load class " + classname + " to set property " + property ); | |||||
| getLogger().debug( "Unable to load class " + m_classname + " to set property " + m_property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if( ( file != null ) && !checkFile() ) | |||||
| if( ( m_file != null ) && !checkFile() ) | |||||
| { | { | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to find " + type + " " + file + " to set property " + property ); | |||||
| getLogger().debug( "Unable to find " + m_type + " " + m_file + " to set property " + m_property ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| getLogger().debug( "Unable to find " + file + " to set property " + property ); | |||||
| getLogger().debug( "Unable to find " + m_file + " to set property " + m_property ); | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| if( ( resource != null ) && !checkResource( resource ) ) | |||||
| if( ( m_resource != null ) && !checkResource( m_resource ) ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to load resource " + resource + " to set property " + property ); | |||||
| getLogger().debug( "Unable to load resource " + m_resource + " to set property " + m_property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if( loader != null ) | |||||
| { | |||||
| loader.cleanup(); | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( property == null ) | |||||
| if( m_property == null ) | |||||
| { | { | ||||
| throw new TaskException( "property attribute is required" ); | throw new TaskException( "property attribute is required" ); | ||||
| } | } | ||||
| @@ -176,9 +173,9 @@ public class Available | |||||
| if( eval() ) | if( eval() ) | ||||
| { | { | ||||
| String lSep = System.getProperty( "line.separator" ); | String lSep = System.getProperty( "line.separator" ); | ||||
| if( null == getProject().getProperty( property ) ) | |||||
| if( null == getProject().getProperty( m_property ) ) | |||||
| { | { | ||||
| setProperty( property, value ); | |||||
| setProperty( m_property, m_value ); | |||||
| } | } | ||||
| //else ignore | //else ignore | ||||
| } | } | ||||
| @@ -188,24 +185,8 @@ public class Available | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| if( loader != null ) | |||||
| { | |||||
| 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 ) | |||||
| { | |||||
| l.loadClass( classname ); | |||||
| } | |||||
| else | |||||
| { | |||||
| Class.forName( classname ); | |||||
| } | |||||
| } | |||||
| final ClassLoader classLoader = getClassLoader(); | |||||
| classLoader.loadClass( classname ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| catch( ClassNotFoundException e ) | catch( ClassNotFoundException e ) | ||||
| @@ -221,13 +202,13 @@ public class Available | |||||
| private boolean checkFile() | private boolean checkFile() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( filepath == null ) | |||||
| if( m_filepath == null ) | |||||
| { | { | ||||
| return checkFile( resolveFile( file ), file ); | |||||
| return checkFile( resolveFile( m_file ), m_file ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| String[] paths = filepath.list(); | |||||
| String[] paths = m_filepath.list(); | |||||
| for( int i = 0; i < paths.length; ++i ) | for( int i = 0; i < paths.length; ++i ) | ||||
| { | { | ||||
| getLogger().debug( "Searching " + paths[ i ] ); | getLogger().debug( "Searching " + paths[ i ] ); | ||||
| @@ -248,20 +229,20 @@ public class Available | |||||
| // ** full-pathname specified == path in list | // ** full-pathname specified == path in list | ||||
| // ** simple name specified == path in list | // ** simple name specified == path in list | ||||
| if( path.exists() && file.equals( paths[ i ] ) ) | |||||
| if( path.exists() && m_file.equals( paths[ i ] ) ) | |||||
| { | { | ||||
| if( type == null ) | |||||
| if( m_type == null ) | |||||
| { | { | ||||
| getLogger().debug( "Found: " + path ); | getLogger().debug( "Found: " + path ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() | |||||
| else if( m_type.isDir() | |||||
| && path.isDirectory() ) | && path.isDirectory() ) | ||||
| { | { | ||||
| getLogger().debug( "Found directory: " + path ); | getLogger().debug( "Found directory: " + path ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isFile() | |||||
| else if( m_type.isFile() | |||||
| && path.isFile() ) | && path.isFile() ) | ||||
| { | { | ||||
| getLogger().debug( "Found file: " + path ); | getLogger().debug( "Found file: " + path ); | ||||
| @@ -274,14 +255,14 @@ public class Available | |||||
| File parent = path.getParentFile(); | File parent = path.getParentFile(); | ||||
| // ** full-pathname specified == parent dir of path in list | // ** full-pathname specified == parent dir of path in list | ||||
| if( parent != null && parent.exists() | if( parent != null && parent.exists() | ||||
| && file.equals( parent.getAbsolutePath() ) ) | |||||
| && m_file.equals( parent.getAbsolutePath() ) ) | |||||
| { | { | ||||
| if( type == null ) | |||||
| if( m_type == null ) | |||||
| { | { | ||||
| getLogger().debug( "Found: " + parent ); | getLogger().debug( "Found: " + parent ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() ) | |||||
| else if( m_type.isDir() ) | |||||
| { | { | ||||
| getLogger().debug( "Found directory: " + parent ); | getLogger().debug( "Found directory: " + parent ); | ||||
| return true; | return true; | ||||
| @@ -293,8 +274,8 @@ public class Available | |||||
| // ** simple name specified == path in list + name | // ** simple name specified == path in list + name | ||||
| if( path.exists() && path.isDirectory() ) | if( path.exists() && path.isDirectory() ) | ||||
| { | { | ||||
| if( checkFile( new File( path, file ), | |||||
| file + " in " + path ) ) | |||||
| if( checkFile( new File( path, m_file ), | |||||
| m_file + " in " + path ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -303,8 +284,8 @@ public class Available | |||||
| // ** simple name specified == parent dir + name | // ** simple name specified == parent dir + name | ||||
| if( parent != null && parent.exists() ) | if( parent != null && parent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( parent, file ), | |||||
| file + " in " + parent ) ) | |||||
| if( checkFile( new File( parent, m_file ), | |||||
| m_file + " in " + parent ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -316,8 +297,8 @@ public class Available | |||||
| File grandParent = parent.getParentFile(); | File grandParent = parent.getParentFile(); | ||||
| if( grandParent != null && grandParent.exists() ) | if( grandParent != null && grandParent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( grandParent, file ), | |||||
| file + " in " + grandParent ) ) | |||||
| if( checkFile( new File( grandParent, m_file ), | |||||
| m_file + " in " + grandParent ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -330,9 +311,9 @@ public class Available | |||||
| private boolean checkFile( File f, String text ) | private boolean checkFile( File f, String text ) | ||||
| { | { | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| if( type.isDir() ) | |||||
| if( m_type.isDir() ) | |||||
| { | { | ||||
| if( f.isDirectory() ) | if( f.isDirectory() ) | ||||
| { | { | ||||
| @@ -340,7 +321,7 @@ public class Available | |||||
| } | } | ||||
| return f.isDirectory(); | return f.isDirectory(); | ||||
| } | } | ||||
| else if( type.isFile() ) | |||||
| else if( m_type.isFile() ) | |||||
| { | { | ||||
| if( f.isFile() ) | if( f.isFile() ) | ||||
| { | { | ||||
| @@ -358,22 +339,19 @@ public class Available | |||||
| private boolean checkResource( String resource ) | private boolean checkResource( String resource ) | ||||
| { | { | ||||
| if( loader != null ) | |||||
| final ClassLoader classLoader = getClassLoader(); | |||||
| return ( null != classLoader.getResourceAsStream( resource ) ); | |||||
| } | |||||
| private ClassLoader getClassLoader() | |||||
| { | |||||
| if( null == m_classLoader ) | |||||
| { | { | ||||
| return ( loader.getResourceAsStream( resource ) != null ); | |||||
| return ClassLoader.getSystemClassLoader(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| ClassLoader cL = this.getClass().getClassLoader(); | |||||
| if( cL != null ) | |||||
| { | |||||
| return ( cL.getResourceAsStream( resource ) != null ); | |||||
| } | |||||
| else | |||||
| { | |||||
| return | |||||
| ( ClassLoader.getSystemResourceAsStream( resource ) != null ); | |||||
| } | |||||
| return m_classLoader; | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,8 +9,9 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -20,56 +21,51 @@ import org.apache.tools.ant.types.Path; | |||||
| * @author thomas.haas@softwired-inc.com | * @author thomas.haas@softwired-inc.com | ||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| */ | */ | ||||
| public class ExecuteJava | public class ExecuteJava | ||||
| { | { | ||||
| private Commandline m_javaCommand; | |||||
| private Path m_classpath; | |||||
| private CommandlineJava.SysProperties m_sysProperties; | |||||
| private Commandline javaCommand = null; | |||||
| private Path classpath = null; | |||||
| private CommandlineJava.SysProperties sysProperties = null; | |||||
| public void setClasspath( Path p ) | |||||
| public void setClasspath( final Path classpath ) | |||||
| { | { | ||||
| classpath = p; | |||||
| m_classpath = classpath; | |||||
| } | } | ||||
| public void setJavaCommand( Commandline javaCommand ) | |||||
| public void setJavaCommand( final Commandline javaCommand ) | |||||
| { | { | ||||
| this.javaCommand = javaCommand; | |||||
| m_javaCommand = javaCommand; | |||||
| } | } | ||||
| public void setSystemProperties( CommandlineJava.SysProperties s ) | |||||
| public void setSystemProperties( final CommandlineJava.SysProperties sysProperties ) | |||||
| { | { | ||||
| sysProperties = s; | |||||
| m_sysProperties = sysProperties; | |||||
| } | } | ||||
| public void execute( Project project ) | public void execute( Project project ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final String classname = javaCommand.getExecutable(); | |||||
| final Object[] argument = {javaCommand.getArguments()}; | |||||
| final String classname = m_javaCommand.getExecutable(); | |||||
| final Object[] argument = {m_javaCommand.getArguments()}; | |||||
| AntClassLoader loader = null; | |||||
| try | try | ||||
| { | { | ||||
| if( sysProperties != null ) | |||||
| if( m_sysProperties != null ) | |||||
| { | { | ||||
| sysProperties.setSystem(); | |||||
| m_sysProperties.setSystem(); | |||||
| } | } | ||||
| final Class[] param = {Class.forName( "[Ljava.lang.String;" )}; | final Class[] param = {Class.forName( "[Ljava.lang.String;" )}; | ||||
| Class target = null; | Class target = null; | ||||
| if( classpath == null ) | |||||
| if( m_classpath == null ) | |||||
| { | { | ||||
| target = Class.forName( classname ); | target = Class.forName( classname ); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| loader = new AntClassLoader( Project.class.getClassLoader(), project, classpath, false ); | |||||
| loader.setIsolated( true ); | |||||
| loader.setThreadContextLoader(); | |||||
| target = loader.forceLoadClass( classname ); | |||||
| AntClassLoader.initializeClass( target ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| final URLClassLoader classLoader = new URLClassLoader( urls ); | |||||
| target = classLoader.loadClass( classname ); | |||||
| } | } | ||||
| final Method main = target.getMethod( "main", param ); | final Method main = target.getMethod( "main", param ); | ||||
| main.invoke( null, argument ); | main.invoke( null, argument ); | ||||
| @@ -100,14 +96,9 @@ public class ExecuteJava | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| if( loader != null ) | |||||
| { | |||||
| loader.resetThreadContextLoader(); | |||||
| loader.cleanup(); | |||||
| } | |||||
| if( sysProperties != null ) | |||||
| if( m_sysProperties != null ) | |||||
| { | { | ||||
| sysProperties.restoreSystem(); | |||||
| m_sysProperties.restoreSystem(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -11,13 +11,13 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.util.Enumeration; | |||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.framework.exec.Environment; | import org.apache.myrmidon.framework.exec.Environment; | ||||
| import org.apache.myrmidon.framework.exec.ExecException; | import org.apache.myrmidon.framework.exec.ExecException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| @@ -269,26 +269,18 @@ public class Property | |||||
| getLogger().debug( "Resource Loading " + name ); | getLogger().debug( "Resource Loading " + name ); | ||||
| try | try | ||||
| { | { | ||||
| ClassLoader cL = null; | |||||
| InputStream is = null; | |||||
| ClassLoader classLoader = null; | |||||
| if( m_classpath != null ) | if( m_classpath != null ) | ||||
| { | { | ||||
| cL = new AntClassLoader( getProject(), m_classpath ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| classLoader = new URLClassLoader( urls ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| cL = getClass().getClassLoader(); | |||||
| } | |||||
| if( cL == null ) | |||||
| { | |||||
| is = ClassLoader.getSystemResourceAsStream( name ); | |||||
| } | |||||
| else | |||||
| { | |||||
| is = cL.getResourceAsStream( name ); | |||||
| classLoader = ClassLoader.getSystemClassLoader(); | |||||
| } | } | ||||
| final InputStream is = classLoader.getResourceAsStream( name ); | |||||
| if( is != null ) | if( is != null ) | ||||
| { | { | ||||
| @@ -9,11 +9,11 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URLClassLoader; | |||||
| import java.rmi.Remote; | import java.rmi.Remote; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | ||||
| @@ -525,7 +525,7 @@ public class Rmic extends MatchingTask | |||||
| adapter.setRmic( this ); | adapter.setRmic( this ); | ||||
| Path classpath = adapter.getClasspath(); | Path classpath = adapter.getClasspath(); | ||||
| loader = new AntClassLoader( getProject(), classpath ); | |||||
| loader = new URLClassLoader( classpath.toURLs() ); | |||||
| // scan base dirs to build up compile lists only if a | // scan base dirs to build up compile lists only if a | ||||
| // specific classname is not given | // specific classname is not given | ||||
| @@ -18,6 +18,7 @@ import java.io.InputStreamReader; | |||||
| import java.io.PrintStream; | import java.io.PrintStream; | ||||
| import java.io.Reader; | import java.io.Reader; | ||||
| import java.io.StringReader; | import java.io.StringReader; | ||||
| import java.net.URLClassLoader; | |||||
| import java.sql.Connection; | import java.sql.Connection; | ||||
| import java.sql.DatabaseMetaData; | import java.sql.DatabaseMetaData; | ||||
| import java.sql.Driver; | import java.sql.Driver; | ||||
| @@ -31,7 +32,6 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -47,9 +47,9 @@ import org.apache.tools.ant.types.Reference; | |||||
| * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | ||||
| * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | ||||
| */ | */ | ||||
| public class SQLExec extends Task | |||||
| public class SQLExec | |||||
| extends Task | |||||
| { | { | ||||
| private int goodSql = 0, totalSql = 0; | private int goodSql = 0, totalSql = 0; | ||||
| private ArrayList filesets = new ArrayList(); | private ArrayList filesets = new ArrayList(); | ||||
| @@ -57,42 +57,42 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Database connection | * Database connection | ||||
| */ | */ | ||||
| private Connection conn = null; | |||||
| private Connection conn; | |||||
| /** | /** | ||||
| * Autocommit flag. Default value is false | * Autocommit flag. Default value is false | ||||
| */ | */ | ||||
| private boolean autocommit = false; | |||||
| private boolean autocommit; | |||||
| /** | /** | ||||
| * SQL statement | * SQL statement | ||||
| */ | */ | ||||
| private Statement statement = null; | |||||
| private Statement statement; | |||||
| /** | /** | ||||
| * DB driver. | * DB driver. | ||||
| */ | */ | ||||
| private String driver = null; | |||||
| private String driver; | |||||
| /** | /** | ||||
| * DB url. | * DB url. | ||||
| */ | */ | ||||
| private String url = null; | |||||
| private String url; | |||||
| /** | /** | ||||
| * User name. | * User name. | ||||
| */ | */ | ||||
| private String userId = null; | |||||
| private String userId; | |||||
| /** | /** | ||||
| * Password | * Password | ||||
| */ | */ | ||||
| private String password = null; | |||||
| private String password; | |||||
| /** | /** | ||||
| * SQL input file | * SQL input file | ||||
| */ | */ | ||||
| private File srcFile = null; | |||||
| private File srcFile; | |||||
| /** | /** | ||||
| * SQL input command | * SQL input command | ||||
| @@ -118,7 +118,7 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Print SQL results. | * Print SQL results. | ||||
| */ | */ | ||||
| private boolean print = false; | |||||
| private boolean print; | |||||
| /** | /** | ||||
| * Print header columns. | * Print header columns. | ||||
| @@ -128,17 +128,17 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Results Output file. | * Results Output file. | ||||
| */ | */ | ||||
| private File output = null; | |||||
| private File output; | |||||
| /** | /** | ||||
| * RDBMS Product needed for this SQL. | * RDBMS Product needed for this SQL. | ||||
| */ | */ | ||||
| private String rdbms = null; | |||||
| private String rdbms; | |||||
| /** | /** | ||||
| * RDBMS Version needed for this SQL. | * RDBMS Version needed for this SQL. | ||||
| */ | */ | ||||
| private String version = null; | |||||
| private String version; | |||||
| /** | /** | ||||
| * Action to perform if an error is found | * Action to perform if an error is found | ||||
| @@ -148,12 +148,10 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Encoding to use when reading SQL statements from a file | * Encoding to use when reading SQL statements from a file | ||||
| */ | */ | ||||
| private String encoding = null; | |||||
| private String encoding; | |||||
| private Path classpath; | private Path classpath; | ||||
| private AntClassLoader loader; | |||||
| /** | /** | ||||
| * Set the autocommit flag for the DB connection. | * Set the autocommit flag for the DB connection. | ||||
| * | * | ||||
| @@ -457,8 +455,8 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); | getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); | ||||
| loader = new AntClassLoader( getProject(), classpath ); | |||||
| dc = loader.loadClass( driver ); | |||||
| final ClassLoader classLoader = new URLClassLoader( classpath.toURLs() ); | |||||
| dc = classLoader.loadClass( driver ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -401,8 +401,7 @@ public abstract class DefaultCompilerAdapter | |||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| { | { | ||||
| throw new TaskException( "Error running " + args[ 0 ] | |||||
| + " compiler", e ); | |||||
| throw new TaskException( "Error running " + args[ 0 ] + " compiler", e ); | |||||
| } | } | ||||
| } | } | ||||
| finally | finally | ||||
| @@ -15,12 +15,12 @@ import java.io.FileWriter; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -579,7 +579,7 @@ public class Depend extends MatchingTask | |||||
| { | { | ||||
| // now determine which jars each class depends upon | // now determine which jars each class depends upon | ||||
| classpathDependencies = new Hashtable(); | classpathDependencies = new Hashtable(); | ||||
| AntClassLoader loader = new AntClassLoader( getProject(), dependClasspath ); | |||||
| final ClassLoader classLoader = new URLClassLoader( dependClasspath.toURLs() ); | |||||
| Hashtable classpathFileCache = new Hashtable(); | Hashtable classpathFileCache = new Hashtable(); | ||||
| Object nullFileMarker = new Object(); | Object nullFileMarker = new Object(); | ||||
| @@ -599,7 +599,8 @@ public class Depend extends MatchingTask | |||||
| if( !dependency.startsWith( "java." ) && !dependency.startsWith( "javax." ) ) | if( !dependency.startsWith( "java." ) && !dependency.startsWith( "javax." ) ) | ||||
| { | { | ||||
| URL classURL = loader.getResource( dependency.replace( '.', '/' ) + ".class" ); | |||||
| final String name = dependency.replace( '.', '/' ) + ".class"; | |||||
| URL classURL = classLoader.getResource( name ); | |||||
| if( classURL != null ) | if( classURL != null ) | ||||
| { | { | ||||
| if( classURL.getProtocol().equals( "jar" ) ) | if( classURL.getProtocol().equals( "jar" ) ) | ||||
| @@ -12,6 +12,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashSet; | import java.util.HashSet; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| @@ -27,7 +28,6 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.bcel.*; | import org.apache.bcel.*; | ||||
| import org.apache.bcel.classfile.*; | import org.apache.bcel.classfile.*; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -329,7 +329,7 @@ public class GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| classpathLoader = new AntClassLoader( getTask().getProject(), combinedClasspath ); | |||||
| classpathLoader = new URLClassLoader( combinedClasspath.toURLs() ); | |||||
| } | } | ||||
| return classpathLoader; | return classpathLoader; | ||||
| @@ -12,6 +12,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.jar.JarEntry; | import java.util.jar.JarEntry; | ||||
| @@ -21,7 +22,6 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| @@ -332,7 +332,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| lookupPath.append( classpath ); | lookupPath.append( classpath ); | ||||
| } | } | ||||
| return new AntClassLoader( getTask().getProject(), lookupPath ); | |||||
| return new URLClassLoader( lookupPath.toURLs() ); | |||||
| } | } | ||||
| protected DescriptorHandler getWeblogicDescriptorHandler( final File srcDir ) | protected DescriptorHandler getWeblogicDescriptorHandler( final File srcDir ) | ||||
| @@ -11,13 +11,13 @@ import java.io.File; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.jar.JarEntry; | import java.util.jar.JarEntry; | ||||
| import java.util.jar.JarFile; | import java.util.jar.JarFile; | ||||
| import java.util.jar.JarOutputStream; | import java.util.jar.JarOutputStream; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -410,7 +410,7 @@ public class WebsphereDeploymentTool | |||||
| { | { | ||||
| lookupPath.append( classpath ); | lookupPath.append( classpath ); | ||||
| } | } | ||||
| return new AntClassLoader( getTask().getProject(), lookupPath ); | |||||
| return new URLClassLoader( lookupPath.toURLs() ); | |||||
| } | } | ||||
| protected DescriptorHandler getDescriptorHandler( File srcDir ) | protected DescriptorHandler getDescriptorHandler( File srcDir ) | ||||
| @@ -12,6 +12,7 @@ import java.io.FileOutputStream; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| @@ -19,7 +20,6 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| @@ -694,19 +694,18 @@ public class JUnitTask extends Task | |||||
| try | try | ||||
| { | { | ||||
| getLogger().debug( "Using System properties " + System.getProperties() ); | getLogger().debug( "Using System properties " + System.getProperties() ); | ||||
| AntClassLoader cl = null; | |||||
| ClassLoader classLoader = null; | |||||
| Path classpath = commandline.getClasspath(); | Path classpath = commandline.getClasspath(); | ||||
| if( classpath != null ) | if( classpath != null ) | ||||
| { | { | ||||
| getLogger().debug( "Using CLASSPATH " + classpath ); | getLogger().debug( "Using CLASSPATH " + classpath ); | ||||
| cl = new AntClassLoader( null, getProject(), classpath, false ); | |||||
| // make sure the test will be accepted as a TestCase | |||||
| cl.addSystemPackageRoot( "junit" ); | |||||
| // will cause trouble in JDK 1.1 if omitted | |||||
| cl.addSystemPackageRoot( "org.apache.tools.ant" ); | |||||
| classLoader = new URLClassLoader( classpath.toURLs() ); | |||||
| } | } | ||||
| runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); | |||||
| runner = new JUnitTestRunner( test, | |||||
| test.getHaltonerror(), | |||||
| test.getFiltertrace(), | |||||
| test.getHaltonfailure(), | |||||
| classLoader ); | |||||
| if( summary ) | if( summary ) | ||||
| { | { | ||||
| getLogger().info( "Running " + test.getName() ); | getLogger().info( "Running " + test.getName() ); | ||||
| @@ -28,9 +28,6 @@ import junit.framework.TestResult; | |||||
| import junit.framework.TestSuite; | import junit.framework.TestSuite; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * Simple Testrunner for JUnit that runs all tests of a testsuite. <p> | * Simple Testrunner for JUnit that runs all tests of a testsuite. <p> | ||||
| @@ -179,7 +176,6 @@ public class JUnitTestRunner implements TestListener | |||||
| else | else | ||||
| { | { | ||||
| testClass = loader.loadClass( test.getName() ); | testClass = loader.loadClass( test.getName() ); | ||||
| AntClassLoader.initializeClass( testClass ); | |||||
| } | } | ||||
| Method suiteMethod = null; | Method suiteMethod = null; | ||||
| @@ -24,7 +24,6 @@ import org.apache.tools.ant.DirectoryScanner; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.util.DOMElementWriter; | import org.apache.tools.ant.util.DOMElementWriter; | ||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||
| import org.w3c.dom.Element; | import org.w3c.dom.Element; | ||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| @@ -184,7 +183,7 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| } | } | ||||
| if( toDir == null ) | if( toDir == null ) | ||||
| { | { | ||||
| toDir = FileUtil.resolveFile( getProject().getBaseDir(), DEFAULT_DIR ); | |||||
| toDir = FileUtil.resolveFile( getBaseDirectory(), DEFAULT_DIR ); | |||||
| } | } | ||||
| return new File( toDir, toFile ); | return new File( toDir, toFile ); | ||||
| } | } | ||||
| @@ -210,16 +209,13 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| if( pathname.endsWith( ".xml" ) ) | if( pathname.endsWith( ".xml" ) ) | ||||
| { | { | ||||
| File file = new File( ds.getBasedir(), pathname ); | File file = new File( ds.getBasedir(), pathname ); | ||||
| file = FileUtil. | |||||
| resolveFile( getProject().getBaseDir(), file.getPath() ); | |||||
| file = FileUtil.resolveFile( getBaseDirectory(), file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| File[] files = new File[ v.size() ]; | |||||
| v.copyInto( files ); | |||||
| return files; | |||||
| return (File[])v.toArray( new File[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -7,10 +7,10 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
| import java.util.Properties; | |||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import java.util.Stack; | import java.util.Stack; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
| /** | /** | ||||
| @@ -182,10 +182,9 @@ public class Mapper | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| AntClassLoader al = new AntClassLoader( getProject(), | |||||
| m_classpath ); | |||||
| c = al.loadClass( m_classname ); | |||||
| AntClassLoader.initializeClass( c ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| final URLClassLoader classLoader = new URLClassLoader( urls ); | |||||
| c = classLoader.loadClass( m_classname ); | |||||
| } | } | ||||
| FileNameMapper m = (FileNameMapper)c.newInstance(); | FileNameMapper m = (FileNameMapper)c.newInstance(); | ||||
| @@ -8,6 +8,8 @@ | |||||
| package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.net.URL; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| @@ -644,6 +646,33 @@ public class Path | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Returns an array of URLs - useful for building a ClassLoader. | |||||
| */ | |||||
| public URL[] toURLs() | |||||
| throws TaskException | |||||
| { | |||||
| try | |||||
| { | |||||
| final String[] list = list(); | |||||
| final URL[] result = new URL[ list.length ]; | |||||
| // path containing one or more elements | |||||
| for( int i = 0; i < list.length; i++ ) | |||||
| { | |||||
| result[ i ] = new File( list[ i ] ).toURL(); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| catch( final IOException ioe ) | |||||
| { | |||||
| final String message = "Malformed path entry. Reason:" + ioe; | |||||
| throw new TaskException( message, ioe ); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Overrides the version of DataType to recurse on all DataType child | * Overrides the version of DataType to recurse on all DataType child | ||||
| * elements that may have been added. | * elements that may have been added. | ||||
| @@ -655,7 +684,6 @@ public class Path | |||||
| protected void dieOnCircularReference( Stack stk, Project p ) | protected void dieOnCircularReference( Stack stk, Project p ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( checked ) | if( checked ) | ||||
| { | { | ||||
| return; | return; | ||||
| @@ -8,8 +8,9 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -29,22 +30,22 @@ public class Available | |||||
| extends Task | extends Task | ||||
| implements Condition | implements Condition | ||||
| { | { | ||||
| private String value = "true"; | |||||
| private String classname; | |||||
| private Path classpath; | |||||
| private String file; | |||||
| private Path filepath; | |||||
| private AntClassLoader loader; | |||||
| private String m_value = "true"; | |||||
| private String m_classname; | |||||
| private Path m_classpath; | |||||
| private String m_file; | |||||
| private Path m_filepath; | |||||
| private ClassLoader m_classLoader; | |||||
| private String property; | |||||
| private String resource; | |||||
| private FileDir type; | |||||
| private String m_property; | |||||
| private String m_resource; | |||||
| private FileDir m_type; | |||||
| public void setClassname( String classname ) | public void setClassname( String classname ) | ||||
| { | { | ||||
| if( !"".equals( classname ) ) | if( !"".equals( classname ) ) | ||||
| { | { | ||||
| this.classname = classname; | |||||
| m_classname = classname; | |||||
| } | } | ||||
| } | } | ||||
| @@ -62,7 +63,7 @@ public class Available | |||||
| public void setFile( String file ) | public void setFile( String file ) | ||||
| { | { | ||||
| this.file = file; | |||||
| m_file = file; | |||||
| } | } | ||||
| public void setFilepath( Path filepath ) | public void setFilepath( Path filepath ) | ||||
| @@ -73,102 +74,98 @@ public class Available | |||||
| public void setProperty( String property ) | public void setProperty( String property ) | ||||
| { | { | ||||
| this.property = property; | |||||
| m_property = property; | |||||
| } | } | ||||
| public void setResource( String resource ) | public void setResource( String resource ) | ||||
| { | { | ||||
| this.resource = resource; | |||||
| m_resource = resource; | |||||
| } | } | ||||
| public void setType( FileDir type ) | public void setType( FileDir type ) | ||||
| { | { | ||||
| this.type = type; | |||||
| m_type = type; | |||||
| } | } | ||||
| public void setValue( String value ) | public void setValue( String value ) | ||||
| { | { | ||||
| this.value = value; | |||||
| m_value = value; | |||||
| } | } | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( this.classpath == null ) | |||||
| if( m_classpath == null ) | |||||
| { | { | ||||
| this.classpath = new Path(); | |||||
| m_classpath = new Path(); | |||||
| } | } | ||||
| return this.classpath.createPath(); | |||||
| return m_classpath.createPath(); | |||||
| } | } | ||||
| public Path createFilepath() | public Path createFilepath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( this.filepath == null ) | |||||
| if( m_filepath == null ) | |||||
| { | { | ||||
| this.filepath = new Path(); | |||||
| m_filepath = new Path(); | |||||
| } | } | ||||
| return this.filepath.createPath(); | |||||
| return m_filepath.createPath(); | |||||
| } | } | ||||
| public boolean eval() | public boolean eval() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( classname == null && file == null && resource == null ) | |||||
| if( m_classname == null && m_file == null && m_resource == null ) | |||||
| { | { | ||||
| throw new TaskException( "At least one of (classname|file|resource) is required" ); | throw new TaskException( "At least one of (classname|file|resource) is required" ); | ||||
| } | } | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| if( file == null ) | |||||
| if( m_file == null ) | |||||
| { | { | ||||
| throw new TaskException( "The type attribute is only valid when specifying the file attribute." ); | throw new TaskException( "The type attribute is only valid when specifying the file attribute." ); | ||||
| } | } | ||||
| } | } | ||||
| if( classpath != null ) | |||||
| if( m_classpath != null ) | |||||
| { | { | ||||
| this.loader = new AntClassLoader( getProject(), classpath ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| m_classLoader = new URLClassLoader( urls ); | |||||
| } | } | ||||
| if( ( classname != null ) && !checkClass( classname ) ) | |||||
| if( ( m_classname != null ) && !checkClass( m_classname ) ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to load class " + classname + " to set property " + property ); | |||||
| getLogger().debug( "Unable to load class " + m_classname + " to set property " + m_property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if( ( file != null ) && !checkFile() ) | |||||
| if( ( m_file != null ) && !checkFile() ) | |||||
| { | { | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to find " + type + " " + file + " to set property " + property ); | |||||
| getLogger().debug( "Unable to find " + m_type + " " + m_file + " to set property " + m_property ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| getLogger().debug( "Unable to find " + file + " to set property " + property ); | |||||
| getLogger().debug( "Unable to find " + m_file + " to set property " + m_property ); | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| if( ( resource != null ) && !checkResource( resource ) ) | |||||
| if( ( m_resource != null ) && !checkResource( m_resource ) ) | |||||
| { | { | ||||
| getLogger().debug( "Unable to load resource " + resource + " to set property " + property ); | |||||
| getLogger().debug( "Unable to load resource " + m_resource + " to set property " + m_property ); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if( loader != null ) | |||||
| { | |||||
| loader.cleanup(); | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( property == null ) | |||||
| if( m_property == null ) | |||||
| { | { | ||||
| throw new TaskException( "property attribute is required" ); | throw new TaskException( "property attribute is required" ); | ||||
| } | } | ||||
| @@ -176,9 +173,9 @@ public class Available | |||||
| if( eval() ) | if( eval() ) | ||||
| { | { | ||||
| String lSep = System.getProperty( "line.separator" ); | String lSep = System.getProperty( "line.separator" ); | ||||
| if( null == getProject().getProperty( property ) ) | |||||
| if( null == getProject().getProperty( m_property ) ) | |||||
| { | { | ||||
| setProperty( property, value ); | |||||
| setProperty( m_property, m_value ); | |||||
| } | } | ||||
| //else ignore | //else ignore | ||||
| } | } | ||||
| @@ -188,24 +185,8 @@ public class Available | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| if( loader != null ) | |||||
| { | |||||
| 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 ) | |||||
| { | |||||
| l.loadClass( classname ); | |||||
| } | |||||
| else | |||||
| { | |||||
| Class.forName( classname ); | |||||
| } | |||||
| } | |||||
| final ClassLoader classLoader = getClassLoader(); | |||||
| classLoader.loadClass( classname ); | |||||
| return true; | return true; | ||||
| } | } | ||||
| catch( ClassNotFoundException e ) | catch( ClassNotFoundException e ) | ||||
| @@ -221,13 +202,13 @@ public class Available | |||||
| private boolean checkFile() | private boolean checkFile() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( filepath == null ) | |||||
| if( m_filepath == null ) | |||||
| { | { | ||||
| return checkFile( resolveFile( file ), file ); | |||||
| return checkFile( resolveFile( m_file ), m_file ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| String[] paths = filepath.list(); | |||||
| String[] paths = m_filepath.list(); | |||||
| for( int i = 0; i < paths.length; ++i ) | for( int i = 0; i < paths.length; ++i ) | ||||
| { | { | ||||
| getLogger().debug( "Searching " + paths[ i ] ); | getLogger().debug( "Searching " + paths[ i ] ); | ||||
| @@ -248,20 +229,20 @@ public class Available | |||||
| // ** full-pathname specified == path in list | // ** full-pathname specified == path in list | ||||
| // ** simple name specified == path in list | // ** simple name specified == path in list | ||||
| if( path.exists() && file.equals( paths[ i ] ) ) | |||||
| if( path.exists() && m_file.equals( paths[ i ] ) ) | |||||
| { | { | ||||
| if( type == null ) | |||||
| if( m_type == null ) | |||||
| { | { | ||||
| getLogger().debug( "Found: " + path ); | getLogger().debug( "Found: " + path ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() | |||||
| else if( m_type.isDir() | |||||
| && path.isDirectory() ) | && path.isDirectory() ) | ||||
| { | { | ||||
| getLogger().debug( "Found directory: " + path ); | getLogger().debug( "Found directory: " + path ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isFile() | |||||
| else if( m_type.isFile() | |||||
| && path.isFile() ) | && path.isFile() ) | ||||
| { | { | ||||
| getLogger().debug( "Found file: " + path ); | getLogger().debug( "Found file: " + path ); | ||||
| @@ -274,14 +255,14 @@ public class Available | |||||
| File parent = path.getParentFile(); | File parent = path.getParentFile(); | ||||
| // ** full-pathname specified == parent dir of path in list | // ** full-pathname specified == parent dir of path in list | ||||
| if( parent != null && parent.exists() | if( parent != null && parent.exists() | ||||
| && file.equals( parent.getAbsolutePath() ) ) | |||||
| && m_file.equals( parent.getAbsolutePath() ) ) | |||||
| { | { | ||||
| if( type == null ) | |||||
| if( m_type == null ) | |||||
| { | { | ||||
| getLogger().debug( "Found: " + parent ); | getLogger().debug( "Found: " + parent ); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else if( type.isDir() ) | |||||
| else if( m_type.isDir() ) | |||||
| { | { | ||||
| getLogger().debug( "Found directory: " + parent ); | getLogger().debug( "Found directory: " + parent ); | ||||
| return true; | return true; | ||||
| @@ -293,8 +274,8 @@ public class Available | |||||
| // ** simple name specified == path in list + name | // ** simple name specified == path in list + name | ||||
| if( path.exists() && path.isDirectory() ) | if( path.exists() && path.isDirectory() ) | ||||
| { | { | ||||
| if( checkFile( new File( path, file ), | |||||
| file + " in " + path ) ) | |||||
| if( checkFile( new File( path, m_file ), | |||||
| m_file + " in " + path ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -303,8 +284,8 @@ public class Available | |||||
| // ** simple name specified == parent dir + name | // ** simple name specified == parent dir + name | ||||
| if( parent != null && parent.exists() ) | if( parent != null && parent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( parent, file ), | |||||
| file + " in " + parent ) ) | |||||
| if( checkFile( new File( parent, m_file ), | |||||
| m_file + " in " + parent ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -316,8 +297,8 @@ public class Available | |||||
| File grandParent = parent.getParentFile(); | File grandParent = parent.getParentFile(); | ||||
| if( grandParent != null && grandParent.exists() ) | if( grandParent != null && grandParent.exists() ) | ||||
| { | { | ||||
| if( checkFile( new File( grandParent, file ), | |||||
| file + " in " + grandParent ) ) | |||||
| if( checkFile( new File( grandParent, m_file ), | |||||
| m_file + " in " + grandParent ) ) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -330,9 +311,9 @@ public class Available | |||||
| private boolean checkFile( File f, String text ) | private boolean checkFile( File f, String text ) | ||||
| { | { | ||||
| if( type != null ) | |||||
| if( m_type != null ) | |||||
| { | { | ||||
| if( type.isDir() ) | |||||
| if( m_type.isDir() ) | |||||
| { | { | ||||
| if( f.isDirectory() ) | if( f.isDirectory() ) | ||||
| { | { | ||||
| @@ -340,7 +321,7 @@ public class Available | |||||
| } | } | ||||
| return f.isDirectory(); | return f.isDirectory(); | ||||
| } | } | ||||
| else if( type.isFile() ) | |||||
| else if( m_type.isFile() ) | |||||
| { | { | ||||
| if( f.isFile() ) | if( f.isFile() ) | ||||
| { | { | ||||
| @@ -358,22 +339,19 @@ public class Available | |||||
| private boolean checkResource( String resource ) | private boolean checkResource( String resource ) | ||||
| { | { | ||||
| if( loader != null ) | |||||
| final ClassLoader classLoader = getClassLoader(); | |||||
| return ( null != classLoader.getResourceAsStream( resource ) ); | |||||
| } | |||||
| private ClassLoader getClassLoader() | |||||
| { | |||||
| if( null == m_classLoader ) | |||||
| { | { | ||||
| return ( loader.getResourceAsStream( resource ) != null ); | |||||
| return ClassLoader.getSystemClassLoader(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| ClassLoader cL = this.getClass().getClassLoader(); | |||||
| if( cL != null ) | |||||
| { | |||||
| return ( cL.getResourceAsStream( resource ) != null ); | |||||
| } | |||||
| else | |||||
| { | |||||
| return | |||||
| ( ClassLoader.getSystemResourceAsStream( resource ) != null ); | |||||
| } | |||||
| return m_classLoader; | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,8 +9,9 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -20,56 +21,51 @@ import org.apache.tools.ant.types.Path; | |||||
| * @author thomas.haas@softwired-inc.com | * @author thomas.haas@softwired-inc.com | ||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| */ | */ | ||||
| public class ExecuteJava | public class ExecuteJava | ||||
| { | { | ||||
| private Commandline m_javaCommand; | |||||
| private Path m_classpath; | |||||
| private CommandlineJava.SysProperties m_sysProperties; | |||||
| private Commandline javaCommand = null; | |||||
| private Path classpath = null; | |||||
| private CommandlineJava.SysProperties sysProperties = null; | |||||
| public void setClasspath( Path p ) | |||||
| public void setClasspath( final Path classpath ) | |||||
| { | { | ||||
| classpath = p; | |||||
| m_classpath = classpath; | |||||
| } | } | ||||
| public void setJavaCommand( Commandline javaCommand ) | |||||
| public void setJavaCommand( final Commandline javaCommand ) | |||||
| { | { | ||||
| this.javaCommand = javaCommand; | |||||
| m_javaCommand = javaCommand; | |||||
| } | } | ||||
| public void setSystemProperties( CommandlineJava.SysProperties s ) | |||||
| public void setSystemProperties( final CommandlineJava.SysProperties sysProperties ) | |||||
| { | { | ||||
| sysProperties = s; | |||||
| m_sysProperties = sysProperties; | |||||
| } | } | ||||
| public void execute( Project project ) | public void execute( Project project ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final String classname = javaCommand.getExecutable(); | |||||
| final Object[] argument = {javaCommand.getArguments()}; | |||||
| final String classname = m_javaCommand.getExecutable(); | |||||
| final Object[] argument = {m_javaCommand.getArguments()}; | |||||
| AntClassLoader loader = null; | |||||
| try | try | ||||
| { | { | ||||
| if( sysProperties != null ) | |||||
| if( m_sysProperties != null ) | |||||
| { | { | ||||
| sysProperties.setSystem(); | |||||
| m_sysProperties.setSystem(); | |||||
| } | } | ||||
| final Class[] param = {Class.forName( "[Ljava.lang.String;" )}; | final Class[] param = {Class.forName( "[Ljava.lang.String;" )}; | ||||
| Class target = null; | Class target = null; | ||||
| if( classpath == null ) | |||||
| if( m_classpath == null ) | |||||
| { | { | ||||
| target = Class.forName( classname ); | target = Class.forName( classname ); | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| loader = new AntClassLoader( Project.class.getClassLoader(), project, classpath, false ); | |||||
| loader.setIsolated( true ); | |||||
| loader.setThreadContextLoader(); | |||||
| target = loader.forceLoadClass( classname ); | |||||
| AntClassLoader.initializeClass( target ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| final URLClassLoader classLoader = new URLClassLoader( urls ); | |||||
| target = classLoader.loadClass( classname ); | |||||
| } | } | ||||
| final Method main = target.getMethod( "main", param ); | final Method main = target.getMethod( "main", param ); | ||||
| main.invoke( null, argument ); | main.invoke( null, argument ); | ||||
| @@ -100,14 +96,9 @@ public class ExecuteJava | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| if( loader != null ) | |||||
| { | |||||
| loader.resetThreadContextLoader(); | |||||
| loader.cleanup(); | |||||
| } | |||||
| if( sysProperties != null ) | |||||
| if( m_sysProperties != null ) | |||||
| { | { | ||||
| sysProperties.restoreSystem(); | |||||
| m_sysProperties.restoreSystem(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -11,13 +11,13 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.util.Enumeration; | |||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.framework.exec.Environment; | import org.apache.myrmidon.framework.exec.Environment; | ||||
| import org.apache.myrmidon.framework.exec.ExecException; | import org.apache.myrmidon.framework.exec.ExecException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| @@ -269,26 +269,18 @@ public class Property | |||||
| getLogger().debug( "Resource Loading " + name ); | getLogger().debug( "Resource Loading " + name ); | ||||
| try | try | ||||
| { | { | ||||
| ClassLoader cL = null; | |||||
| InputStream is = null; | |||||
| ClassLoader classLoader = null; | |||||
| if( m_classpath != null ) | if( m_classpath != null ) | ||||
| { | { | ||||
| cL = new AntClassLoader( getProject(), m_classpath ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| classLoader = new URLClassLoader( urls ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| cL = getClass().getClassLoader(); | |||||
| } | |||||
| if( cL == null ) | |||||
| { | |||||
| is = ClassLoader.getSystemResourceAsStream( name ); | |||||
| } | |||||
| else | |||||
| { | |||||
| is = cL.getResourceAsStream( name ); | |||||
| classLoader = ClassLoader.getSystemClassLoader(); | |||||
| } | } | ||||
| final InputStream is = classLoader.getResourceAsStream( name ); | |||||
| if( is != null ) | if( is != null ) | ||||
| { | { | ||||
| @@ -9,11 +9,11 @@ package org.apache.tools.ant.taskdefs; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.net.URLClassLoader; | |||||
| import java.rmi.Remote; | import java.rmi.Remote; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapter; | ||||
| import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory; | ||||
| @@ -525,7 +525,7 @@ public class Rmic extends MatchingTask | |||||
| adapter.setRmic( this ); | adapter.setRmic( this ); | ||||
| Path classpath = adapter.getClasspath(); | Path classpath = adapter.getClasspath(); | ||||
| loader = new AntClassLoader( getProject(), classpath ); | |||||
| loader = new URLClassLoader( classpath.toURLs() ); | |||||
| // scan base dirs to build up compile lists only if a | // scan base dirs to build up compile lists only if a | ||||
| // specific classname is not given | // specific classname is not given | ||||
| @@ -18,6 +18,7 @@ import java.io.InputStreamReader; | |||||
| import java.io.PrintStream; | import java.io.PrintStream; | ||||
| import java.io.Reader; | import java.io.Reader; | ||||
| import java.io.StringReader; | import java.io.StringReader; | ||||
| import java.net.URLClassLoader; | |||||
| import java.sql.Connection; | import java.sql.Connection; | ||||
| import java.sql.DatabaseMetaData; | import java.sql.DatabaseMetaData; | ||||
| import java.sql.Driver; | import java.sql.Driver; | ||||
| @@ -31,7 +32,6 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -47,9 +47,9 @@ import org.apache.tools.ant.types.Reference; | |||||
| * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | * @author <A href="mailto:gholam@xtra.co.nz">Michael McCallum</A> | ||||
| * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | * @author <A href="mailto:tim.stephenson@sybase.com">Tim Stephenson</A> | ||||
| */ | */ | ||||
| public class SQLExec extends Task | |||||
| public class SQLExec | |||||
| extends Task | |||||
| { | { | ||||
| private int goodSql = 0, totalSql = 0; | private int goodSql = 0, totalSql = 0; | ||||
| private ArrayList filesets = new ArrayList(); | private ArrayList filesets = new ArrayList(); | ||||
| @@ -57,42 +57,42 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Database connection | * Database connection | ||||
| */ | */ | ||||
| private Connection conn = null; | |||||
| private Connection conn; | |||||
| /** | /** | ||||
| * Autocommit flag. Default value is false | * Autocommit flag. Default value is false | ||||
| */ | */ | ||||
| private boolean autocommit = false; | |||||
| private boolean autocommit; | |||||
| /** | /** | ||||
| * SQL statement | * SQL statement | ||||
| */ | */ | ||||
| private Statement statement = null; | |||||
| private Statement statement; | |||||
| /** | /** | ||||
| * DB driver. | * DB driver. | ||||
| */ | */ | ||||
| private String driver = null; | |||||
| private String driver; | |||||
| /** | /** | ||||
| * DB url. | * DB url. | ||||
| */ | */ | ||||
| private String url = null; | |||||
| private String url; | |||||
| /** | /** | ||||
| * User name. | * User name. | ||||
| */ | */ | ||||
| private String userId = null; | |||||
| private String userId; | |||||
| /** | /** | ||||
| * Password | * Password | ||||
| */ | */ | ||||
| private String password = null; | |||||
| private String password; | |||||
| /** | /** | ||||
| * SQL input file | * SQL input file | ||||
| */ | */ | ||||
| private File srcFile = null; | |||||
| private File srcFile; | |||||
| /** | /** | ||||
| * SQL input command | * SQL input command | ||||
| @@ -118,7 +118,7 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Print SQL results. | * Print SQL results. | ||||
| */ | */ | ||||
| private boolean print = false; | |||||
| private boolean print; | |||||
| /** | /** | ||||
| * Print header columns. | * Print header columns. | ||||
| @@ -128,17 +128,17 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Results Output file. | * Results Output file. | ||||
| */ | */ | ||||
| private File output = null; | |||||
| private File output; | |||||
| /** | /** | ||||
| * RDBMS Product needed for this SQL. | * RDBMS Product needed for this SQL. | ||||
| */ | */ | ||||
| private String rdbms = null; | |||||
| private String rdbms; | |||||
| /** | /** | ||||
| * RDBMS Version needed for this SQL. | * RDBMS Version needed for this SQL. | ||||
| */ | */ | ||||
| private String version = null; | |||||
| private String version; | |||||
| /** | /** | ||||
| * Action to perform if an error is found | * Action to perform if an error is found | ||||
| @@ -148,12 +148,10 @@ public class SQLExec extends Task | |||||
| /** | /** | ||||
| * Encoding to use when reading SQL statements from a file | * Encoding to use when reading SQL statements from a file | ||||
| */ | */ | ||||
| private String encoding = null; | |||||
| private String encoding; | |||||
| private Path classpath; | private Path classpath; | ||||
| private AntClassLoader loader; | |||||
| /** | /** | ||||
| * Set the autocommit flag for the DB connection. | * Set the autocommit flag for the DB connection. | ||||
| * | * | ||||
| @@ -457,8 +455,8 @@ public class SQLExec extends Task | |||||
| { | { | ||||
| getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); | getLogger().debug( "Loading " + driver + " using AntClassLoader with classpath " + classpath ); | ||||
| loader = new AntClassLoader( getProject(), classpath ); | |||||
| dc = loader.loadClass( driver ); | |||||
| final ClassLoader classLoader = new URLClassLoader( classpath.toURLs() ); | |||||
| dc = classLoader.loadClass( driver ); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -401,8 +401,7 @@ public abstract class DefaultCompilerAdapter | |||||
| } | } | ||||
| catch( IOException e ) | catch( IOException e ) | ||||
| { | { | ||||
| throw new TaskException( "Error running " + args[ 0 ] | |||||
| + " compiler", e ); | |||||
| throw new TaskException( "Error running " + args[ 0 ] + " compiler", e ); | |||||
| } | } | ||||
| } | } | ||||
| finally | finally | ||||
| @@ -15,12 +15,12 @@ import java.io.FileWriter; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -579,7 +579,7 @@ public class Depend extends MatchingTask | |||||
| { | { | ||||
| // now determine which jars each class depends upon | // now determine which jars each class depends upon | ||||
| classpathDependencies = new Hashtable(); | classpathDependencies = new Hashtable(); | ||||
| AntClassLoader loader = new AntClassLoader( getProject(), dependClasspath ); | |||||
| final ClassLoader classLoader = new URLClassLoader( dependClasspath.toURLs() ); | |||||
| Hashtable classpathFileCache = new Hashtable(); | Hashtable classpathFileCache = new Hashtable(); | ||||
| Object nullFileMarker = new Object(); | Object nullFileMarker = new Object(); | ||||
| @@ -599,7 +599,8 @@ public class Depend extends MatchingTask | |||||
| if( !dependency.startsWith( "java." ) && !dependency.startsWith( "javax." ) ) | if( !dependency.startsWith( "java." ) && !dependency.startsWith( "javax." ) ) | ||||
| { | { | ||||
| URL classURL = loader.getResource( dependency.replace( '.', '/' ) + ".class" ); | |||||
| final String name = dependency.replace( '.', '/' ) + ".class"; | |||||
| URL classURL = classLoader.getResource( name ); | |||||
| if( classURL != null ) | if( classURL != null ) | ||||
| { | { | ||||
| if( classURL.getProtocol().equals( "jar" ) ) | if( classURL.getProtocol().equals( "jar" ) ) | ||||
| @@ -12,6 +12,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.HashSet; | import java.util.HashSet; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| @@ -27,7 +28,6 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.bcel.*; | import org.apache.bcel.*; | ||||
| import org.apache.bcel.classfile.*; | import org.apache.bcel.classfile.*; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| @@ -329,7 +329,7 @@ public class GenericDeploymentTool | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| classpathLoader = new AntClassLoader( getTask().getProject(), combinedClasspath ); | |||||
| classpathLoader = new URLClassLoader( combinedClasspath.toURLs() ); | |||||
| } | } | ||||
| return classpathLoader; | return classpathLoader; | ||||
| @@ -12,6 +12,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.jar.JarEntry; | import java.util.jar.JarEntry; | ||||
| @@ -21,7 +22,6 @@ import javax.xml.parsers.SAXParser; | |||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| @@ -332,7 +332,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
| lookupPath.append( classpath ); | lookupPath.append( classpath ); | ||||
| } | } | ||||
| return new AntClassLoader( getTask().getProject(), lookupPath ); | |||||
| return new URLClassLoader( lookupPath.toURLs() ); | |||||
| } | } | ||||
| protected DescriptorHandler getWeblogicDescriptorHandler( final File srcDir ) | protected DescriptorHandler getWeblogicDescriptorHandler( final File srcDir ) | ||||
| @@ -11,13 +11,13 @@ import java.io.File; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.jar.JarEntry; | import java.util.jar.JarEntry; | ||||
| import java.util.jar.JarFile; | import java.util.jar.JarFile; | ||||
| import java.util.jar.JarOutputStream; | import java.util.jar.JarOutputStream; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| @@ -410,7 +410,7 @@ public class WebsphereDeploymentTool | |||||
| { | { | ||||
| lookupPath.append( classpath ); | lookupPath.append( classpath ); | ||||
| } | } | ||||
| return new AntClassLoader( getTask().getProject(), lookupPath ); | |||||
| return new URLClassLoader( lookupPath.toURLs() ); | |||||
| } | } | ||||
| protected DescriptorHandler getDescriptorHandler( File srcDir ) | protected DescriptorHandler getDescriptorHandler( File srcDir ) | ||||
| @@ -12,6 +12,7 @@ import java.io.FileOutputStream; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Enumeration; | import java.util.Enumeration; | ||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| @@ -19,7 +20,6 @@ import java.util.Iterator; | |||||
| import java.util.Properties; | import java.util.Properties; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | ||||
| @@ -694,19 +694,18 @@ public class JUnitTask extends Task | |||||
| try | try | ||||
| { | { | ||||
| getLogger().debug( "Using System properties " + System.getProperties() ); | getLogger().debug( "Using System properties " + System.getProperties() ); | ||||
| AntClassLoader cl = null; | |||||
| ClassLoader classLoader = null; | |||||
| Path classpath = commandline.getClasspath(); | Path classpath = commandline.getClasspath(); | ||||
| if( classpath != null ) | if( classpath != null ) | ||||
| { | { | ||||
| getLogger().debug( "Using CLASSPATH " + classpath ); | getLogger().debug( "Using CLASSPATH " + classpath ); | ||||
| cl = new AntClassLoader( null, getProject(), classpath, false ); | |||||
| // make sure the test will be accepted as a TestCase | |||||
| cl.addSystemPackageRoot( "junit" ); | |||||
| // will cause trouble in JDK 1.1 if omitted | |||||
| cl.addSystemPackageRoot( "org.apache.tools.ant" ); | |||||
| classLoader = new URLClassLoader( classpath.toURLs() ); | |||||
| } | } | ||||
| runner = new JUnitTestRunner( test, test.getHaltonerror(), test.getFiltertrace(), test.getHaltonfailure(), cl ); | |||||
| runner = new JUnitTestRunner( test, | |||||
| test.getHaltonerror(), | |||||
| test.getFiltertrace(), | |||||
| test.getHaltonfailure(), | |||||
| classLoader ); | |||||
| if( summary ) | if( summary ) | ||||
| { | { | ||||
| getLogger().info( "Running " + test.getName() ); | getLogger().info( "Running " + test.getName() ); | ||||
| @@ -28,9 +28,6 @@ import junit.framework.TestResult; | |||||
| import junit.framework.TestSuite; | import junit.framework.TestSuite; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * Simple Testrunner for JUnit that runs all tests of a testsuite. <p> | * Simple Testrunner for JUnit that runs all tests of a testsuite. <p> | ||||
| @@ -179,7 +176,6 @@ public class JUnitTestRunner implements TestListener | |||||
| else | else | ||||
| { | { | ||||
| testClass = loader.loadClass( test.getName() ); | testClass = loader.loadClass( test.getName() ); | ||||
| AntClassLoader.initializeClass( testClass ); | |||||
| } | } | ||||
| Method suiteMethod = null; | Method suiteMethod = null; | ||||
| @@ -24,7 +24,6 @@ import org.apache.tools.ant.DirectoryScanner; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.util.DOMElementWriter; | import org.apache.tools.ant.util.DOMElementWriter; | ||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| import org.w3c.dom.Document; | import org.w3c.dom.Document; | ||||
| import org.w3c.dom.Element; | import org.w3c.dom.Element; | ||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| @@ -184,7 +183,7 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| } | } | ||||
| if( toDir == null ) | if( toDir == null ) | ||||
| { | { | ||||
| toDir = FileUtil.resolveFile( getProject().getBaseDir(), DEFAULT_DIR ); | |||||
| toDir = FileUtil.resolveFile( getBaseDirectory(), DEFAULT_DIR ); | |||||
| } | } | ||||
| return new File( toDir, toFile ); | return new File( toDir, toFile ); | ||||
| } | } | ||||
| @@ -210,16 +209,13 @@ public class XMLResultAggregator extends Task implements XMLConstants | |||||
| if( pathname.endsWith( ".xml" ) ) | if( pathname.endsWith( ".xml" ) ) | ||||
| { | { | ||||
| File file = new File( ds.getBasedir(), pathname ); | File file = new File( ds.getBasedir(), pathname ); | ||||
| file = FileUtil. | |||||
| resolveFile( getProject().getBaseDir(), file.getPath() ); | |||||
| file = FileUtil.resolveFile( getBaseDirectory(), file.getPath() ); | |||||
| v.add( file ); | v.add( file ); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| File[] files = new File[ v.size() ]; | |||||
| v.copyInto( files ); | |||||
| return files; | |||||
| return (File[])v.toArray( new File[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -7,10 +7,10 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
| import java.util.Properties; | |||||
| import java.net.URL; | |||||
| import java.net.URLClassLoader; | |||||
| import java.util.Stack; | import java.util.Stack; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.AntClassLoader; | |||||
| import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
| /** | /** | ||||
| @@ -182,10 +182,9 @@ public class Mapper | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| AntClassLoader al = new AntClassLoader( getProject(), | |||||
| m_classpath ); | |||||
| c = al.loadClass( m_classname ); | |||||
| AntClassLoader.initializeClass( c ); | |||||
| final URL[] urls = m_classpath.toURLs(); | |||||
| final URLClassLoader classLoader = new URLClassLoader( urls ); | |||||
| c = classLoader.loadClass( m_classname ); | |||||
| } | } | ||||
| FileNameMapper m = (FileNameMapper)c.newInstance(); | FileNameMapper m = (FileNameMapper)c.newInstance(); | ||||
| @@ -8,6 +8,8 @@ | |||||
| package org.apache.tools.ant.types; | package org.apache.tools.ant.types; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | |||||
| import java.net.URL; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Locale; | import java.util.Locale; | ||||
| @@ -644,6 +646,33 @@ public class Path | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Returns an array of URLs - useful for building a ClassLoader. | |||||
| */ | |||||
| public URL[] toURLs() | |||||
| throws TaskException | |||||
| { | |||||
| try | |||||
| { | |||||
| final String[] list = list(); | |||||
| final URL[] result = new URL[ list.length ]; | |||||
| // path containing one or more elements | |||||
| for( int i = 0; i < list.length; i++ ) | |||||
| { | |||||
| result[ i ] = new File( list[ i ] ).toURL(); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| catch( final IOException ioe ) | |||||
| { | |||||
| final String message = "Malformed path entry. Reason:" + ioe; | |||||
| throw new TaskException( message, ioe ); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Overrides the version of DataType to recurse on all DataType child | * Overrides the version of DataType to recurse on all DataType child | ||||
| * elements that may have been added. | * elements that may have been added. | ||||
| @@ -655,7 +684,6 @@ public class Path | |||||
| protected void dieOnCircularReference( Stack stk, Project p ) | protected void dieOnCircularReference( Stack stk, Project p ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( checked ) | if( checked ) | ||||
| { | { | ||||
| return; | return; | ||||