ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r526545 - in /ant/core/trunk/src/main/org/apache/tools/ant: ./ filters/ taskdefs/ taskdefs/condition/ taskdefs/cvslib/ taskdefs/optional/ taskdefs/optional/depend/ types/resources/ types/selectors/ util/
Date Sun, 08 Apr 2007 12:08:28 GMT
Author: jkf
Date: Sun Apr  8 05:08:27 2007
New Revision: 526545

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

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java
    ant/core/trunk/src/main/org/apache/tools/ant/Main.java
    ant/core/trunk/src/main/org/apache/tools/ant/filters/StripJavaComments.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/ContainerMapper.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/ComponentHelper.java Sun Apr  8 05:08:27
2007
@@ -1046,7 +1046,7 @@
             boolean found = false;
             if (clazz instanceof Class) {
                 for (Iterator i = values().iterator(); i.hasNext() && !found;) {
-                    found |= (((AntTypeDefinition) (i.next())).getExposedClass(
+                    found = (((AntTypeDefinition) (i.next())).getExposedClass(
                         project) == clazz);
                 }
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Main.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Main.java Sun Apr  8 05:08:27 2007
@@ -821,9 +821,7 @@
             handler = (InputHandler) ClasspathUtils.newInstance(
                     inputHandlerClassname, Main.class.getClassLoader(),
                     InputHandler.class);
-            if (project != null) {
-                project.setProjectReference(handler);
-            }
+            project.setProjectReference(handler);
         }
         project.setInputHandler(handler);
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/StripJavaComments.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/StripJavaComments.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/StripJavaComments.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/StripJavaComments.java Sun Apr  8
05:08:27 2007
@@ -105,7 +105,7 @@
                                 ch = in.read();
                                 if (ch == '*') {
                                     ch = in.read();
-                                    while (ch == '*' && ch != -1) {
+                                    while (ch == '*') {
                                         ch = in.read();
                                     }
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java Sun Apr  8 05:08:27
2007
@@ -1047,7 +1047,7 @@
 
             // Build the command
             File commandDir = workingDir;
-            if (workingDir == null && project != null) {
+            if (workingDir == null) {
                 commandDir = project.getBaseDir();
             }
             String[] newcmd = new String[cmd.length + 2];
@@ -1106,7 +1106,7 @@
 
             // Build the command
             File commandDir = workingDir;
-            if (workingDir == null && project != null) {
+            if (workingDir == null) {
                 commandDir = project.getBaseDir();
             }
             String[] newcmd = new String[cmd.length + 3];

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java Sun Apr  8 05:08:27 2007
@@ -571,7 +571,7 @@
                            long lastModified, File fromArchive, int mode)
         throws IOException {
         if (MANIFEST_NAME.equalsIgnoreCase(vPath))  {
-            if (!doubleFilePass || (doubleFilePass && skipWriting)) {
+            if (!doubleFilePass || skipWriting) {
                 filesetManifest(fromArchive, is);
             }
         } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) {
@@ -779,7 +779,7 @@
         super.cleanUp();
 
         // we want to save this info if we are going to make another pass
-        if (!doubleFilePass || (doubleFilePass && !skipWriting)) {
+        if (!doubleFilePass || !skipWriting) {
             manifest = null;
             configuredManifest = savedConfiguredManifest;
             filesetManifest = null;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java Sun Apr  8 05:08:27
2007
@@ -376,7 +376,7 @@
 
         //DO NOT SET THE -signedjar OPTION if source==dest
         //unless you like fielding hotspot crash reports
-        if (null != targetFile && !jarSource.equals(targetFile)) {
+        if (!jarSource.equals(targetFile)) {
             addValue(cmd, "-signedjar");
             addValue(cmd, targetFile.getPath());
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java Sun Apr  8 05:08:27 2007
@@ -584,7 +584,7 @@
             Iterator iter = rc.iterator();
             while (upToDate && iter.hasNext()) {
                 Resource r = (Resource) iter.next();
-                upToDate &= archiveIsUpToDate(r);
+                upToDate = archiveIsUpToDate(r);
             }
         }
         return upToDate;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/UpToDate.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/UpToDate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/UpToDate.java Sun Apr  8 05:08:27
2007
@@ -185,14 +185,12 @@
         boolean upToDate = true;
         if (sourceFile != null) {
             if (mapperElement == null) {
-                upToDate = upToDate
-                    && (targetFile.lastModified() >= sourceFile.lastModified());
+                upToDate = targetFile.lastModified() >= sourceFile.lastModified();
             } else {
                 SourceFileScanner sfs = new SourceFileScanner(this);
-                upToDate = upToDate
-                    && (sfs.restrict(new String[] {sourceFile.getAbsolutePath()},
+                upToDate = sfs.restrict(new String[] {sourceFile.getAbsolutePath()},
                                   null, null,
-                                  mapperElement.getImplementation()).length == 0);
+                                  mapperElement.getImplementation()).length == 0;
             }
         }
 
@@ -204,15 +202,14 @@
         while (upToDate && e.hasMoreElements()) {
             FileSet fs = (FileSet) e.nextElement();
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
-            upToDate = upToDate && scanDir(fs.getDir(getProject()),
+            upToDate = scanDir(fs.getDir(getProject()),
                                            ds.getIncludedFiles());
         }
 
         if (upToDate) {
             Resource[] r = sourceResources.listResources();
-            upToDate = upToDate
-                && (ResourceUtils.selectOutOfDateSources(
-                        this, r, getMapper(), getProject()).length == 0);
+            upToDate = ResourceUtils.selectOutOfDateSources(
+                        this, r, getMapper(), getProject()).length == 0;
         }
 
         return upToDate;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java Sun Apr
 8 05:08:27 2007
@@ -111,7 +111,7 @@
         if (file == null) {
             throw new BuildException("The file attribute must be set.");
         }
-        if (file != null && !file.exists()) {
+        if (!file.exists()) {
             log("The file \"" + file.getAbsolutePath()
                 + "\" does not exist.", Project.MSG_VERBOSE);
             return false;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java Sun Apr
 8 05:08:27 2007
@@ -92,15 +92,15 @@
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         buffer.append(filename);
-        if ((revision == null)) {
+        if (revision == null) {
             buffer.append(" was removed");
             if (prevRevision != null) {
                 buffer.append("; previous revision was ").append(prevRevision);
             }
-        } else if (revision != null && prevRevision == null) {
+        } else if (prevRevision == null) {
             buffer.append(" is new; current revision is ")
                 .append(revision);
-        } else if (revision != null && prevRevision != null) {
+        } else {
             buffer.append(" has changed from ")
                 .append(prevRevision).append(" to ").append(revision);
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java Sun Apr  8 05:08:27
2007
@@ -290,7 +290,7 @@
             if (targetIsOutOfDate) {
                 log("Compiling " + targetFile + " as it is newer than "
                     + generatedFile, Project.MSG_VERBOSE);
-            } else if (superGrammarIsOutOfDate) {
+            } else {
                 log("Compiling " + targetFile + " as " + superGrammar
                     + " is newer than " + generatedFile, Project.MSG_VERBOSE);
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java Sun
Apr  8 05:08:27 2007
@@ -417,7 +417,7 @@
                         }
                         classpathFileCache.put(dependency, classpathFileObject);
                     }
-                    if (classpathFileObject != null && classpathFileObject != nullFileMarker)
{
+                    if (classpathFileObject != nullFileMarker) {
                         // we need to add this jar to the list for this class.
                         File jarFile = (File) classpathFileObject;
                         dependencies.put(jarFile, jarFile);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
Sun Apr  8 05:08:27 2007
@@ -150,7 +150,7 @@
         //first the easy way, if all children are filesystem-only, return true:
         boolean goEarly = true;
         for (Iterator i = rc.iterator(); goEarly && i.hasNext();) {
-            goEarly &= ((ResourceCollection) i.next()).isFilesystemOnly();
+            goEarly = ((ResourceCollection) i.next()).isFilesystemOnly();
         }
         if (goEarly) {
             return true;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
Sun Apr  8 05:08:27 2007
@@ -158,13 +158,11 @@
         } catch (IOException ioe) {
             throw new BuildException("Could not read " + r.toLongString());
         } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (Exception e) {
-                    throw new BuildException("Could not close "
-                                             + r.toLongString());
-                }
+            try {
+                in.close();
+            } catch (Exception e) {
+                throw new BuildException("Could not close "
+                                         + r.toLongString());
             }
         }
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/ContainerMapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/ContainerMapper.java?view=diff&rev=526545&r1=526544&r2=526545
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/ContainerMapper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/ContainerMapper.java Sun Apr  8 05:08:27
2007
@@ -83,7 +83,7 @@
         boolean foundit = false;
         for (Iterator iter = mappers.iterator(); iter.hasNext() && !foundit;) {
             FileNameMapper next = (FileNameMapper) (iter.next());
-            foundit |= (next == fileNameMapper
+            foundit = (next == fileNameMapper
                 || (next instanceof ContainerMapper
                 && ((ContainerMapper) next).contains(fileNameMapper)));
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message