git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269906 13f79535-47bb-0310-9956-ffa450edef68master
@@ -59,6 +59,8 @@ Other changes: | |||||
* Improved support for Novell NetWare. | * Improved support for Novell NetWare. | ||||
* Added an optional encoding attribute to <fixcrlf> | |||||
Changes from Ant 1.4 to Ant 1.4.1 | Changes from Ant 1.4 to Ant 1.4.1 | ||||
=========================================== | =========================================== | ||||
@@ -23,7 +23,7 @@ | |||||
includes="Junk2.java" | includes="Junk2.java" | ||||
javafiles="true" | javafiles="true" | ||||
tab="add" | tab="add" | ||||
cr="add" | |||||
cr="add" | |||||
eol="crlf" | eol="crlf" | ||||
eof="asis" | eof="asis" | ||||
/> | /> | ||||
@@ -62,7 +62,7 @@ | |||||
<fixcrlf srcdir="input" destdir="result" | <fixcrlf srcdir="input" destdir="result" | ||||
includes="Junk6.java" | includes="Junk6.java" | ||||
tab="add" | tab="add" | ||||
cr="remove" | |||||
cr="remove" | |||||
eol="crlf" | eol="crlf" | ||||
eof="asis" | eof="asis" | ||||
/> | /> | ||||
@@ -72,7 +72,7 @@ | |||||
<fixcrlf srcdir="input" destdir="result" | <fixcrlf srcdir="input" destdir="result" | ||||
includes="Junk7.java" | includes="Junk7.java" | ||||
tab="add" | tab="add" | ||||
cr="add" | |||||
cr="add" | |||||
eof="asis" | eof="asis" | ||||
/> | /> | ||||
</target> | </target> | ||||
@@ -80,9 +80,9 @@ | |||||
<target name="test8" depends="init"> | <target name="test8" depends="init"> | ||||
<fixcrlf srcdir="input" destdir="result" | <fixcrlf srcdir="input" destdir="result" | ||||
includes="Junk8.java" | includes="Junk8.java" | ||||
javafiles="true" | |||||
javafiles="true" | |||||
tab="add" | tab="add" | ||||
cr="add" | |||||
cr="add" | |||||
eof="add" | eof="add" | ||||
/> | /> | ||||
</target> | </target> | ||||
@@ -90,9 +90,9 @@ | |||||
<target name="test9" depends="init"> | <target name="test9" depends="init"> | ||||
<fixcrlf srcdir="input" destdir="result" | <fixcrlf srcdir="input" destdir="result" | ||||
includes="Junk9.java" | includes="Junk9.java" | ||||
javafiles="true" | |||||
javafiles="true" | |||||
tab="remove" | tab="remove" | ||||
cr="remove" | |||||
cr="remove" | |||||
eof="remove" | eof="remove" | ||||
/> | /> | ||||
</target> | </target> | ||||
@@ -100,8 +100,8 @@ | |||||
<target name="testEncoding" depends="init"> | <target name="testEncoding" depends="init"> | ||||
<fixcrlf srcdir="input" destdir="result" | <fixcrlf srcdir="input" destdir="result" | ||||
includes="input.crlf.utf16" | includes="input.crlf.utf16" | ||||
javafiles="false" | |||||
cr="remove" | |||||
javafiles="false" | |||||
cr="remove" | |||||
encoding="UTF16" | encoding="UTF16" | ||||
/> | /> | ||||
</target> | </target> | ||||
@@ -393,8 +393,8 @@ public class FixCRLF extends MatchingTask { | |||||
* Checks for the inequality of two files | * Checks for the inequality of two files | ||||
*/ | */ | ||||
private boolean filesEqual(File file1, File file2) { | private boolean filesEqual(File file1, File file2) { | ||||
BufferedReader reader1; | |||||
BufferedReader reader2; | |||||
BufferedReader reader1 = null; | |||||
BufferedReader reader2 = null; | |||||
char buf1[] = new char[INBUFLEN]; | char buf1[] = new char[INBUFLEN]; | ||||
char buf2[] = new char[INBUFLEN]; | char buf2[] = new char[INBUFLEN]; | ||||
int buflen; | int buflen; | ||||
@@ -415,20 +415,26 @@ public class FixCRLF extends MatchingTask { | |||||
// know what it is | // know what it is | ||||
for (int i = 0; i < buflen; i++) { | for (int i = 0; i < buflen; i++) { | ||||
if (buf1[i] != buf2[i]) { | if (buf1[i] != buf2[i]) { | ||||
reader1.close(); | |||||
reader2.close(); | |||||
return false; | return false; | ||||
} // end of if (buf1[i] != buf2[i]) | } // end of if (buf1[i] != buf2[i]) | ||||
} | } | ||||
} | } | ||||
reader1.close(); | |||||
reader2.close(); | |||||
return true; // equal | return true; // equal | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException("IOException in filesEqual: " + | throw new BuildException("IOException in filesEqual: " + | ||||
file1 + " : " + file2); | file1 + " : " + file2); | ||||
} // end of try-catch | |||||
} finally { | |||||
if (reader1 != null) { | |||||
try { | |||||
reader1.close(); | |||||
} catch (IOException e) {} | |||||
} | |||||
if (reader2 != null) { | |||||
try { | |||||
reader2.close(); | |||||
} catch (IOException e) {} | |||||
} | |||||
} | |||||
} | } | ||||
@@ -572,10 +578,16 @@ public class FixCRLF extends MatchingTask { | |||||
} else if (ctrlz == ADD){ | } else if (ctrlz == ADD){ | ||||
outWriter.write(CTRLZ); | outWriter.write(CTRLZ); | ||||
} | } | ||||
outWriter.close(); | |||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException(e); | throw new BuildException(e); | ||||
} // end of try-catch | |||||
} finally { | |||||
try { | |||||
outWriter.close(); | |||||
} catch (IOException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
File destFile = new File(destD, file); | File destFile = new File(destD, file); | ||||