Browse Source

Removed some unused variables and moved private methods to the bottom of the file

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270328 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
916b5fcac1
2 changed files with 60 additions and 64 deletions
  1. +30
    -32
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java
  2. +30
    -32
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java

+ 30
- 32
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java View File

@@ -38,14 +38,12 @@ public class Execute
/**
* Used to destroy processes when the VM exits.
*/
private static ProcessDestroyer c_processDestroyer = new ProcessDestroyer();
private static final ProcessDestroyer c_processDestroyer = new ProcessDestroyer();

private ExecMetaData m_metaData;
private String[] m_command;
private Properties m_environment;
private int m_exitValue;
private File m_workingDirectory = new File( "." );
private Project m_project;
private boolean m_newEnvironment;

/**
@@ -222,9 +220,9 @@ public class Execute
*
* @param newenv whether to propagate the process environment.
*/
public void setNewenvironment( boolean newenv )
public void setNewenvironment( boolean newEnvironment )
{
m_newEnvironment = newenv;
m_newEnvironment = newEnvironment;
}

/**
@@ -237,7 +235,7 @@ public class Execute
*/
public void setVMLauncher( boolean useVMLauncher )
{
this.m_useVMLauncher = useVMLauncher;
m_useVMLauncher = useVMLauncher;
}

/**
@@ -251,29 +249,14 @@ public class Execute
}

/**
* Returns the environment used to create a subprocess.
* test for an untimely death of the process
*
* @return the environment used to create a subprocess
* @return true iff a watchdog had to kill the process
* @since 1.5
*/
private String[] getEnvironment()
throws TaskException
public boolean killedProcess()
{
if( m_newEnvironment )
{
return Environment.toNativeFormat( m_environment );
}
else
{
try
{
Environment.addNativeEnvironment( m_environment );
return Environment.toNativeFormat( m_environment );
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
}
return m_watchdog != null && m_watchdog.killedProcess();
}

/**
@@ -287,7 +270,7 @@ public class Execute
{

final ExecMetaData metaData =
new ExecMetaData( m_command, getEnvironment(),
new ExecMetaData( m_command, getNativeEnvironment(),
m_workingDirectory, false );

final CommandLauncher launcher = getLauncher();
@@ -351,13 +334,28 @@ public class Execute
}

/**
* test for an untimely death of the process
* Returns the environment used to create a subprocess.
*
* @return true iff a watchdog had to kill the process
* @since 1.5
* @return the environment used to create a subprocess
*/
public boolean killedProcess()
private String[] getNativeEnvironment()
throws TaskException
{
return m_watchdog != null && m_watchdog.killedProcess();
if( m_newEnvironment )
{
return Environment.toNativeFormat( m_environment );
}
else
{
try
{
Environment.addNativeEnvironment( m_environment );
return Environment.toNativeFormat( m_environment );
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
}
}
}

+ 30
- 32
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java View File

@@ -38,14 +38,12 @@ public class Execute
/**
* Used to destroy processes when the VM exits.
*/
private static ProcessDestroyer c_processDestroyer = new ProcessDestroyer();
private static final ProcessDestroyer c_processDestroyer = new ProcessDestroyer();

private ExecMetaData m_metaData;
private String[] m_command;
private Properties m_environment;
private int m_exitValue;
private File m_workingDirectory = new File( "." );
private Project m_project;
private boolean m_newEnvironment;

/**
@@ -222,9 +220,9 @@ public class Execute
*
* @param newenv whether to propagate the process environment.
*/
public void setNewenvironment( boolean newenv )
public void setNewenvironment( boolean newEnvironment )
{
m_newEnvironment = newenv;
m_newEnvironment = newEnvironment;
}

/**
@@ -237,7 +235,7 @@ public class Execute
*/
public void setVMLauncher( boolean useVMLauncher )
{
this.m_useVMLauncher = useVMLauncher;
m_useVMLauncher = useVMLauncher;
}

/**
@@ -251,29 +249,14 @@ public class Execute
}

/**
* Returns the environment used to create a subprocess.
* test for an untimely death of the process
*
* @return the environment used to create a subprocess
* @return true iff a watchdog had to kill the process
* @since 1.5
*/
private String[] getEnvironment()
throws TaskException
public boolean killedProcess()
{
if( m_newEnvironment )
{
return Environment.toNativeFormat( m_environment );
}
else
{
try
{
Environment.addNativeEnvironment( m_environment );
return Environment.toNativeFormat( m_environment );
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
}
return m_watchdog != null && m_watchdog.killedProcess();
}

/**
@@ -287,7 +270,7 @@ public class Execute
{

final ExecMetaData metaData =
new ExecMetaData( m_command, getEnvironment(),
new ExecMetaData( m_command, getNativeEnvironment(),
m_workingDirectory, false );

final CommandLauncher launcher = getLauncher();
@@ -351,13 +334,28 @@ public class Execute
}

/**
* test for an untimely death of the process
* Returns the environment used to create a subprocess.
*
* @return true iff a watchdog had to kill the process
* @since 1.5
* @return the environment used to create a subprocess
*/
public boolean killedProcess()
private String[] getNativeEnvironment()
throws TaskException
{
return m_watchdog != null && m_watchdog.killedProcess();
if( m_newEnvironment )
{
return Environment.toNativeFormat( m_environment );
}
else
{
try
{
Environment.addNativeEnvironment( m_environment );
return Environment.toNativeFormat( m_environment );
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
}
}
}

Loading…
Cancel
Save