You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2015/02/04 11:14:56 UTC
[2/2] ant git commit: NullPointerException in
ResourceUtils.copyUsingFileChannels
NullPointerException in ResourceUtils.copyUsingFileChannels
Bugzilla Report 57533
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/dc37a17f
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/dc37a17f
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/dc37a17f
Branch: refs/heads/master
Commit: dc37a17ff84af8e9c7fec2aa93d7b2b989fb304c
Parents: 6f31859
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Feb 4 11:13:58 2015 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Feb 4 11:13:58 2015 +0100
----------------------------------------------------------------------
WHATSNEW | 6 +++++
.../apache/tools/ant/util/ResourceUtils.java | 23 ++++++++++++++------
2 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/dc37a17f/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 5c78ad1..f53145f 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -64,6 +64,12 @@ Fixed bugs:
archive failed.
Port of https://issues.apache.org/jira/browse/COMPRESS-297
+ * FileUtils.rename which is used by several tasks can throw a
+ NullPointerException if the "normal" renameTo operation fails and
+ an exception occurs while rename falls back to copying and deleting
+ the file.
+ Bugzilla Report 57533
+
Other changes:
--------------
http://git-wip-us.apache.org/repos/asf/ant/blob/dc37a17f/src/main/org/apache/tools/ant/util/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java
index 0c1ce69..6397f71 100644
--- a/src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -435,11 +435,15 @@ public class ResourceUtils {
copyUsingFileChannels(sourceFile, destFile);
copied = true;
} catch (final IOException ex) {
- project.log("Attempt to copy " + sourceFile
- + " to " + destFile + " using NIO Channels"
- + " failed due to '" + ex.getMessage()
- + "'. Falling back to streams.",
- Project.MSG_WARN);
+ String msg = "Attempt to copy " + sourceFile
+ + " to " + destFile + " using NIO Channels"
+ + " failed due to '" + ex.getMessage()
+ + "'. Falling back to streams.";
+ if (project != null) {
+ project.log(msg, Project.MSG_WARN);
+ } else {
+ System.err.println(msg);
+ }
}
}
if (!copied) {
@@ -828,8 +832,13 @@ public class ResourceUtils {
if (a != null) {
return a.getAppendOutputStream();
}
- project.log("Appendable OutputStream not available for non-appendable resource "
- + resource + "; using plain OutputStream", Project.MSG_VERBOSE);
+ String msg = "Appendable OutputStream not available for non-appendable resource "
+ + resource + "; using plain OutputStream";
+ if (project != null) {
+ project.log(msg, Project.MSG_VERBOSE);
+ } else {
+ System.out.println(msg);
+ }
}
return resource.getOutputStream();
}