Browse Source

Use IOUtils.shutdown() for readers/writers

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270803 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
9026bb612d
2 changed files with 6 additions and 50 deletions
  1. +3
    -25
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java
  2. +3
    -25
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java

+ 3
- 25
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/Replace.java View File

@@ -23,6 +23,7 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.Properties;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -389,26 +390,8 @@ public class Replace
}
finally
{
if( reader != null )
{
try
{
reader.close();
}
catch( IOException e )
{
}
}
if( writer != null )
{
try
{
writer.close();
}
catch( IOException e )
{
}
}
IOUtil.shutdownReader(reader);
IOUtil.shutdownWriter(writer);
if( temp != null )
{
temp.delete();
@@ -435,11 +418,6 @@ public class Replace

/**
* Replace occurrences of str1 in string str with str2
*
* @param str Description of Parameter
* @param str1 Description of Parameter
* @param str2 Description of Parameter
* @return Description of the Returned Value
*/
private String stringReplace( String str, String str1, String str2 )
{


+ 3
- 25
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/text/Replace.java View File

@@ -23,6 +23,7 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.Properties;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask;
@@ -389,26 +390,8 @@ public class Replace
}
finally
{
if( reader != null )
{
try
{
reader.close();
}
catch( IOException e )
{
}
}
if( writer != null )
{
try
{
writer.close();
}
catch( IOException e )
{
}
}
IOUtil.shutdownReader(reader);
IOUtil.shutdownWriter(writer);
if( temp != null )
{
temp.delete();
@@ -435,11 +418,6 @@ public class Replace

/**
* Replace occurrences of str1 in string str with str2
*
* @param str Description of Parameter
* @param str1 Description of Parameter
* @param str2 Description of Parameter
* @return Description of the Returned Value
*/
private String stringReplace( String str, String str1, String str2 )
{


Loading…
Cancel
Save