Author: jlboudart
Date: Tue Aug 20 19:38:36 2013
New Revision: 1515945

URL: http://svn.apache.org/r1515945
Log:
Avoid catching NPE

Modified:
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
    
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java?rev=1515945&r1=1515944&r2=1515945&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java 
(original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntEngine.java 
Tue Aug 20 19:38:36 2013
@@ -717,6 +717,10 @@ public class EasyAntEngine {
             try {
                 Properties props = new Properties();
                 in = 
Main.class.getResourceAsStream("/META-INF/version.properties");
+                if (in == null) {
+                    throw new BuildException("Could not load the version 
information.");
+
+                }
                 props.load(in);
 
                 StringBuffer msg = new StringBuffer();
@@ -727,8 +731,6 @@ public class EasyAntEngine {
                 easyantVersion = msg.toString();
             } catch (IOException ioe) {
                 throw new BuildException("Could not load the version 
information:" + ioe.getMessage());
-            } catch (NullPointerException npe) {
-                throw new BuildException("Could not load the version 
information.");
             } finally {
                 if (in != null) {
                     try {

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java?rev=1515945&r1=1515944&r2=1515945&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java 
(original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/core/EasyAntMain.java 
Tue Aug 20 19:38:36 2013
@@ -737,6 +737,9 @@ public class EasyAntMain implements AntM
             try {
                 Properties props = new Properties();
                 in = 
Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
+                if (in == null) {
+                    throw new BuildException("Could not load the version 
information.");
+                }
                 props.load(in);
 
                 StringBuffer msg = new StringBuffer();
@@ -747,8 +750,6 @@ public class EasyAntMain implements AntM
                 antVersion = msg.toString();
             } catch (IOException ioe) {
                 throw new BuildException("Could not load the version 
information:" + ioe.getMessage());
-            } catch (NullPointerException npe) {
-                throw new BuildException("Could not load the version 
information.");
             } finally {
                 if (in != null) {
                     try {

Modified: 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
URL: 
http://svn.apache.org/viewvc/ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java?rev=1515945&r1=1515944&r2=1515945&view=diff
==============================================================================
--- 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
 (original)
+++ 
ant/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/CoreRevisionCheckerTask.java
 Tue Aug 20 19:38:36 2013
@@ -95,12 +95,13 @@ public class CoreRevisionCheckerTask ext
             try {
                 Properties props = new Properties();
                 in = 
CoreRevisionCheckerTask.class.getResourceAsStream("/META-INF/version.properties");
+                if (in == null) {
+                    throw new BuildException("Could not load the version 
information.");
+                }
                 props.load(in);
                 easyantSpecVersion = props.getProperty("SPEC-VERSION");
             } catch (IOException ioe) {
                 throw new BuildException("Could not load the version 
information:" + ioe.getMessage());
-            } catch (NullPointerException npe) {
-                throw new BuildException("Could not load the version 
information.");
             } finally {
                 if (in != null) {
                     try {


Reply via email to