From 6aff19de746c6d15dd63c955fb5b9d25f3a98c7c Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 3 Nov 2008 14:10:37 +0000 Subject: [PATCH] Improve fixcrlf's error messages. PR 43936. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@710060 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/FixCRLF.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index f110e4b54..65d1fa538 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -221,7 +221,9 @@ public class FixCRLF extends MatchingTask implements ChainableReader { try { filter.setTablength(tlength); } 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; if (destFile.exists()) { // 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); log(destFile + (destIsWrong ? " is being written" : " is not written, as the contents are identical"), @@ -370,13 +372,14 @@ public class FixCRLF extends MatchingTask implements ChainableReader { if (destIsWrong) { FILE_UTILS.rename(tmpFile, destFile); if (preserveLastModified) { - log("preserved lastModified", Project.MSG_DEBUG); + log("preserved lastModified for " + destFile, + Project.MSG_DEBUG); FILE_UTILS.setFileLastModified(destFile, lastModified); } tmpFile = null; } } catch (IOException e) { - throw new BuildException(e); + throw new BuildException("error running fixcrlf on file " + srcFile, e); } }