little narrower, to make it easier to extract an interface, and get multiple path implementations happening. * Replaced usages of Path.append() with Path.addPath(), and removed append(). * Replaced usages of Path.addExisting() with Path.addPath(), and removed addExisting(). * Replaced Path.size() with Path.isEmpty(). * Added the setX() methods back. * Replaced usages of Path.toString() with new PathUtil.formatPath() method, and removed Path.toString(). Probably missed a few usages. * Replaced FileUtil.translatePath( Path ) with PathUtil.formatPath(), and removed translatePath(). * Enabled the String -> Path converter again. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271893 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -396,7 +396,7 @@ public class CSharp | |||||
| { | { | ||||
| m_referenceFiles = new Path(); | m_referenceFiles = new Path(); | ||||
| } | } | ||||
| m_referenceFiles.append( path ); | |||||
| m_referenceFiles.addPath( path ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -109,7 +109,7 @@ public class XMLValidateTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_classpath.append( classpath ); | |||||
| m_classpath.addPath( classpath ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,8 +1,6 @@ | |||||
| <ant-lib version="1.0"> | <ant-lib version="1.0"> | ||||
| <types> | <types> | ||||
| <task name="ant1-tasklib" classname="org.apache.myrmidon.libs.ant1.Ant1Tasklib" /> | |||||
| <data-type name="path" classname="org.apache.tools.ant.types.Path" /> | <data-type name="path" classname="org.apache.tools.ant.types.Path" /> | ||||
| <task name="path" classname="org.apache.myrmidon.framework.TypeInstanceTask" /> | <task name="path" classname="org.apache.myrmidon.framework.TypeInstanceTask" /> | ||||
| <converter | <converter | ||||
| @@ -21,6 +21,7 @@ import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | |||||
| import org.apache.tools.todo.taskdefs.javac.Javac; | import org.apache.tools.todo.taskdefs.javac.Javac; | ||||
| import org.apache.tools.todo.types.DirectoryScanner; | import org.apache.tools.todo.types.DirectoryScanner; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Instruments Java classes with <a href="http://www.reliable-systems.com/tools/"> | * Instruments Java classes with <a href="http://www.reliable-systems.com/tools/"> | ||||
| @@ -484,9 +485,9 @@ public class IContract extends MatchingTask | |||||
| * @param path The new Classpath value | * @param path The new Classpath value | ||||
| * @path the classpath | * @path the classpath | ||||
| */ | */ | ||||
| public void setClasspath( Path path ) | |||||
| public void setClasspath( final Path path ) | |||||
| { | { | ||||
| createClasspath().append( path ); | |||||
| createClasspath().addPath( path ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -706,30 +707,34 @@ public class IContract extends MatchingTask | |||||
| classpathHelper.modify( baseClasspath ); | classpathHelper.modify( baseClasspath ); | ||||
| // Create the classpath required to compile the sourcefiles BEFORE instrumentation | // Create the classpath required to compile the sourcefiles BEFORE instrumentation | ||||
| Path beforeInstrumentationClasspath = ( (Path)baseClasspath.clone() ); | |||||
| beforeInstrumentationClasspath.append( new Path( srcDir.getAbsolutePath() ) ); | |||||
| Path beforeInstrumentationClasspath = new Path(); | |||||
| beforeInstrumentationClasspath.addPath( baseClasspath ); | |||||
| beforeInstrumentationClasspath.addLocation( srcDir ); | |||||
| // Create the classpath required to compile the sourcefiles AFTER instrumentation | // Create the classpath required to compile the sourcefiles AFTER instrumentation | ||||
| Path afterInstrumentationClasspath = ( (Path)baseClasspath.clone() ); | |||||
| afterInstrumentationClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); | |||||
| afterInstrumentationClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); | |||||
| afterInstrumentationClasspath.append( new Path( srcDir.getAbsolutePath() ) ); | |||||
| afterInstrumentationClasspath.append( new Path( buildDir.getAbsolutePath() ) ); | |||||
| Path afterInstrumentationClasspath = new Path(); | |||||
| afterInstrumentationClasspath.addPath( baseClasspath ); | |||||
| afterInstrumentationClasspath.addLocation( instrumentDir ); | |||||
| afterInstrumentationClasspath.addLocation( repositoryDir ); | |||||
| afterInstrumentationClasspath.addLocation( srcDir ); | |||||
| afterInstrumentationClasspath.addLocation( buildDir ); | |||||
| // Create the classpath required to automatically compile the repository files | // Create the classpath required to automatically compile the repository files | ||||
| Path repositoryClasspath = ( (Path)baseClasspath.clone() ); | |||||
| repositoryClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); | |||||
| repositoryClasspath.append( new Path( srcDir.getAbsolutePath() ) ); | |||||
| repositoryClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); | |||||
| repositoryClasspath.append( new Path( buildDir.getAbsolutePath() ) ); | |||||
| Path repositoryClasspath = new Path(); | |||||
| repositoryClasspath.addPath( baseClasspath ); | |||||
| repositoryClasspath.addLocation( instrumentDir ); | |||||
| repositoryClasspath.addLocation( srcDir ); | |||||
| repositoryClasspath.addLocation( repositoryDir ); | |||||
| repositoryClasspath.addLocation( buildDir ); | |||||
| // Create the classpath required for iContract itself | // Create the classpath required for iContract itself | ||||
| Path iContractClasspath = ( (Path)baseClasspath.clone() ); | |||||
| iContractClasspath.append( new Path( System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); | |||||
| iContractClasspath.append( new Path( srcDir.getAbsolutePath() ) ); | |||||
| iContractClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); | |||||
| iContractClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); | |||||
| iContractClasspath.append( new Path( buildDir.getAbsolutePath() ) ); | |||||
| Path iContractClasspath = new Path(); | |||||
| iContractClasspath.addPath( baseClasspath ); | |||||
| iContractClasspath.addLocation( new File(System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); | |||||
| iContractClasspath.addLocation( srcDir ); | |||||
| iContractClasspath.addLocation( repositoryDir ); | |||||
| iContractClasspath.addLocation( instrumentDir ); | |||||
| iContractClasspath.addLocation( buildDir ); | |||||
| // Create a forked java process | // Create a forked java process | ||||
| Java iContract = null;//(Java)getProject().createTask( "java" ); | Java iContract = null;//(Java)getProject().createTask( "java" ); | ||||
| @@ -768,7 +773,7 @@ public class IContract extends MatchingTask | |||||
| } | } | ||||
| iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() ); | iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() ); | ||||
| iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() ); | iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() ); | ||||
| iControlProps.setProperty( "classpath", afterInstrumentationClasspath.toString() ); | |||||
| iControlProps.setProperty( "classpath", PathUtil.formatPath( afterInstrumentationClasspath ) ); | |||||
| iControlProps.setProperty( "controlFile", controlFile.getAbsolutePath() ); | iControlProps.setProperty( "controlFile", controlFile.getAbsolutePath() ); | ||||
| iControlProps.setProperty( "targetsFile", targets.getAbsolutePath() ); | iControlProps.setProperty( "targetsFile", targets.getAbsolutePath() ); | ||||
| @@ -1027,7 +1032,7 @@ public class IContract extends MatchingTask | |||||
| { | { | ||||
| icCompiler = compiler; | icCompiler = compiler; | ||||
| m_includeJavaRuntime = true; | m_includeJavaRuntime = true; | ||||
| path.append( getCompileClasspath() ); | |||||
| addCompileClasspath( path ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.util.FileUtils; | import org.apache.tools.todo.util.FileUtils; | ||||
| import org.apache.tools.todo.taskdefs.ClassArgument; | import org.apache.tools.todo.taskdefs.ClassArgument; | ||||
| @@ -270,7 +271,7 @@ public class Javah | |||||
| if( m_classpath != null ) | if( m_classpath != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_classpath ) ); | |||||
| } | } | ||||
| if( m_verbose ) | if( m_verbose ) | ||||
| @@ -298,7 +299,7 @@ public class Javah | |||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-bootclasspath" ); | cmd.addArgument( "-bootclasspath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) ); | |||||
| } | } | ||||
| logAndAddFilesToCompile( cmd ); | logAndAddFilesToCompile( cmd ); | ||||
| @@ -19,8 +19,6 @@ import org.apache.myrmidon.framework.Execute; | |||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | import org.apache.tools.todo.types.PathUtil; | ||||
| import org.apache.tools.todo.util.FileUtils; | |||||
| import org.apache.tools.todo.taskdefs.javac.CompilerAdapter; | |||||
| /** | /** | ||||
| * This is the default implementation for the CompilerAdapter interface. | * This is the default implementation for the CompilerAdapter interface. | ||||
| @@ -132,7 +130,8 @@ public abstract class DefaultCompilerAdapter | |||||
| boolean useDebugLevel ) | boolean useDebugLevel ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Path classpath = getCompileClasspath(); | |||||
| Path classpath = new Path(); | |||||
| addCompileClasspath( classpath ); | |||||
| String memoryParameterPrefix = "-J-X"; | String memoryParameterPrefix = "-J-X"; | ||||
| if( m_memoryInitialSize != null ) | if( m_memoryInitialSize != null ) | ||||
| { | { | ||||
| @@ -177,10 +176,10 @@ public abstract class DefaultCompilerAdapter | |||||
| } | } | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| cmd.addArgument( "-sourcepath" ); | cmd.addArgument( "-sourcepath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( src ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( src ) ); | |||||
| if( target != null ) | if( target != null ) | ||||
| { | { | ||||
| @@ -191,13 +190,13 @@ public abstract class DefaultCompilerAdapter | |||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-bootclasspath" ); | cmd.addArgument( "-bootclasspath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) ); | |||||
| } | } | ||||
| if( m_extdirs != null ) | if( m_extdirs != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-extdirs" ); | cmd.addArgument( "-extdirs" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_extdirs ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_extdirs ) ); | |||||
| } | } | ||||
| if( m_encoding != null ) | if( m_encoding != null ) | ||||
| @@ -279,15 +278,11 @@ public abstract class DefaultCompilerAdapter | |||||
| } | } | ||||
| /** | /** | ||||
| * Builds the compilation classpath. | |||||
| * | |||||
| * @return The CompileClasspath value | |||||
| * Adds the compilation classpath to a path. | |||||
| */ | */ | ||||
| protected Path getCompileClasspath() | |||||
| protected void addCompileClasspath( final Path classpath ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| Path classpath = new Path(); | |||||
| // add dest dir to classpath so that previously compiled and | // add dest dir to classpath so that previously compiled and | ||||
| // untouched classes are on classpath | // untouched classes are on classpath | ||||
| @@ -299,10 +294,8 @@ public abstract class DefaultCompilerAdapter | |||||
| // add the classpath | // add the classpath | ||||
| if( m_compileClasspath != null ) | if( m_compileClasspath != null ) | ||||
| { | { | ||||
| classpath.addExisting( m_compileClasspath ); | |||||
| classpath.addPath( m_compileClasspath ); | |||||
| } | } | ||||
| return classpath; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -11,6 +11,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.util.FileUtils; | import org.apache.tools.todo.util.FileUtils; | ||||
| import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | ||||
| @@ -53,23 +54,23 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| classpath.append( m_bootclasspath ); | |||||
| classpath.addPath( m_bootclasspath ); | |||||
| } | } | ||||
| // gcj doesn't support an extension dir (-extdir) | // gcj doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| addExtdirs( classpath ); | addExtdirs( classpath ); | ||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| m_includeJavaRuntime = true; | m_includeJavaRuntime = true; | ||||
| } | } | ||||
| classpath.append( getCompileClasspath() ); | |||||
| addCompileClasspath( classpath ); | |||||
| // Gcj has no option for source-path so we | // Gcj has no option for source-path so we | ||||
| // will add it to classpath. | // will add it to classpath. | ||||
| classpath.append( src ); | |||||
| classpath.addPath( src ); | |||||
| cmd.setExecutable( "gcj" ); | cmd.setExecutable( "gcj" ); | ||||
| @@ -86,7 +87,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
| } | } | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| if( m_encoding != null ) | if( m_encoding != null ) | ||||
| { | { | ||||
| @@ -11,6 +11,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.util.FileUtils; | import org.apache.tools.todo.util.FileUtils; | ||||
| import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | ||||
| @@ -50,14 +51,14 @@ public class Jikes | |||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| classpath.append( m_bootclasspath ); | |||||
| classpath.addPath( m_bootclasspath ); | |||||
| } | } | ||||
| // Jikes doesn't support an extension dir (-extdir) | // Jikes doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| addExtdirs( classpath ); | addExtdirs( classpath ); | ||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| m_includeJavaRuntime = true; | m_includeJavaRuntime = true; | ||||
| @@ -69,17 +70,17 @@ public class Jikes | |||||
| // bootclasspath and said to include the java runtime, it's on | // bootclasspath and said to include the java runtime, it's on | ||||
| // their head! | // their head! | ||||
| } | } | ||||
| classpath.append( getCompileClasspath() ); | |||||
| addCompileClasspath( classpath ); | |||||
| // Jikes has no option for source-path so we | // Jikes has no option for source-path so we | ||||
| // will add it to classpath. | // will add it to classpath. | ||||
| classpath.append( src ); | |||||
| classpath.addPath( src ); | |||||
| // if the user has set JIKESPATH we should add the contents as well | // if the user has set JIKESPATH we should add the contents as well | ||||
| String jikesPath = System.getProperty( "jikes.class.path" ); | String jikesPath = System.getProperty( "jikes.class.path" ); | ||||
| if( jikesPath != null ) | if( jikesPath != null ) | ||||
| { | { | ||||
| classpath.append( new Path( jikesPath ) ); | |||||
| classpath.addPath( jikesPath ); | |||||
| } | } | ||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| @@ -97,7 +98,7 @@ public class Jikes | |||||
| } | } | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| if( m_encoding != null ) | if( m_encoding != null ) | ||||
| { | { | ||||
| @@ -11,6 +11,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.util.FileUtils; | import org.apache.tools.todo.util.FileUtils; | ||||
| import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | ||||
| @@ -38,14 +39,14 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| classpath.append( m_bootclasspath ); | |||||
| classpath.addPath( m_bootclasspath ); | |||||
| } | } | ||||
| // jvc doesn't support an extension dir (-extdir) | // jvc doesn't support an extension dir (-extdir) | ||||
| // so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
| addExtdirs( classpath ); | addExtdirs( classpath ); | ||||
| if( ( m_bootclasspath == null ) || ( m_bootclasspath.size() == 0 ) ) | |||||
| if( ( m_bootclasspath == null ) || m_bootclasspath.isEmpty() ) | |||||
| { | { | ||||
| // no bootclasspath, therefore, get one from the java runtime | // no bootclasspath, therefore, get one from the java runtime | ||||
| m_includeJavaRuntime = true; | m_includeJavaRuntime = true; | ||||
| @@ -57,11 +58,11 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| // bootclasspath and said to include the java runtime, it's on | // bootclasspath and said to include the java runtime, it's on | ||||
| // their head! | // their head! | ||||
| } | } | ||||
| classpath.append( getCompileClasspath() ); | |||||
| addCompileClasspath( classpath ); | |||||
| // jvc has no option for source-path so we | // jvc has no option for source-path so we | ||||
| // will add it to classpath. | // will add it to classpath. | ||||
| classpath.append( src ); | |||||
| classpath.addPath( src ); | |||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| cmd.setExecutable( "jvc" ); | cmd.setExecutable( "jvc" ); | ||||
| @@ -74,7 +75,7 @@ public class Jvc extends DefaultCompilerAdapter | |||||
| // Add the Classpath before the "internal" one. | // Add the Classpath before the "internal" one. | ||||
| cmd.addArgument( "/cp:p" ); | cmd.addArgument( "/cp:p" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| // Enable MS-Extensions and ... | // Enable MS-Extensions and ... | ||||
| cmd.addArgument( "/x-" ); | cmd.addArgument( "/x-" ); | ||||
| @@ -9,11 +9,9 @@ package org.apache.tools.todo.taskdefs.javac; | |||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.util.FileUtils; | |||||
| import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter; | |||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * The implementation of the Java compiler for KJC. This is primarily a | * The implementation of the Java compiler for KJC. This is primarily a | ||||
| @@ -71,7 +69,8 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| // generate classpath, because kjc does't support sourcepath. | // generate classpath, because kjc does't support sourcepath. | ||||
| Path classpath = getCompileClasspath(); | |||||
| Path classpath = new Path(); | |||||
| addCompileClasspath( classpath ); | |||||
| if( m_deprecation == true ) | if( m_deprecation == true ) | ||||
| { | { | ||||
| @@ -92,7 +91,7 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| // kjc don't have bootclasspath option. | // kjc don't have bootclasspath option. | ||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| cp.append( m_bootclasspath ); | |||||
| cp.addPath( m_bootclasspath ); | |||||
| } | } | ||||
| if( m_extdirs != null ) | if( m_extdirs != null ) | ||||
| @@ -100,10 +99,10 @@ public class Kjc extends DefaultCompilerAdapter | |||||
| addExtdirs( cp ); | addExtdirs( cp ); | ||||
| } | } | ||||
| cp.append( classpath ); | |||||
| cp.append( src ); | |||||
| cp.addPath( classpath ); | |||||
| cp.addPath( src ); | |||||
| cmd.addArguments( FileUtils.translateCommandline( cp ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( cp ) ); | |||||
| // kjc-1.5A doesn't support -encoding option now. | // kjc-1.5A doesn't support -encoding option now. | ||||
| // but it will be supported near the feature. | // but it will be supported near the feature. | ||||
| @@ -32,7 +32,7 @@ public class DocletInfo | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_path.append( path ); | |||||
| m_path.addPath( path ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -15,25 +15,18 @@ import java.io.PrintWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.myrmidon.framework.Pattern; | import org.apache.myrmidon.framework.Pattern; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.DirectoryScanner; | import org.apache.tools.todo.types.DirectoryScanner; | ||||
| import org.apache.tools.todo.types.FileSet; | import org.apache.tools.todo.types.FileSet; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.types.ScannerUtil; | import org.apache.tools.todo.types.ScannerUtil; | ||||
| import org.apache.tools.todo.util.FileUtils; | |||||
| import org.apache.tools.todo.taskdefs.javadoc.AccessType; | |||||
| import org.apache.tools.todo.taskdefs.javadoc.DocletInfo; | |||||
| import org.apache.tools.todo.taskdefs.javadoc.DocletParam; | |||||
| import org.apache.tools.todo.taskdefs.javadoc.GroupArgument; | |||||
| import org.apache.tools.todo.taskdefs.javadoc.Html; | |||||
| /** | /** | ||||
| * This task makes it easy to generate Javadoc documentation for a collection of | * This task makes it easy to generate Javadoc documentation for a collection of | ||||
| @@ -85,7 +78,6 @@ public class Javadoc | |||||
| private Path m_classpath; | private Path m_classpath; | ||||
| private Path m_bootclasspath; | private Path m_bootclasspath; | ||||
| private String m_group; | private String m_group; | ||||
| private ArrayList m_compileList = new ArrayList( 10 ); | |||||
| private String m_packageList; | private String m_packageList; | ||||
| private ArrayList m_links = new ArrayList( 2 ); | private ArrayList m_links = new ArrayList( 2 ); | ||||
| private ArrayList m_groups = new ArrayList( 2 ); | private ArrayList m_groups = new ArrayList( 2 ); | ||||
| @@ -122,7 +114,7 @@ public class Javadoc | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_bootclasspath.append( src ); | |||||
| m_bootclasspath.addPath( src ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -147,7 +139,7 @@ public class Javadoc | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_classpath.append( src ); | |||||
| m_classpath.addPath( src ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -392,7 +384,7 @@ public class Javadoc | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_sourcePath.append( src ); | |||||
| m_sourcePath.addPath( src ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -578,7 +570,7 @@ public class Javadoc | |||||
| classpath.addPath( m_classpath ); | classpath.addPath( m_classpath ); | ||||
| } | } | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArgument( classpath.toString() ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| if( m_version && m_doclet == null ) | if( m_version && m_doclet == null ) | ||||
| { | { | ||||
| @@ -615,7 +607,7 @@ public class Javadoc | |||||
| if( m_doclet.getPath() != null ) | if( m_doclet.getPath() != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-docletpath" ); | cmd.addArgument( "-docletpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_doclet.getPath() ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_doclet.getPath() ) ); | |||||
| } | } | ||||
| for( Iterator e = m_doclet.getParams(); e.hasNext(); ) | for( Iterator e = m_doclet.getParams(); e.hasNext(); ) | ||||
| { | { | ||||
| @@ -636,7 +628,7 @@ public class Javadoc | |||||
| if( m_bootclasspath != null ) | if( m_bootclasspath != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-bootclasspath" ); | cmd.addArgument( "-bootclasspath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( m_bootclasspath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( m_bootclasspath ) ); | |||||
| } | } | ||||
| // add the links arguments | // add the links arguments | ||||
| @@ -896,7 +888,7 @@ public class Javadoc | |||||
| ArrayList packages, ArrayList excludePackages ) | ArrayList packages, ArrayList excludePackages ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| getContext().debug( "Source path = " + sourcePath.toString() ); | |||||
| getContext().debug( "Source path = " + PathUtil.formatPath( sourcePath ) ); | |||||
| StringBuffer msg = new StringBuffer( "Packages = " ); | StringBuffer msg = new StringBuffer( "Packages = " ); | ||||
| for( int i = 0; i < packages.size(); i++ ) | for( int i = 0; i < packages.size(); i++ ) | ||||
| { | { | ||||
| @@ -17,6 +17,7 @@ import org.apache.myrmidon.framework.Execute; | |||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.CommandlineJava; | import org.apache.tools.todo.types.CommandlineJava; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| import org.apache.tools.todo.util.FileUtils; | import org.apache.tools.todo.util.FileUtils; | ||||
| /** | /** | ||||
| @@ -54,7 +55,7 @@ public class JDependTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| m_compileClasspath.append( classpath ); | |||||
| m_compileClasspath.addPath( classpath ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -192,10 +193,11 @@ public class JDependTask | |||||
| // not sure whether this test is needed but cost nothing to put. | // not sure whether this test is needed but cost nothing to put. | ||||
| // hope it will be reviewed by anybody competent | // hope it will be reviewed by anybody competent | ||||
| if( m_compileClasspath.toString().length() > 0 ) | |||||
| final String compileClasspath = PathUtil.formatPath( m_compileClasspath ); | |||||
| if( compileClasspath.length() > 0 ) | |||||
| { | { | ||||
| commandline.addVmArgument( "-classpath" ); | commandline.addVmArgument( "-classpath" ); | ||||
| commandline.addVmArgument( m_compileClasspath.toString() ); | |||||
| commandline.addVmArgument( compileClasspath ); | |||||
| } | } | ||||
| if( m_outputFile != null ) | if( m_outputFile != null ) | ||||
| @@ -207,7 +209,7 @@ public class JDependTask | |||||
| // we have to find a cleaner way to put this output | // we have to find a cleaner way to put this output | ||||
| } | } | ||||
| final String[] elements = FileUtils.parsePath( m_sourcesPath.toString() ); | |||||
| final String[] elements = m_sourcesPath.list(); | |||||
| for( int i = 0; i < elements.length; i++ ) | for( int i = 0; i < elements.length; i++ ) | ||||
| { | { | ||||
| File f = new File( elements[ i ] ); | File f = new File( elements[ i ] ); | ||||
| @@ -276,7 +278,7 @@ public class JDependTask | |||||
| getContext().info( "Output to be stored in " + m_outputFile.getPath() ); | getContext().info( "Output to be stored in " + m_outputFile.getPath() ); | ||||
| } | } | ||||
| final String[] elements = FileUtils.parsePath( m_sourcesPath.toString() ); | |||||
| final String[] elements = m_sourcesPath.list(); | |||||
| for( int i = 0; i < elements.length; i++ ) | for( int i = 0; i < elements.length; i++ ) | ||||
| { | { | ||||
| File f = new File( elements[ i ] ); | File f = new File( elements[ i ] ); | ||||
| @@ -109,7 +109,7 @@ public class JspC extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| classpath.append( cp ); | |||||
| classpath.addPath( cp ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -187,7 +187,7 @@ public class JspC extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| src.append( srcDir ); | |||||
| src.addPath( srcDir ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import org.apache.tools.todo.taskdefs.MatchingTask; | |||||
| import org.apache.tools.todo.types.Argument; | import org.apache.tools.todo.types.Argument; | ||||
| import org.apache.tools.todo.types.DirectoryScanner; | import org.apache.tools.todo.types.DirectoryScanner; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | ||||
| @@ -82,7 +83,7 @@ public class WLJspc extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| compileClasspath.append( classpath ); | |||||
| compileClasspath.addPath( classpath ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -194,7 +195,7 @@ public class WLJspc extends MatchingTask | |||||
| // Does not take the classpath from the env.... | // Does not take the classpath from the env.... | ||||
| // Am i missing something about the Java task?? | // Am i missing something about the Java task?? | ||||
| args[ j++ ] = "-classpath"; | args[ j++ ] = "-classpath"; | ||||
| args[ j++ ] = compileClasspath.toString(); | |||||
| args[ j++ ] = PathUtil.formatPath( compileClasspath ); | |||||
| this.scanDir( files ); | this.scanDir( files ); | ||||
| getContext().info( "Compiling " + filesToDo.size() + " JSP files" ); | getContext().info( "Compiling " + filesToDo.size() + " JSP files" ); | ||||
| @@ -15,10 +15,8 @@ import java.util.ArrayList; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.todo.types.Argument; | import org.apache.tools.todo.types.Argument; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| @@ -43,7 +41,7 @@ public abstract class AbstractMetamataTask | |||||
| * command line. The classpath must includes both the <tt>.class</tt> and | * command line. The classpath must includes both the <tt>.class</tt> and | ||||
| * the <tt>.java</tt> files for accurate audit. | * the <tt>.java</tt> files for accurate audit. | ||||
| */ | */ | ||||
| private Path m_classPath; | |||||
| private Path m_classPath = new Path(); | |||||
| /** | /** | ||||
| * the path to the source file | * the path to the source file | ||||
| @@ -142,13 +140,9 @@ public abstract class AbstractMetamataTask | |||||
| /** | /** | ||||
| * user classpath | * user classpath | ||||
| */ | */ | ||||
| public Path createClasspath() | |||||
| public void addClasspath( final Path path ) | |||||
| { | { | ||||
| if( m_classPath == null ) | |||||
| { | |||||
| m_classPath = new Path(); | |||||
| } | |||||
| return m_classPath; | |||||
| m_classPath.addPath( path ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -364,11 +358,6 @@ public abstract class AbstractMetamataTask | |||||
| return m_classPath; | return m_classPath; | ||||
| } | } | ||||
| protected void setClassPath( Path classPath ) | |||||
| { | |||||
| m_classPath = classPath; | |||||
| } | |||||
| protected Path getSourcePath() | protected Path getSourcePath() | ||||
| { | { | ||||
| return m_sourcePath; | return m_sourcePath; | ||||
| @@ -10,9 +10,8 @@ package org.apache.tools.todo.taskdefs.metamata; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | |||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Metamata Audit evaluates Java code for programming errors, weaknesses, and | * Metamata Audit evaluates Java code for programming errors, weaknesses, and | ||||
| @@ -119,22 +118,29 @@ public class MAudit | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| ArrayList options = new ArrayList( 512 ); | ArrayList options = new ArrayList( 512 ); | ||||
| final Path classpath = new Path(); | |||||
| // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | ||||
| // not work. So we will use the sourcepath prepended to classpath. (order | // not work. So we will use the sourcepath prepended to classpath. (order | ||||
| // is important since Metamata looks at .class and .java) | // is important since Metamata looks at .class and .java) | ||||
| if( getSourcePath() != null ) | |||||
| final Path sourcePath = getSourcePath(); | |||||
| if( sourcePath != null ) | |||||
| { | { | ||||
| getSourcePath().append( getClassPath() );// srcpath is prepended | |||||
| setClassPath( getSourcePath() ); | |||||
| classpath.addPath( sourcePath ); | |||||
| setSourcePath( null );// prevent from using -sourcepath | setSourcePath( null );// prevent from using -sourcepath | ||||
| } | } | ||||
| // don't forget to modify the pattern if you change the options reporting | // don't forget to modify the pattern if you change the options reporting | ||||
| if( getClassPath() != null ) | |||||
| classpath.addPath( getClassPath() ); | |||||
| final String formattedClasspath = PathUtil.formatPath( classpath ); | |||||
| if( formattedClasspath.length() > 0 ) | |||||
| { | { | ||||
| options.add( "-classpath" ); | options.add( "-classpath" ); | ||||
| options.add( getClassPath().toString() ); | |||||
| options.add( formattedClasspath ); | |||||
| } | } | ||||
| // suppress copyright msg when running, we will let it so that this | // suppress copyright msg when running, we will let it so that this | ||||
| // will be the only output to the console if in xml mode | // will be the only output to the console if in xml mode | ||||
| // options.add("-quiet"); | // options.add("-quiet"); | ||||
| @@ -154,13 +160,13 @@ public class MAudit | |||||
| if( getSourcePath() != null ) | if( getSourcePath() != null ) | ||||
| { | { | ||||
| options.add( "-sourcepath" ); | options.add( "-sourcepath" ); | ||||
| options.add( getSourcePath().toString() ); | |||||
| options.add( PathUtil.formatPath( getSourcePath() ) ); | |||||
| } | } | ||||
| if( m_unused ) | if( m_unused ) | ||||
| { | { | ||||
| options.add( "-unused" ); | options.add( "-unused" ); | ||||
| options.add( m_searchPath.toString() ); | |||||
| options.add( PathUtil.formatPath( m_searchPath ) ); | |||||
| } | } | ||||
| addAllArrayList( options, getIncludedFiles().keySet().iterator() ); | addAllArrayList( options, getIncludedFiles().keySet().iterator() ); | ||||
| return options; | return options; | ||||
| @@ -15,6 +15,7 @@ import java.util.ArrayList; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.todo.taskdefs.exec.ExecuteStreamHandler; | import org.apache.tools.todo.taskdefs.exec.ExecuteStreamHandler; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Calculates global complexity and quality metrics on Java source code. You | * Calculates global complexity and quality metrics on Java source code. You | ||||
| @@ -120,22 +121,28 @@ public class MMetrics extends AbstractMetamataTask | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| ArrayList options = new ArrayList( 512 ); | ArrayList options = new ArrayList( 512 ); | ||||
| final Path classpath = new Path(); | |||||
| // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | ||||
| // not work. So we will use the sourcepath prepended to classpath. (order | // not work. So we will use the sourcepath prepended to classpath. (order | ||||
| // is important since Metamata looks at .class and .java) | // is important since Metamata looks at .class and .java) | ||||
| if( getSourcePath() != null ) | if( getSourcePath() != null ) | ||||
| { | { | ||||
| getSourcePath().append( getClassPath() );// srcpath is prepended | |||||
| setClassPath( getSourcePath() ); | |||||
| classpath.addPath( getSourcePath() ); | |||||
| setSourcePath( null );// prevent from using -sourcepath | setSourcePath( null );// prevent from using -sourcepath | ||||
| } | } | ||||
| // don't forget to modify the pattern if you change the options reporting | // don't forget to modify the pattern if you change the options reporting | ||||
| if( getClassPath() != null ) | |||||
| classpath.addPath( getClassPath() ); | |||||
| final String formattedClasspath = PathUtil.formatPath( classpath ); | |||||
| if( formattedClasspath.length() > 0 ) | |||||
| { | { | ||||
| options.add( "-classpath" ); | options.add( "-classpath" ); | ||||
| options.add( getClassPath() ); | |||||
| options.add( formattedClasspath ); | |||||
| } | } | ||||
| options.add( "-output" ); | options.add( "-output" ); | ||||
| options.add( tmpFile.toString() ); | options.add( tmpFile.toString() ); | ||||
| @@ -13,16 +13,15 @@ import java.io.IOException; | |||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Random; | import java.util.Random; | ||||
| import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.todo.types.Argument; | import org.apache.tools.todo.types.Argument; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.CommandlineJava; | import org.apache.tools.todo.types.CommandlineJava; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Simple Metamata MParse task based on the original written by <a | * Simple Metamata MParse task based on the original written by <a | ||||
| @@ -240,7 +239,7 @@ public class MParse | |||||
| * | * | ||||
| * @return The Options value | * @return The Options value | ||||
| */ | */ | ||||
| protected String[] getOptions() | |||||
| protected String[] getOptions() throws TaskException | |||||
| { | { | ||||
| ArrayList options = new ArrayList(); | ArrayList options = new ArrayList(); | ||||
| if( m_verbose ) | if( m_verbose ) | ||||
| @@ -258,12 +257,12 @@ public class MParse | |||||
| if( m_classpath != null ) | if( m_classpath != null ) | ||||
| { | { | ||||
| options.add( "-classpath" ); | options.add( "-classpath" ); | ||||
| options.add( m_classpath.toString() ); | |||||
| options.add( PathUtil.formatPath( m_classpath ) ); | |||||
| } | } | ||||
| if( m_sourcepath != null ) | if( m_sourcepath != null ) | ||||
| { | { | ||||
| options.add( "-sourcepath" ); | options.add( "-sourcepath" ); | ||||
| options.add( m_sourcepath.toString() ); | |||||
| options.add( PathUtil.formatPath( m_sourcepath ) ); | |||||
| } | } | ||||
| options.add( m_target.getAbsolutePath() ); | options.add( m_target.getAbsolutePath() ); | ||||
| @@ -15,7 +15,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.myrmidon.framework.FileNameMapper; | import org.apache.myrmidon.framework.FileNameMapper; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.util.FileUtils; | |||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * This is the default implementation for the RmicAdapter interface. Currently, | * This is the default implementation for the RmicAdapter interface. Currently, | ||||
| @@ -120,11 +120,11 @@ public abstract class DefaultRmicAdapter | |||||
| if( attributes.getExtdirs() != null ) | if( attributes.getExtdirs() != null ) | ||||
| { | { | ||||
| cmd.addArgument( "-extdirs" ); | cmd.addArgument( "-extdirs" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( attributes.getExtdirs() ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( attributes.getExtdirs() ) ); | |||||
| } | } | ||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArguments( FileUtils.translateCommandline( classpath ) ); | |||||
| cmd.addArgument( PathUtil.formatPath( classpath ) ); | |||||
| String stubVersion = attributes.getStubVersion(); | String stubVersion = attributes.getStubVersion(); | ||||
| if( null != stubVersion ) | if( null != stubVersion ) | ||||
| @@ -195,7 +195,7 @@ public abstract class DefaultRmicAdapter | |||||
| // add the classpath | // add the classpath | ||||
| if( attributes.getClasspath() != null ) | if( attributes.getClasspath() != null ) | ||||
| { | { | ||||
| classpath.addExisting( attributes.getClasspath() ); | |||||
| classpath.addPath( attributes.getClasspath() ); | |||||
| } | } | ||||
| return classpath; | return classpath; | ||||
| @@ -13,16 +13,15 @@ import java.io.IOException; | |||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import java.io.StringWriter; | import java.io.StringWriter; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.aut.nativelib.ExecManager; | |||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
| import org.apache.tools.todo.types.Argument; | import org.apache.tools.todo.types.Argument; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.CommandlineJava; | import org.apache.tools.todo.types.CommandlineJava; | ||||
| import org.apache.tools.todo.types.FileSet; | import org.apache.tools.todo.types.FileSet; | ||||
| import org.apache.tools.todo.types.Path; | import org.apache.tools.todo.types.Path; | ||||
| import org.apache.tools.todo.types.PathUtil; | |||||
| /** | /** | ||||
| * Convenient task to run Sitraka JProbe Coverage from Ant. Options are pretty | * Convenient task to run Sitraka JProbe Coverage from Ant. Options are pretty | ||||
| @@ -313,9 +312,9 @@ public class Coverage | |||||
| } | } | ||||
| // classpath | // classpath | ||||
| Path classpath = cmdlJava.getClasspath(); | Path classpath = cmdlJava.getClasspath(); | ||||
| if( classpath != null && classpath.size() > 0 ) | |||||
| if( classpath != null && ! classpath.isEmpty() ) | |||||
| { | { | ||||
| params.add( "-classpath " + classpath.toString() ); | |||||
| params.add( "-classpath " + PathUtil.formatPath( classpath ) ); | |||||
| } | } | ||||
| // classname (runner or standalone) | // classname (runner or standalone) | ||||
| if( cmdlJava.getClassname() != null ) | if( cmdlJava.getClassname() != null ) | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.todo.taskdefs.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | |||||
| /** | /** | ||||
| * Task to perform CheckIn commands to Microsoft Visual Source Safe. | * Task to perform CheckIn commands to Microsoft Visual Source Safe. | ||||
| @@ -20,7 +19,7 @@ import org.apache.tools.todo.types.Path; | |||||
| public class MSVSSCHECKIN | public class MSVSSCHECKIN | ||||
| extends MSVSS | extends MSVSS | ||||
| { | { | ||||
| private String m_localPath; | |||||
| private File m_localPath; | |||||
| private boolean m_recursive; | private boolean m_recursive; | ||||
| private boolean m_writable; | private boolean m_writable; | ||||
| private String m_autoResponse; | private String m_autoResponse; | ||||
| @@ -67,9 +66,9 @@ public class MSVSSCHECKIN | |||||
| /** | /** | ||||
| * Set the local path. | * Set the local path. | ||||
| */ | */ | ||||
| public void setLocalpath( final Path localPath ) | |||||
| public void setLocalpath( final File localPath ) | |||||
| { | { | ||||
| m_localPath = localPath.toString(); | |||||
| m_localPath = localPath; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -117,27 +116,22 @@ public class MSVSSCHECKIN | |||||
| { | { | ||||
| return; | return; | ||||
| } | } | ||||
| else | |||||
| // make sure m_LocalDir exists, create it if it doesn't | |||||
| if( !m_localPath.exists() ) | |||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | |||||
| final File dir = getContext().resolveFile( m_localPath ); | |||||
| if( !dir.exists() ) | |||||
| if( !m_localPath.mkdirs() ) | |||||
| { | { | ||||
| final boolean done = dir.mkdirs(); | |||||
| if( !done ) | |||||
| { | |||||
| final String message = | |||||
| "Directory " + m_localPath + " creation was not " + | |||||
| "succesful for an unknown reason"; | |||||
| throw new TaskException( message ); | |||||
| } | |||||
| final String message = "Created dir: " + dir.getAbsolutePath(); | |||||
| getContext().info( message ); | |||||
| final String message = | |||||
| "Directory " + m_localPath + " creation was not " + | |||||
| "succesful for an unknown reason"; | |||||
| throw new TaskException( message ); | |||||
| } | } | ||||
| cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath ); | |||||
| final String message = "Created dir: " + m_localPath.getAbsolutePath(); | |||||
| getContext().info( message ); | |||||
| } | } | ||||
| cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath ); | |||||
| } | } | ||||
| private void getRecursiveCommand( final Commandline cmd ) | private void getRecursiveCommand( final Commandline cmd ) | ||||
| @@ -10,7 +10,6 @@ package org.apache.tools.todo.taskdefs.vss; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
| import org.apache.tools.todo.types.Path; | |||||
| /** | /** | ||||
| * Task to perform CheckOut commands to Microsoft Visual Source Safe. | * Task to perform CheckOut commands to Microsoft Visual Source Safe. | ||||
| @@ -20,7 +19,7 @@ import org.apache.tools.todo.types.Path; | |||||
| public class MSVSSCHECKOUT | public class MSVSSCHECKOUT | ||||
| extends MSVSS | extends MSVSS | ||||
| { | { | ||||
| private String m_localPath; | |||||
| private File m_localPath; | |||||
| private boolean m_recursive; | private boolean m_recursive; | ||||
| private String m_version; | private String m_version; | ||||
| private String m_date; | private String m_date; | ||||
| @@ -82,9 +81,9 @@ public class MSVSSCHECKOUT | |||||
| /** | /** | ||||
| * Set the local path. | * Set the local path. | ||||
| */ | */ | ||||
| public void setLocalpath( final Path localPath ) | |||||
| public void setLocalpath( final File localPath ) | |||||
| { | { | ||||
| m_localPath = localPath.toString(); | |||||
| m_localPath = localPath; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -148,32 +147,24 @@ public class MSVSSCHECKOUT | |||||
| public void getLocalpathCommand( final Commandline cmd ) | public void getLocalpathCommand( final Commandline cmd ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | |||||
| if( m_localPath == null ) | if( m_localPath == null ) | ||||
| { | { | ||||
| return; | return; | ||||
| } | } | ||||
| else | |||||
| if( !m_localPath.exists() ) | |||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | |||||
| final File dir = getContext().resolveFile( m_localPath ); | |||||
| if( !dir.exists() ) | |||||
| if( !m_localPath.mkdirs() ) | |||||
| { | { | ||||
| if( !dir.mkdirs() ) | |||||
| { | |||||
| final String message = | |||||
| "Directory " + m_localPath + " creation was not " + | |||||
| "succesful for an unknown reason"; | |||||
| throw new TaskException( message ); | |||||
| } | |||||
| else | |||||
| { | |||||
| final String message = "Created dir: " + dir.getAbsolutePath(); | |||||
| getContext().info( message ); | |||||
| } | |||||
| final String message = | |||||
| "Directory " + m_localPath + " creation was not " + | |||||
| "succesful for an unknown reason"; | |||||
| throw new TaskException( message ); | |||||
| } | } | ||||
| cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath ); | |||||
| final String message = "Created dir: " + m_localPath.getAbsolutePath(); | |||||
| getContext().info( message ); | |||||
| } | } | ||||
| cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_localPath ); | |||||
| } | } | ||||
| private void getRecursiveCommand( final Commandline cmd ) | private void getRecursiveCommand( final Commandline cmd ) | ||||
| @@ -206,7 +206,7 @@ import org.apache.tools.todo.types.Path; | |||||
| public class MSVSSGET extends MSVSS | public class MSVSSGET extends MSVSS | ||||
| { | { | ||||
| private String m_LocalPath = null; | |||||
| private File m_LocalPath = null; | |||||
| private boolean m_Recursive = false; | private boolean m_Recursive = false; | ||||
| private boolean m_Writable = false; | private boolean m_Writable = false; | ||||
| private String m_Version = null; | private String m_Version = null; | ||||
| @@ -296,9 +296,9 @@ public class MSVSSGET extends MSVSS | |||||
| * | * | ||||
| * @param localPath The new Localpath value | * @param localPath The new Localpath value | ||||
| */ | */ | ||||
| public void setLocalpath( Path localPath ) | |||||
| public void setLocalpath( final File localPath ) | |||||
| { | { | ||||
| m_LocalPath = localPath.toString(); | |||||
| m_LocalPath = localPath; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -379,17 +379,16 @@ public class MSVSSGET extends MSVSS | |||||
| else | else | ||||
| { | { | ||||
| // make sure m_LocalDir exists, create it if it doesn't | // make sure m_LocalDir exists, create it if it doesn't | ||||
| File dir = getContext().resolveFile( m_LocalPath ); | |||||
| if( !dir.exists() ) | |||||
| if( !m_LocalPath.exists() ) | |||||
| { | { | ||||
| boolean done = dir.mkdirs(); | |||||
| boolean done = m_LocalPath.mkdirs(); | |||||
| if( done == false ) | if( done == false ) | ||||
| { | { | ||||
| String msg = "Directory " + m_LocalPath + " creation was not " + | String msg = "Directory " + m_LocalPath + " creation was not " + | ||||
| "successful for an unknown reason"; | "successful for an unknown reason"; | ||||
| throw new TaskException( msg ); | throw new TaskException( msg ); | ||||
| } | } | ||||
| getContext().info( "Created dir: " + dir.getAbsolutePath() ); | |||||
| getContext().info( "Created dir: " + m_LocalPath.getAbsolutePath() ); | |||||
| } | } | ||||
| cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | cmd.addArgument( FLAG_OVERRIDE_WORKING_DIR + m_LocalPath ); | ||||
| @@ -60,9 +60,9 @@ public class Argument | |||||
| * | * | ||||
| * @param value a single commandline argument. | * @param value a single commandline argument. | ||||
| */ | */ | ||||
| public void setPath( final Path value ) | |||||
| public void setPath( final Path value ) throws TaskException | |||||
| { | { | ||||
| m_parts = new String[]{value.toString()}; | |||||
| m_parts = new String[]{ PathUtil.formatPath( value ) }; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -134,10 +134,10 @@ public class CommandlineJava | |||||
| pos += m_sysProperties.size(); | pos += m_sysProperties.size(); | ||||
| } | } | ||||
| // classpath is a vm option too.. | // classpath is a vm option too.. | ||||
| if( m_classpath != null && m_classpath.toString().trim().length() > 0 ) | |||||
| if( m_classpath != null && ! m_classpath.isEmpty() ) | |||||
| { | { | ||||
| result[ pos++ ] = "-classpath"; | result[ pos++ ] = "-classpath"; | ||||
| result[ pos++ ] = m_classpath.toString(); | |||||
| result[ pos++ ] = PathUtil.formatPath( m_classpath ); | |||||
| } | } | ||||
| // this is the classname to run as well as its arguments. | // this is the classname to run as well as its arguments. | ||||
| // in case of 'executeJar', the executable is a jar file. | // in case of 'executeJar', the executable is a jar file. | ||||
| @@ -226,7 +226,7 @@ public class CommandlineJava | |||||
| { | { | ||||
| int size = getActualVMCommand().size() + m_javaCommand.size() + m_sysProperties.size(); | int size = getActualVMCommand().size() + m_javaCommand.size() + m_sysProperties.size(); | ||||
| // classpath is "-classpath <classpath>" -> 2 args | // classpath is "-classpath <classpath>" -> 2 args | ||||
| if( m_classpath != null && m_classpath.toString().trim().length() > 0 ) | |||||
| if( m_classpath != null && ! m_classpath.isEmpty() ) | |||||
| { | { | ||||
| size += 2; | size += 2; | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ | |||||
| package org.apache.tools.todo.types; | package org.apache.tools.todo.types; | ||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| public class EnvironmentVariable | public class EnvironmentVariable | ||||
| { | { | ||||
| @@ -24,9 +25,9 @@ public class EnvironmentVariable | |||||
| m_key = key; | m_key = key; | ||||
| } | } | ||||
| public void setPath( final Path path ) | |||||
| public void setPath( final Path path ) throws TaskException | |||||
| { | { | ||||
| m_value = path.toString(); | |||||
| m_value = PathUtil.formatPath( path ); | |||||
| } | } | ||||
| public void setValue( final String value ) | public void setValue( final String value ) | ||||
| @@ -49,18 +49,12 @@ import org.apache.tools.todo.types.FileSet; | |||||
| public class Path | public class Path | ||||
| implements DataType | implements DataType | ||||
| { | { | ||||
| private ArrayList m_elements = new ArrayList(); | |||||
| private final ArrayList m_elements = new ArrayList(); | |||||
| private File m_baseDirectory; | private File m_baseDirectory; | ||||
| /** | |||||
| * Invoked by IntrospectionHelper for <code>setXXX(Path p)</code> attribute | |||||
| * setters. | |||||
| */ | |||||
| public Path( final String path ) | public Path( final String path ) | ||||
| { | { | ||||
| final PathElement pathElement = new PathElement(); | |||||
| m_elements.add( pathElement ); | |||||
| pathElement.setPath( path ); | |||||
| addPath( path ); | |||||
| } | } | ||||
| public Path() | public Path() | ||||
| @@ -86,6 +80,14 @@ public class Path | |||||
| m_baseDirectory = baseDir; | m_baseDirectory = baseDir; | ||||
| } | } | ||||
| /** | |||||
| * Adds an element to the path. | |||||
| */ | |||||
| public void setLocation( final File location ) | |||||
| { | |||||
| addLocation( location ); | |||||
| } | |||||
| /** | /** | ||||
| * Adds a element definition to the path. | * Adds a element definition to the path. | ||||
| * | * | ||||
| @@ -100,53 +102,29 @@ public class Path | |||||
| } | } | ||||
| /** | /** | ||||
| * Adds the components on the given path which exist to this Path. | |||||
| * Components that don't exist, aren't added. | |||||
| * | |||||
| * @param source - source path whose components are examined for existence | |||||
| * Adds a nested <code><fileset></code> element. | |||||
| */ | */ | ||||
| public void addExisting( final Path source ) | |||||
| throws TaskException | |||||
| public void addFileset( final FileSet fileSet ) | |||||
| { | { | ||||
| final String[] list = source.list(); | |||||
| for( int i = 0; i < list.length; i++ ) | |||||
| { | |||||
| final File file = new File( list[ i ] ); | |||||
| if( file.exists() ) | |||||
| { | |||||
| addLocation( file ); | |||||
| } | |||||
| } | |||||
| m_elements.add( fileSet ); | |||||
| } | } | ||||
| /** | /** | ||||
| * Adds a nested <code><fileset></code> element. | |||||
| * Adds a path. | |||||
| */ | */ | ||||
| public void addFileset( final FileSet fileSet ) | |||||
| public void setPath( final String path ) | |||||
| { | { | ||||
| m_elements.add( fileSet ); | |||||
| addPath( path ); | |||||
| } | } | ||||
| /** | /** | ||||
| * Append the contents of the other Path instance to this. | |||||
| * Adds a path. | |||||
| */ | */ | ||||
| public void append( final Path other ) | |||||
| throws TaskException | |||||
| public void addPath( final String path ) | |||||
| { | { | ||||
| if( null == other ) | |||||
| { | |||||
| throw new NullPointerException( "other" ); | |||||
| } | |||||
| final String[] list = other.list(); | |||||
| for( int i = 0; i < list.length; i++ ) | |||||
| { | |||||
| final String file = list[ i ]; | |||||
| if( m_elements.contains( file ) ) | |||||
| { | |||||
| m_elements.add( file ); | |||||
| } | |||||
| } | |||||
| final PathElement pathElement = new PathElement(); | |||||
| m_elements.add( pathElement ); | |||||
| pathElement.setPath( path ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -213,45 +191,11 @@ public class Path | |||||
| } | } | ||||
| /** | /** | ||||
| * How many parts does this Path instance consist of. | |||||
| * Determines if this path is empty. | |||||
| */ | */ | ||||
| public int size() | |||||
| public boolean isEmpty() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| return list().length; | |||||
| } | |||||
| /** | |||||
| * Returns a textual representation of the path, which can be used as | |||||
| * CLASSPATH or PATH environment variable definition. | |||||
| * | |||||
| * @return a textual representation of the path. | |||||
| */ | |||||
| public String toString() | |||||
| { | |||||
| try | |||||
| { | |||||
| final String[] list = list(); | |||||
| // empty path return empty string | |||||
| if( list.length == 0 ) | |||||
| { | |||||
| return ""; | |||||
| } | |||||
| // path containing one or more elements | |||||
| final StringBuffer result = new StringBuffer( list[ 0 ].toString() ); | |||||
| for( int i = 1; i < list.length; i++ ) | |||||
| { | |||||
| result.append( File.pathSeparatorChar ); | |||||
| result.append( list[ i ] ); | |||||
| } | |||||
| return result.toString(); | |||||
| } | |||||
| catch( final TaskException te ) | |||||
| { | |||||
| throw new Error( te.toString() ); | |||||
| } | |||||
| return ( list().length == 0 ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -24,7 +24,7 @@ class PathElement | |||||
| m_location = location.getAbsolutePath(); | m_location = location.getAbsolutePath(); | ||||
| } | } | ||||
| public void setPath( String path ) | |||||
| public void setPath( final String path ) | |||||
| { | { | ||||
| m_path = path; | m_path = path; | ||||
| } | } | ||||
| @@ -23,6 +23,31 @@ import org.apache.tools.todo.types.Path; | |||||
| */ | */ | ||||
| public class PathUtil | public class PathUtil | ||||
| { | { | ||||
| /** | |||||
| * Formats a Path into its native representation. | |||||
| */ | |||||
| public static String formatPath( final Path path ) | |||||
| throws TaskException | |||||
| { | |||||
| final String[] list = path.list(); | |||||
| // empty path return empty string | |||||
| if( list.length == 0 ) | |||||
| { | |||||
| return ""; | |||||
| } | |||||
| // path containing one or more elements | |||||
| final StringBuffer result = new StringBuffer( list[ 0 ].toString() ); | |||||
| for( int i = 1; i < list.length; i++ ) | |||||
| { | |||||
| result.append( File.pathSeparatorChar ); | |||||
| result.append( list[ i ] ); | |||||
| } | |||||
| return result.toString(); | |||||
| } | |||||
| /** | /** | ||||
| * Returns an array of URLs - useful for building a ClassLoader. | * Returns an array of URLs - useful for building a ClassLoader. | ||||
| */ | */ | ||||
| @@ -45,11 +70,13 @@ public class PathUtil | |||||
| } | } | ||||
| catch( final IOException ioe ) | catch( final IOException ioe ) | ||||
| { | { | ||||
| final String message = "Malformed path entry. Reason:" + ioe; | |||||
| throw new TaskException( message, ioe ); | |||||
| throw new TaskException( "Malformed path entry.", ioe ); | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Adds the JVM's runtime to a path. | |||||
| */ | |||||
| public static void addJavaRuntime( final Path path ) | public static void addJavaRuntime( final Path path ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| @@ -76,26 +103,29 @@ public class PathUtil | |||||
| // JDK > 1.1 seems to set java.home to the JRE directory. | // JDK > 1.1 seems to set java.home to the JRE directory. | ||||
| final String rt = System.getProperty( "java.home" ) + | final String rt = System.getProperty( "java.home" ) + | ||||
| File.separator + "lib" + File.separator + "rt.jar"; | File.separator + "lib" + File.separator + "rt.jar"; | ||||
| path.addExisting( new Path( rt ) ); | |||||
| path.addLocation( new File( rt ) ); | |||||
| // Just keep the old version as well and let addExisting | // Just keep the old version as well and let addExisting | ||||
| // sort it out. | // sort it out. | ||||
| final String rt2 = System.getProperty( "java.home" ) + | final String rt2 = System.getProperty( "java.home" ) + | ||||
| File.separator + "jre" + File.separator + "lib" + | File.separator + "jre" + File.separator + "lib" + | ||||
| File.separator + "rt.jar"; | File.separator + "rt.jar"; | ||||
| path.addExisting( new Path( rt2 ) ); | |||||
| path.addLocation( new File( rt2 ) ); | |||||
| // Added for MacOS X | // Added for MacOS X | ||||
| final String classes = System.getProperty( "java.home" ) + | final String classes = System.getProperty( "java.home" ) + | ||||
| File.separator + ".." + File.separator + "Classes" + | File.separator + ".." + File.separator + "Classes" + | ||||
| File.separator + "classes.jar"; | File.separator + "classes.jar"; | ||||
| path.addExisting( new Path( classes ) ); | |||||
| path.addLocation( new File( classes ) ); | |||||
| final String ui = System.getProperty( "java.home" ) + | final String ui = System.getProperty( "java.home" ) + | ||||
| File.separator + ".." + File.separator + "Classes" + | File.separator + ".." + File.separator + "Classes" + | ||||
| File.separator + "ui.jar"; | File.separator + "ui.jar"; | ||||
| path.addExisting( new Path( ui ) ); | |||||
| path.addLocation( new File( ui ) ); | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Adds the contents of a set of directories to a path. | |||||
| */ | |||||
| public static void addExtdirs( final Path toPath, final Path extDirs ) | public static void addExtdirs( final Path toPath, final Path extDirs ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| @@ -14,7 +14,10 @@ import org.apache.tools.todo.types.Path; | |||||
| /** | /** | ||||
| * A converter from String to Path. | * A converter from String to Path. | ||||
| * | * | ||||
| * @author Adam Murdoch | |||||
| * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
| * @version $Revision$ $Date$ | |||||
| * | |||||
| * @ant:converter source="java.lang.String" destination="org.apache.tools.todo.types.Path" | |||||
| */ | */ | ||||
| public class StringToPathConverter | public class StringToPathConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| @@ -33,20 +36,13 @@ public class StringToPathConverter | |||||
| * @param original the original Object | * @param original the original Object | ||||
| * @param context the context in which to convert | * @param context the context in which to convert | ||||
| * @return the converted object | * @return the converted object | ||||
| * @exception java.lang.Exception if an error occurs | |||||
| */ | */ | ||||
| protected Object convert( Object original, Object context ) | |||||
| protected Object convert( final Object original, final Object context ) | |||||
| throws ConverterException | throws ConverterException | ||||
| { | { | ||||
| /* | |||||
| String path = (String)original; | String path = (String)original; | ||||
| TaskContext taskContext = (TaskContext)context; | |||||
| Path retval = new Path( path ); | Path retval = new Path( path ); | ||||
| retval.setBaseDirectory( taskContext.getBaseDirectory() ); | |||||
| return retval; | return retval; | ||||
| */ | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -13,8 +13,6 @@ import java.util.Stack; | |||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| 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.todo.types.Path; | |||||
| import org.apache.tools.todo.util.PathTokenizer; | |||||
| /** | /** | ||||
| * This class also encapsulates methods which allow Files to be refered to using | * This class also encapsulates methods which allow Files to be refered to using | ||||
| @@ -242,13 +240,7 @@ public class FileUtils | |||||
| } | } | ||||
| } | } | ||||
| public static String[] translateCommandline( Path to_process ) | |||||
| throws TaskException | |||||
| { | |||||
| return translateCommandline( to_process.toString() ); | |||||
| } | |||||
| public static String[] translateCommandline( String to_process ) | |||||
| public static String[] translateCommandline( final String to_process ) | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( to_process == null || to_process.length() == 0 ) | if( to_process == null || to_process.length() == 0 ) | ||||