|
@@ -221,7 +221,9 @@ public class FixCRLF extends MatchingTask implements ChainableReader { |
|
|
try { |
|
|
try { |
|
|
filter.setTablength(tlength); |
|
|
filter.setTablength(tlength); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new BuildException(e); |
|
|
|
|
|
|
|
|
// filter.setTablength throws IOException that would better be |
|
|
|
|
|
// a BuildException |
|
|
|
|
|
throw new BuildException(e.getMessage(), e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -361,7 +363,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { |
|
|
boolean destIsWrong = true; |
|
|
boolean destIsWrong = true; |
|
|
if (destFile.exists()) { |
|
|
if (destFile.exists()) { |
|
|
// Compare the destination with the temp file |
|
|
// Compare the destination with the temp file |
|
|
log("destFile exists", Project.MSG_DEBUG); |
|
|
|
|
|
|
|
|
log("destFile " + destFile + " exists", Project.MSG_DEBUG); |
|
|
destIsWrong = !FILE_UTILS.contentEquals(destFile, tmpFile); |
|
|
destIsWrong = !FILE_UTILS.contentEquals(destFile, tmpFile); |
|
|
log(destFile + (destIsWrong ? " is being written" |
|
|
log(destFile + (destIsWrong ? " is being written" |
|
|
: " is not written, as the contents are identical"), |
|
|
: " is not written, as the contents are identical"), |
|
@@ -370,13 +372,14 @@ public class FixCRLF extends MatchingTask implements ChainableReader { |
|
|
if (destIsWrong) { |
|
|
if (destIsWrong) { |
|
|
FILE_UTILS.rename(tmpFile, destFile); |
|
|
FILE_UTILS.rename(tmpFile, destFile); |
|
|
if (preserveLastModified) { |
|
|
if (preserveLastModified) { |
|
|
log("preserved lastModified", Project.MSG_DEBUG); |
|
|
|
|
|
|
|
|
log("preserved lastModified for " + destFile, |
|
|
|
|
|
Project.MSG_DEBUG); |
|
|
FILE_UTILS.setFileLastModified(destFile, lastModified); |
|
|
FILE_UTILS.setFileLastModified(destFile, lastModified); |
|
|
} |
|
|
} |
|
|
tmpFile = null; |
|
|
tmpFile = null; |
|
|
} |
|
|
} |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new BuildException(e); |
|
|
|
|
|
|
|
|
throw new BuildException("error running fixcrlf on file " + srcFile, e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|