This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new 4eb3b5b fix potential NullPointerException - Bugzilla Issue 64438
4eb3b5b is described below
commit 4eb3b5b7d598f1f83b0a61ae815aef1c68351471
Author: Stefan Bodewig <[email protected]>
AuthorDate: Thu May 14 11:52:10 2020 +0200
fix potential NullPointerException - Bugzilla Issue 64438
---
WHATSNEW | 6 ++++++
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java | 5 +++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/WHATSNEW b/WHATSNEW
index 2a39fb8..b085be7 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,6 +1,12 @@
Changes from Ant 1.10.8 TO Ant 1.10.9
=====================================
+Fixed bugs:
+-----------
+
+ * the ftp task could throw a NullPointerException if an error occured
+ Bugzilla Report 64438
+
Changes from Ant 1.10.7 TO Ant 1.10.8
=====================================
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index e8fa600..90bb9a1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -2611,9 +2611,10 @@ public class FTP extends Task implements FTPTaskConfig {
}
} catch (IOException ex) {
- String cause = ex.getCause().toString();
+ final Throwable cause = ex.getCause();
if (cause != null) {
- if (cause.contains("java.net.SocketTimeoutException")) {
+ final String msg = cause.toString();
+ if (msg != null &&
msg.contains("java.net.SocketTimeoutException")) {
// When a read timeout occurs, inform the server that it
// should abort.
// Note that the latest commons-net (3.6) still does not