ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/2] git commit: PR 56593 XMLJUnitResultFormatter may throw NPE when Java cannot determine hostname. Submitted by Joel Tucci.
Date Sat, 21 Jun 2014 05:43:03 GMT
PR 56593 XMLJUnitResultFormatter may throw NPE when Java cannot
determine hostname.  Submitted by Joel Tucci.


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/a6b49f94
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/a6b49f94
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/a6b49f94

Branch: refs/heads/master
Commit: a6b49f948ddad457bee248c1efea1ab08d249ba5
Parents: ca34ebd
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Jun 21 07:42:44 2014 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Jun 21 07:42:44 2014 +0200

----------------------------------------------------------------------
 CONTRIBUTORS                                                 | 1 +
 WHATSNEW                                                     | 3 +++
 contributors.xml                                             | 4 ++++
 .../ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java | 8 ++++++--
 4 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/a6b49f94/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index a533fb8..4a10c42 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -182,6 +182,7 @@ Jesse Glick
 Jesse Stockall
 Jim Allers
 Joerg Wassmer
+Joel Tucci
 Joey Richey
 Johann Herunter
 John Elion

http://git-wip-us.apache.org/repos/asf/ant/blob/a6b49f94/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index ab02124..6ebed1e 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -14,6 +14,9 @@ Fixed bugs:
  * TarArchiveInputStream could throw IOException when reading PAX
    headers from a "slow" InputStream.
 
+ * XMLJunitResultFormatter could throw NullPointerException if Java
+   cannot determine the local hostname.
+   Bugzilla Report 56593
 
 Other changes:
 --------------

http://git-wip-us.apache.org/repos/asf/ant/blob/a6b49f94/contributors.xml
----------------------------------------------------------------------
diff --git a/contributors.xml b/contributors.xml
index 488d784..a86950a 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -752,6 +752,10 @@
     <last>Wassmer</last>
   </name>
   <name>
+    <first>Joel</first>
+    <last>Tucci</last>
+  </name>
+  <name>
     <first>Joey</first>
     <last>Richey</last>
   </name>

http://git-wip-us.apache.org/repos/asf/ant/blob/a6b49f94/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
index 4ff3ab1..7f064f9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
@@ -161,11 +161,15 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter,
XMLConstan
      * @return the name of the local host, or "localhost" if we cannot work it out
      */
     private String getHostname()  {
+        String hostname = "localhost";
         try {
-            return InetAddress.getLocalHost().getHostName();
+            InetAddress localHost = InetAddress.getLocalHost();
+            if (localHost != null) {
+                hostname = localHost.getHostName();
+            }
         } catch (UnknownHostException e) {
-            return "localhost";
         }
+        return hostname;
     }
 
     /**


Mime
View raw message