diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
index 6d7b4b70c..1cc15545d 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -8,14 +8,13 @@
package org.apache.tools.ant.taskdefs;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.exec.Execute;
-import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
+import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnvironmentVariable;
@@ -29,41 +28,29 @@ import org.apache.tools.ant.types.Path;
* stefano@apache.org
* @author Stefan Bodewig
*/
-public class Java extends Task
+public class Java
+ extends AbstractTask
{
-
- private CommandlineJava cmdl = new CommandlineJava();
- private boolean fork = false;
- private File dir = null;
- private PrintStream outStream = null;
- private boolean failOnError = false;
- private File out;
+ private CommandlineJava m_cmdl = new CommandlineJava();
+ private boolean m_fork;
+ private File m_dir;
+ private PrintStream m_outStream;
/**
* Set the class name.
- *
- * @param s The new Classname value
- * @exception TaskException Description of Exception
*/
public void setClassname( String s )
- throws TaskException
{
- if( cmdl.getJar() != null )
- {
- throw new TaskException( "Cannot use 'jar' and 'classname' attributes in same command" );
- }
- cmdl.setClassname( s );
+ m_cmdl.setClassname( s );
}
/**
* Set the classpath to be used for this compilation.
- *
- * @param s The new Classpath value
*/
- public void setClasspath( Path s )
+ public void setClasspath( final Path classpath )
throws TaskException
{
- createClasspath().append( s );
+ createClasspath().append( classpath );
}
/**
@@ -71,145 +58,83 @@ public class Java extends Task
*
* @param d The new Dir value
*/
- public void setDir( File d )
+ public void setDir( final File dir )
{
- this.dir = d;
- }
-
- /**
- * Throw a TaskException if process returns non 0.
- *
- * @param fail The new Failonerror value
- */
- public void setFailonerror( boolean fail )
- {
- failOnError = fail;
+ m_dir = dir;
}
/**
* Set the forking flag.
- *
- * @param s The new Fork value
*/
- public void setFork( boolean s )
+ public void setFork( final boolean fork )
{
- this.fork = s;
+ m_fork = fork;
}
/**
* set the jar name...
- *
- * @param jarfile The new Jar value
- * @exception TaskException Description of Exception
*/
- public void setJar( File jarfile )
- throws TaskException
+ public void setJar( final File jar )
{
- if( cmdl.getClassname() != null )
- {
- throw new TaskException( "Cannot use 'jar' and 'classname' attributes in same command." );
- }
- cmdl.setJar( jarfile.getAbsolutePath() );
+ m_cmdl.setJar( jar.getAbsolutePath() );
}
/**
* Set the command used to start the VM (only if fork==false).
- *
- * @param s The new Jvm value
*/
- public void setJvm( String s )
+ public void setJvm( final String jvm )
{
- cmdl.setVm( s );
+ m_cmdl.setVm( jvm );
}
/**
* -mx or -Xmx depending on VM version
- *
- * @param max The new Maxmemory value
- */
- public void setMaxmemory( String max )
- {
- cmdl.setMaxmemory( max );
- }
-
- /**
- * File the output of the process is redirected to.
- *
- * @param out The new Output value
*/
- public void setOutput( File out )
+ public void setMaxmemory( final String max )
{
- this.out = out;
+ m_cmdl.setMaxmemory( max );
}
/**
* Add a nested sysproperty element.
- *
- * @param sysp The feature to be added to the Sysproperty attribute
*/
- public void addSysproperty( EnvironmentVariable sysp )
+ public void addSysproperty( final EnvironmentVariable sysp )
{
- cmdl.addSysproperty( sysp );
- }
-
- /**
- * Clear out the arguments to this java task.
- */
- public void clearArgs()
- {
- cmdl.clearJavaArgs();
+ m_cmdl.addSysproperty( sysp );
}
/**
* Creates a nested arg element.
- *
- * @return Description of the Returned Value
*/
public Argument createArg()
{
- return cmdl.createArgument();
+ return m_cmdl.createArgument();
}
/**
* Creates a nested classpath element
- *
- * @return Description of the Returned Value
*/
public Path createClasspath()
throws TaskException
{
- return cmdl.createClasspath().createPath();
+ return m_cmdl.createClasspath().createPath();
}
/**
* Creates a nested jvmarg element.
- *
- * @return Description of the Returned Value
*/
public Argument createJvmarg()
{
- return cmdl.createVmArgument();
+ return m_cmdl.createVmArgument();
}
- /**
- * Do the execution.
- *
- * @exception TaskException Description of Exception
- */
public void execute()
throws TaskException
{
- int err = -1;
- if( ( err = executeJava() ) != 0 )
+ final int err = executeJava();
+ if( 0 != err )
{
- if( failOnError )
- {
- throw new TaskException( "Java returned: " + err );
- }
- else
- {
- getLogger().error( "Java Result: " + err );
- }
+ throw new TaskException( "Java returned: " + err );
}
}
@@ -223,188 +148,107 @@ public class Java extends Task
public int executeJava()
throws TaskException
{
- String classname = cmdl.getClassname();
- if( classname == null && cmdl.getJar() == null )
+ final String classname = m_cmdl.getClassname();
+ final String jar = m_cmdl.getJar();
+ if( classname != null && jar != null )
+ {
+ throw new TaskException( "Only one of Classname and Jar can be set." );
+ }
+ else if( classname == null && jar == null )
{
throw new TaskException( "Classname must not be null." );
}
- if( !fork && cmdl.getJar() != null )
+
+ if( !m_fork && jar != null )
{
throw new TaskException( "Cannot execute a jar in non-forked mode. Please set fork='true'. " );
}
- if( fork )
+ if( m_fork )
{
- getLogger().debug( "Forking " + cmdl.toString() );
+ getLogger().debug( "Forking " + m_cmdl.toString() );
- return run( cmdl.getCommandline() );
+ return run( m_cmdl.getCommandline() );
}
else
{
- if( cmdl.getVmCommand().size() > 1 )
+ if( m_cmdl.getVmCommand().size() > 1 )
{
getLogger().warn( "JVM args ignored when same JVM is used." );
}
- if( dir != null )
+ if( m_dir != null )
{
getLogger().warn( "Working directory ignored when same JVM is used." );
}
- getLogger().debug( "Running in same VM " + cmdl.getJavaCommand().toString() );
- run( cmdl );
+ getLogger().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
+ run( m_cmdl );
return 0;
}
}
- protected void handleErrorOutput( String line )
- {
- if( outStream != null )
- {
- outStream.println( line );
- }
- else
- {
- super.handleErrorOutput( line );
- }
- }
-
- protected void handleOutput( String line )
- {
- if( outStream != null )
- {
- outStream.println( line );
- }
- else
- {
- super.handleOutput( line );
- }
- }
-
/**
* Executes the given classname with the given arguments as it was a command
* line application.
- *
- * @param classname Description of Parameter
- * @param args Description of Parameter
- * @exception TaskException Description of Exception
*/
- protected void run( String classname, ArrayList args )
+ protected void run( final String classname, final ArrayList args )
throws TaskException
{
- CommandlineJava cmdj = new CommandlineJava();
- cmdj.setClassname( classname );
- for( int i = 0; i < args.size(); i++ )
+ final CommandlineJava java = new CommandlineJava();
+ java.setClassname( classname );
+
+ final int size = args.size();
+ for( int i = 0; i < size; i++ )
{
- cmdj.createArgument().setValue( (String)args.get( i ) );
+ final String arg = (String)args.get( i );
+ java.createArgument().setValue( arg );
}
- run( cmdj );
+ run( java );
}
/**
* Executes the given classname with the given arguments as it was a command
* line application.
- *
- * @param command Description of Parameter
- * @exception TaskException Description of Exception
*/
- private void run( CommandlineJava command )
+ private void run( final CommandlineJava command )
throws TaskException
{
- ExecuteJava exe = new ExecuteJava();
+ final ExecuteJava exe = new ExecuteJava();
exe.setJavaCommand( command.getJavaCommand() );
exe.setClasspath( command.getClasspath() );
exe.setSystemProperties( command.getSystemProperties() );
- if( out != null )
- {
- try
- {
- outStream = new PrintStream( new FileOutputStream( out ) );
- exe.execute( getProject() );
- }
- catch( IOException io )
- {
- throw new TaskException( "Error", io );
- }
- finally
- {
- if( outStream != null )
- {
- outStream.close();
- }
- }
- }
- else
- {
- exe.execute( getProject() );
- }
+ exe.execute();
}
/**
* Executes the given classname with the given arguments in a separate VM.
- *
- * @param command Description of Parameter
- * @return Description of the Returned Value
- * @exception TaskException Description of Exception
*/
- private int run( String[] command )
+ private int run( final String[] command )
throws TaskException
{
- FileOutputStream fos = null;
- try
- {
- Execute exe = null;
- if( out == null )
- {
- exe = new Execute();
- exe.setOutput( new LogOutputStream( getLogger(), false ) );
- exe.setError( new LogOutputStream( getLogger(), true ) );
-
- }
- else
- {
- fos = new FileOutputStream( out );
- exe = new Execute();
- exe.setOutput( fos );
- exe.setError( fos );
- }
-
- if( dir == null )
- {
- dir = getBaseDirectory();
- }
- else if( !dir.exists() || !dir.isDirectory() )
- {
- throw new TaskException( dir.getAbsolutePath() + " is not a valid directory" );
- }
-
- exe.setWorkingDirectory( dir );
+ final Execute2 exe = new Execute2();
+ setupLogger( exe );
- exe.setCommandline( command );
- try
- {
- return exe.execute();
- }
- catch( IOException e )
- {
- throw new TaskException( "Error", e );
- }
+ if( m_dir == null )
+ {
+ m_dir = getBaseDirectory();
}
- catch( IOException io )
+ else if( !m_dir.exists() || !m_dir.isDirectory() )
{
- throw new TaskException( "Error", io );
+ final String message = m_dir.getAbsolutePath() + " is not a valid directory";
+ throw new TaskException( message );
}
- finally
+
+ exe.setWorkingDirectory( m_dir );
+ exe.setCommandline( command );
+ try
{
- if( fos != null )
- {
- try
- {
- fos.close();
- }
- catch( IOException io )
- {
- }
- }
+ return exe.execute();
+ }
+ catch( IOException e )
+ {
+ final String message = "Error executing class";
+ throw new TaskException( message, e );
}
}
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
index d58aa1e01..7c82c2e6a 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
@@ -198,7 +198,7 @@ public class BorlandGenerateClient extends Task
getLogger().info( "mode : java" );
org.apache.tools.ant.taskdefs.Java execTask = null;
- execTask = (Java)getProject().createTask( "java" );
+ execTask = null;//(Java)getProject().createTask( "java" );
execTask.setDir( new File( "." ) );
execTask.setClassname( "com.inprise.server.commandline.EJBUtilities" );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
index 205b13f48..12e9f51b6 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
@@ -170,7 +170,7 @@ public class WLJspc extends MatchingTask
// Therefore, takes loads of time
// Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs
// (even on a Sun)
- Java helperTask = (Java)getProject().createTask( "java" );
+ Java helperTask = null;//(Java)getProject().createTask( "java" );
helperTask.setFork( true );
helperTask.setClassname( "weblogic.jspc" );
String[] args = new String[ 12 ];
@@ -227,7 +227,7 @@ public class WLJspc extends MatchingTask
System.out.println( "arg = " + arg );
- helperTask.clearArgs();
+ //helperTask.clearArgs();
helperTask.createArg().setValue( arg );
helperTask.setClasspath( compileClasspath );
if( helperTask.executeJava() != 0 )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
index a15c6f92f..48b8915cf 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
@@ -34,14 +34,14 @@ public class JasperC
{
// Create an instance of the compiler, redirecting output to
// the project log
- Java java = (Java)( getJspc().getProject() ).createTask( "java" );
+ //FIXME
+ Java java = null;//(Java)( getJspc().getProject() ).createTask( "java" );
if( getJspc().getClasspath() != null )
java.setClasspath( getJspc().getClasspath() );
java.setClassname( "org.apache.jasper.JspC" );
String args[] = cmd.getArguments();
for( int i = 0; i < args.length; i++ )
java.createArg().setValue( args[ i ] );
- java.setFailonerror( true );
java.execute();
return true;
}
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
index 91c4c043c..6cec58f12 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
@@ -8,7 +8,8 @@
package org.apache.tools.ant.types;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.Os;
+import org.apache.aut.nativelib.Os;
+import java.io.File;
/**
* A representation of a Java command line that is nothing more than a composite
@@ -18,7 +19,8 @@ import org.apache.myrmidon.framework.Os;
* @author thomas.haas@softwired-inc.com
* @author Stephane Bailliez
*/
-public class CommandlineJava implements Cloneable
+public class CommandlineJava
+ implements Cloneable
{
private Commandline vmCommand = new Commandline();
private Commandline javaCommand = new Commandline();
@@ -265,8 +267,8 @@ public class CommandlineJava implements Cloneable
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming java is somewhere on the
// PATH.
- java.io.File jExecutable =
- new java.io.File( System.getProperty( "java.home" ) +
+ File jExecutable =
+ new File( System.getProperty( "java.home" ) +
"/../bin/java" + extension );
if( jExecutable.exists() && !Os.isFamily( "netware" ) )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/SysProperties.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/SysProperties.java
index 0770ce020..aa34aed3d 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/SysProperties.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/SysProperties.java
@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.exec.ExecException;
+import org.apache.aut.nativelib.ExecException;
/**
* Specialized EnvironmentData class for System properties
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java
index 9021dd2aa..faf63d156 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java
@@ -12,7 +12,7 @@ import java.util.ArrayList;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.Os;
+import org.apache.aut.nativelib.Os;
import org.apache.tools.ant.Task;
/**
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
index 6d7b4b70c..1cc15545d 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
@@ -8,14 +8,13 @@
package org.apache.tools.ant.taskdefs;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.api.AbstractTask;
import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.exec.Execute;
-import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
+import org.apache.tools.ant.taskdefs.exec.Execute2;
import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.EnvironmentVariable;
@@ -29,41 +28,29 @@ import org.apache.tools.ant.types.Path;
* stefano@apache.org
* @author Stefan Bodewig
*/
-public class Java extends Task
+public class Java
+ extends AbstractTask
{
-
- private CommandlineJava cmdl = new CommandlineJava();
- private boolean fork = false;
- private File dir = null;
- private PrintStream outStream = null;
- private boolean failOnError = false;
- private File out;
+ private CommandlineJava m_cmdl = new CommandlineJava();
+ private boolean m_fork;
+ private File m_dir;
+ private PrintStream m_outStream;
/**
* Set the class name.
- *
- * @param s The new Classname value
- * @exception TaskException Description of Exception
*/
public void setClassname( String s )
- throws TaskException
{
- if( cmdl.getJar() != null )
- {
- throw new TaskException( "Cannot use 'jar' and 'classname' attributes in same command" );
- }
- cmdl.setClassname( s );
+ m_cmdl.setClassname( s );
}
/**
* Set the classpath to be used for this compilation.
- *
- * @param s The new Classpath value
*/
- public void setClasspath( Path s )
+ public void setClasspath( final Path classpath )
throws TaskException
{
- createClasspath().append( s );
+ createClasspath().append( classpath );
}
/**
@@ -71,145 +58,83 @@ public class Java extends Task
*
* @param d The new Dir value
*/
- public void setDir( File d )
+ public void setDir( final File dir )
{
- this.dir = d;
- }
-
- /**
- * Throw a TaskException if process returns non 0.
- *
- * @param fail The new Failonerror value
- */
- public void setFailonerror( boolean fail )
- {
- failOnError = fail;
+ m_dir = dir;
}
/**
* Set the forking flag.
- *
- * @param s The new Fork value
*/
- public void setFork( boolean s )
+ public void setFork( final boolean fork )
{
- this.fork = s;
+ m_fork = fork;
}
/**
* set the jar name...
- *
- * @param jarfile The new Jar value
- * @exception TaskException Description of Exception
*/
- public void setJar( File jarfile )
- throws TaskException
+ public void setJar( final File jar )
{
- if( cmdl.getClassname() != null )
- {
- throw new TaskException( "Cannot use 'jar' and 'classname' attributes in same command." );
- }
- cmdl.setJar( jarfile.getAbsolutePath() );
+ m_cmdl.setJar( jar.getAbsolutePath() );
}
/**
* Set the command used to start the VM (only if fork==false).
- *
- * @param s The new Jvm value
*/
- public void setJvm( String s )
+ public void setJvm( final String jvm )
{
- cmdl.setVm( s );
+ m_cmdl.setVm( jvm );
}
/**
* -mx or -Xmx depending on VM version
- *
- * @param max The new Maxmemory value
- */
- public void setMaxmemory( String max )
- {
- cmdl.setMaxmemory( max );
- }
-
- /**
- * File the output of the process is redirected to.
- *
- * @param out The new Output value
*/
- public void setOutput( File out )
+ public void setMaxmemory( final String max )
{
- this.out = out;
+ m_cmdl.setMaxmemory( max );
}
/**
* Add a nested sysproperty element.
- *
- * @param sysp The feature to be added to the Sysproperty attribute
*/
- public void addSysproperty( EnvironmentVariable sysp )
+ public void addSysproperty( final EnvironmentVariable sysp )
{
- cmdl.addSysproperty( sysp );
- }
-
- /**
- * Clear out the arguments to this java task.
- */
- public void clearArgs()
- {
- cmdl.clearJavaArgs();
+ m_cmdl.addSysproperty( sysp );
}
/**
* Creates a nested arg element.
- *
- * @return Description of the Returned Value
*/
public Argument createArg()
{
- return cmdl.createArgument();
+ return m_cmdl.createArgument();
}
/**
* Creates a nested classpath element
- *
- * @return Description of the Returned Value
*/
public Path createClasspath()
throws TaskException
{
- return cmdl.createClasspath().createPath();
+ return m_cmdl.createClasspath().createPath();
}
/**
* Creates a nested jvmarg element.
- *
- * @return Description of the Returned Value
*/
public Argument createJvmarg()
{
- return cmdl.createVmArgument();
+ return m_cmdl.createVmArgument();
}
- /**
- * Do the execution.
- *
- * @exception TaskException Description of Exception
- */
public void execute()
throws TaskException
{
- int err = -1;
- if( ( err = executeJava() ) != 0 )
+ final int err = executeJava();
+ if( 0 != err )
{
- if( failOnError )
- {
- throw new TaskException( "Java returned: " + err );
- }
- else
- {
- getLogger().error( "Java Result: " + err );
- }
+ throw new TaskException( "Java returned: " + err );
}
}
@@ -223,188 +148,107 @@ public class Java extends Task
public int executeJava()
throws TaskException
{
- String classname = cmdl.getClassname();
- if( classname == null && cmdl.getJar() == null )
+ final String classname = m_cmdl.getClassname();
+ final String jar = m_cmdl.getJar();
+ if( classname != null && jar != null )
+ {
+ throw new TaskException( "Only one of Classname and Jar can be set." );
+ }
+ else if( classname == null && jar == null )
{
throw new TaskException( "Classname must not be null." );
}
- if( !fork && cmdl.getJar() != null )
+
+ if( !m_fork && jar != null )
{
throw new TaskException( "Cannot execute a jar in non-forked mode. Please set fork='true'. " );
}
- if( fork )
+ if( m_fork )
{
- getLogger().debug( "Forking " + cmdl.toString() );
+ getLogger().debug( "Forking " + m_cmdl.toString() );
- return run( cmdl.getCommandline() );
+ return run( m_cmdl.getCommandline() );
}
else
{
- if( cmdl.getVmCommand().size() > 1 )
+ if( m_cmdl.getVmCommand().size() > 1 )
{
getLogger().warn( "JVM args ignored when same JVM is used." );
}
- if( dir != null )
+ if( m_dir != null )
{
getLogger().warn( "Working directory ignored when same JVM is used." );
}
- getLogger().debug( "Running in same VM " + cmdl.getJavaCommand().toString() );
- run( cmdl );
+ getLogger().debug( "Running in same VM " + m_cmdl.getJavaCommand().toString() );
+ run( m_cmdl );
return 0;
}
}
- protected void handleErrorOutput( String line )
- {
- if( outStream != null )
- {
- outStream.println( line );
- }
- else
- {
- super.handleErrorOutput( line );
- }
- }
-
- protected void handleOutput( String line )
- {
- if( outStream != null )
- {
- outStream.println( line );
- }
- else
- {
- super.handleOutput( line );
- }
- }
-
/**
* Executes the given classname with the given arguments as it was a command
* line application.
- *
- * @param classname Description of Parameter
- * @param args Description of Parameter
- * @exception TaskException Description of Exception
*/
- protected void run( String classname, ArrayList args )
+ protected void run( final String classname, final ArrayList args )
throws TaskException
{
- CommandlineJava cmdj = new CommandlineJava();
- cmdj.setClassname( classname );
- for( int i = 0; i < args.size(); i++ )
+ final CommandlineJava java = new CommandlineJava();
+ java.setClassname( classname );
+
+ final int size = args.size();
+ for( int i = 0; i < size; i++ )
{
- cmdj.createArgument().setValue( (String)args.get( i ) );
+ final String arg = (String)args.get( i );
+ java.createArgument().setValue( arg );
}
- run( cmdj );
+ run( java );
}
/**
* Executes the given classname with the given arguments as it was a command
* line application.
- *
- * @param command Description of Parameter
- * @exception TaskException Description of Exception
*/
- private void run( CommandlineJava command )
+ private void run( final CommandlineJava command )
throws TaskException
{
- ExecuteJava exe = new ExecuteJava();
+ final ExecuteJava exe = new ExecuteJava();
exe.setJavaCommand( command.getJavaCommand() );
exe.setClasspath( command.getClasspath() );
exe.setSystemProperties( command.getSystemProperties() );
- if( out != null )
- {
- try
- {
- outStream = new PrintStream( new FileOutputStream( out ) );
- exe.execute( getProject() );
- }
- catch( IOException io )
- {
- throw new TaskException( "Error", io );
- }
- finally
- {
- if( outStream != null )
- {
- outStream.close();
- }
- }
- }
- else
- {
- exe.execute( getProject() );
- }
+ exe.execute();
}
/**
* Executes the given classname with the given arguments in a separate VM.
- *
- * @param command Description of Parameter
- * @return Description of the Returned Value
- * @exception TaskException Description of Exception
*/
- private int run( String[] command )
+ private int run( final String[] command )
throws TaskException
{
- FileOutputStream fos = null;
- try
- {
- Execute exe = null;
- if( out == null )
- {
- exe = new Execute();
- exe.setOutput( new LogOutputStream( getLogger(), false ) );
- exe.setError( new LogOutputStream( getLogger(), true ) );
-
- }
- else
- {
- fos = new FileOutputStream( out );
- exe = new Execute();
- exe.setOutput( fos );
- exe.setError( fos );
- }
-
- if( dir == null )
- {
- dir = getBaseDirectory();
- }
- else if( !dir.exists() || !dir.isDirectory() )
- {
- throw new TaskException( dir.getAbsolutePath() + " is not a valid directory" );
- }
-
- exe.setWorkingDirectory( dir );
+ final Execute2 exe = new Execute2();
+ setupLogger( exe );
- exe.setCommandline( command );
- try
- {
- return exe.execute();
- }
- catch( IOException e )
- {
- throw new TaskException( "Error", e );
- }
+ if( m_dir == null )
+ {
+ m_dir = getBaseDirectory();
}
- catch( IOException io )
+ else if( !m_dir.exists() || !m_dir.isDirectory() )
{
- throw new TaskException( "Error", io );
+ final String message = m_dir.getAbsolutePath() + " is not a valid directory";
+ throw new TaskException( message );
}
- finally
+
+ exe.setWorkingDirectory( m_dir );
+ exe.setCommandline( command );
+ try
{
- if( fos != null )
- {
- try
- {
- fos.close();
- }
- catch( IOException io )
- {
- }
- }
+ return exe.execute();
+ }
+ catch( IOException e )
+ {
+ final String message = "Error executing class";
+ throw new TaskException( message, e );
}
}
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
index d58aa1e01..7c82c2e6a 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
@@ -198,7 +198,7 @@ public class BorlandGenerateClient extends Task
getLogger().info( "mode : java" );
org.apache.tools.ant.taskdefs.Java execTask = null;
- execTask = (Java)getProject().createTask( "java" );
+ execTask = null;//(Java)getProject().createTask( "java" );
execTask.setDir( new File( "." ) );
execTask.setClassname( "com.inprise.server.commandline.EJBUtilities" );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
index 205b13f48..12e9f51b6 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
@@ -170,7 +170,7 @@ public class WLJspc extends MatchingTask
// Therefore, takes loads of time
// Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs
// (even on a Sun)
- Java helperTask = (Java)getProject().createTask( "java" );
+ Java helperTask = null;//(Java)getProject().createTask( "java" );
helperTask.setFork( true );
helperTask.setClassname( "weblogic.jspc" );
String[] args = new String[ 12 ];
@@ -227,7 +227,7 @@ public class WLJspc extends MatchingTask
System.out.println( "arg = " + arg );
- helperTask.clearArgs();
+ //helperTask.clearArgs();
helperTask.createArg().setValue( arg );
helperTask.setClasspath( compileClasspath );
if( helperTask.executeJava() != 0 )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
index a15c6f92f..48b8915cf 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
@@ -34,14 +34,14 @@ public class JasperC
{
// Create an instance of the compiler, redirecting output to
// the project log
- Java java = (Java)( getJspc().getProject() ).createTask( "java" );
+ //FIXME
+ Java java = null;//(Java)( getJspc().getProject() ).createTask( "java" );
if( getJspc().getClasspath() != null )
java.setClasspath( getJspc().getClasspath() );
java.setClassname( "org.apache.jasper.JspC" );
String args[] = cmd.getArguments();
for( int i = 0; i < args.length; i++ )
java.createArg().setValue( args[ i ] );
- java.setFailonerror( true );
java.execute();
return true;
}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java
index 91c4c043c..6cec58f12 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java
@@ -8,7 +8,8 @@
package org.apache.tools.ant.types;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.Os;
+import org.apache.aut.nativelib.Os;
+import java.io.File;
/**
* A representation of a Java command line that is nothing more than a composite
@@ -18,7 +19,8 @@ import org.apache.myrmidon.framework.Os;
* @author thomas.haas@softwired-inc.com
* @author Stephane Bailliez
*/
-public class CommandlineJava implements Cloneable
+public class CommandlineJava
+ implements Cloneable
{
private Commandline vmCommand = new Commandline();
private Commandline javaCommand = new Commandline();
@@ -265,8 +267,8 @@ public class CommandlineJava implements Cloneable
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming java is somewhere on the
// PATH.
- java.io.File jExecutable =
- new java.io.File( System.getProperty( "java.home" ) +
+ File jExecutable =
+ new File( System.getProperty( "java.home" ) +
"/../bin/java" + extension );
if( jExecutable.exists() && !Os.isFamily( "netware" ) )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SysProperties.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SysProperties.java
index 0770ce020..aa34aed3d 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SysProperties.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/SysProperties.java
@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.exec.ExecException;
+import org.apache.aut.nativelib.ExecException;
/**
* Specialized EnvironmentData class for System properties
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java
index 9021dd2aa..faf63d156 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java
@@ -12,7 +12,7 @@ import java.util.ArrayList;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.Os;
+import org.apache.aut.nativelib.Os;
import org.apache.tools.ant.Task;
/**