Author: jkf
Date: Sun Apr  8 05:06:38 2007
New Revision: 526542

URL: http://svn.apache.org/viewvc?view=rev&rev=526542
Log:
Changes after static code analysis.
Code changed.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Property.java
    
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java?view=diff&rev=526542&r1=526541&r2=526542
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java Sun Apr 
 8 05:06:38 2007
@@ -182,8 +182,7 @@
             String lhsKey = getKey();
             String rhsKey = rhsAttribute.getKey();
             if ((lhsKey == null && rhsKey != null)
-                 || (lhsKey != null && rhsKey == null)
-                 || !lhsKey.equals(rhsKey)) {
+                 || (lhsKey != null && !lhsKey.equals(rhsKey))) {
                 return false;
             }
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Property.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Property.java?view=diff&rev=526542&r1=526541&r2=526542
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Property.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Property.java Sun Apr 
 8 05:06:38 2007
@@ -452,8 +452,9 @@
         log("Loading " + file.getAbsolutePath(), Project.MSG_VERBOSE);
         try {
             if (file.exists()) {
-                FileInputStream fis = new FileInputStream(file);
+                FileInputStream  fis = null;
                 try {
+                    fis = new FileInputStream(file);
                     props.load(fis);
                 } finally {
                     if (fis != null) {

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java?view=diff&rev=526542&r1=526541&r2=526542
==============================================================================
--- 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
 (original)
+++ 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
 Sun Apr  8 05:06:38 2007
@@ -134,9 +134,9 @@
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
 
             String[] srcFiles = ds.getIncludedFiles();
-            fileNum = srcFiles.length;
 
             if (srcFiles != null) {
+                fileNum = srcFiles.length;
                 for (int j = 0; j < srcFiles.length; j++) {
                     File f = new File(ds.getBasedir(), srcFiles[j]);
                     filelist.append(" 
").append('"').append(f.getAbsolutePath()).append('"');

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java?view=diff&rev=526542&r1=526541&r2=526542
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java Sun Apr  
8 05:06:38 2007
@@ -125,18 +125,28 @@
      */
     public static void throwBuildException(Exception t)
         throws BuildException {
+        throw toBuildException(t);
+    }
+
+    /**
+     * A method to convert an invocationTargetException to
+     * a buildexception.
+     * @param t the invocation target exception.
+     * @since ant 1.7.1
+     */
+    public static BuildException toBuildException(Exception t) {
         if (t instanceof InvocationTargetException) {
             Throwable t2 = ((InvocationTargetException) t)
                 .getTargetException();
             if (t2 instanceof BuildException) {
-                throw (BuildException) t2;
+                return (BuildException) t2;
             }
-            throw new BuildException(t2);
+            return new BuildException(t2);
         } else {
-            throw new BuildException(t);
+            return new BuildException(t);
         }
     }
-    
+
     /**
      * A method to test if an object responds to a given 
      * message (method call)

Modified: 
ant/core/trunk/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java?view=diff&rev=526542&r1=526541&r2=526542
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ScriptRunnerCreator.java 
Sun Apr  8 05:06:38 2007
@@ -130,10 +130,8 @@
                 runnerClass, true, scriptLoader).newInstance();
             runner.setProject(project);
         } catch (Exception ex) {
-            ReflectUtil.throwBuildException(ex);
-            // NotReached
+            throw ReflectUtil.toBuildException(ex);
         }
-
         runner.setLanguage(language);
         runner.setScriptClassLoader(scriptLoader);
         return runner;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to