Code totally equivalent git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@526545 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1046,7 +1046,7 @@ public class ComponentHelper { | |||||
boolean found = false; | boolean found = false; | ||||
if (clazz instanceof Class) { | if (clazz instanceof Class) { | ||||
for (Iterator i = values().iterator(); i.hasNext() && !found;) { | for (Iterator i = values().iterator(); i.hasNext() && !found;) { | ||||
found |= (((AntTypeDefinition) (i.next())).getExposedClass( | |||||
found = (((AntTypeDefinition) (i.next())).getExposedClass( | |||||
project) == clazz); | project) == clazz); | ||||
} | } | ||||
} | } | ||||
@@ -821,9 +821,7 @@ public class Main implements AntMain { | |||||
handler = (InputHandler) ClasspathUtils.newInstance( | handler = (InputHandler) ClasspathUtils.newInstance( | ||||
inputHandlerClassname, Main.class.getClassLoader(), | inputHandlerClassname, Main.class.getClassLoader(), | ||||
InputHandler.class); | InputHandler.class); | ||||
if (project != null) { | |||||
project.setProjectReference(handler); | |||||
} | |||||
project.setProjectReference(handler); | |||||
} | } | ||||
project.setInputHandler(handler); | project.setInputHandler(handler); | ||||
} | } | ||||
@@ -105,7 +105,7 @@ public final class StripJavaComments | |||||
ch = in.read(); | ch = in.read(); | ||||
if (ch == '*') { | if (ch == '*') { | ||||
ch = in.read(); | ch = in.read(); | ||||
while (ch == '*' && ch != -1) { | |||||
while (ch == '*') { | |||||
ch = in.read(); | ch = in.read(); | ||||
} | } | ||||
@@ -1047,7 +1047,7 @@ public class Execute { | |||||
// Build the command | // Build the command | ||||
File commandDir = workingDir; | File commandDir = workingDir; | ||||
if (workingDir == null && project != null) { | |||||
if (workingDir == null) { | |||||
commandDir = project.getBaseDir(); | commandDir = project.getBaseDir(); | ||||
} | } | ||||
String[] newcmd = new String[cmd.length + 2]; | String[] newcmd = new String[cmd.length + 2]; | ||||
@@ -1106,7 +1106,7 @@ public class Execute { | |||||
// Build the command | // Build the command | ||||
File commandDir = workingDir; | File commandDir = workingDir; | ||||
if (workingDir == null && project != null) { | |||||
if (workingDir == null) { | |||||
commandDir = project.getBaseDir(); | commandDir = project.getBaseDir(); | ||||
} | } | ||||
String[] newcmd = new String[cmd.length + 3]; | String[] newcmd = new String[cmd.length + 3]; | ||||
@@ -571,7 +571,7 @@ public class Jar extends Zip { | |||||
long lastModified, File fromArchive, int mode) | long lastModified, File fromArchive, int mode) | ||||
throws IOException { | throws IOException { | ||||
if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { | if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { | ||||
if (!doubleFilePass || (doubleFilePass && skipWriting)) { | |||||
if (!doubleFilePass || skipWriting) { | |||||
filesetManifest(fromArchive, is); | filesetManifest(fromArchive, is); | ||||
} | } | ||||
} else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { | } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { | ||||
@@ -779,7 +779,7 @@ public class Jar extends Zip { | |||||
super.cleanUp(); | super.cleanUp(); | ||||
// we want to save this info if we are going to make another pass | // we want to save this info if we are going to make another pass | ||||
if (!doubleFilePass || (doubleFilePass && !skipWriting)) { | |||||
if (!doubleFilePass || !skipWriting) { | |||||
manifest = null; | manifest = null; | ||||
configuredManifest = savedConfiguredManifest; | configuredManifest = savedConfiguredManifest; | ||||
filesetManifest = null; | filesetManifest = null; | ||||
@@ -376,7 +376,7 @@ public class SignJar extends AbstractJarSignerTask { | |||||
//DO NOT SET THE -signedjar OPTION if source==dest | //DO NOT SET THE -signedjar OPTION if source==dest | ||||
//unless you like fielding hotspot crash reports | //unless you like fielding hotspot crash reports | ||||
if (null != targetFile && !jarSource.equals(targetFile)) { | |||||
if (!jarSource.equals(targetFile)) { | |||||
addValue(cmd, "-signedjar"); | addValue(cmd, "-signedjar"); | ||||
addValue(cmd, targetFile.getPath()); | addValue(cmd, targetFile.getPath()); | ||||
} | } | ||||
@@ -584,7 +584,7 @@ public class Tar extends MatchingTask { | |||||
Iterator iter = rc.iterator(); | Iterator iter = rc.iterator(); | ||||
while (upToDate && iter.hasNext()) { | while (upToDate && iter.hasNext()) { | ||||
Resource r = (Resource) iter.next(); | Resource r = (Resource) iter.next(); | ||||
upToDate &= archiveIsUpToDate(r); | |||||
upToDate = archiveIsUpToDate(r); | |||||
} | } | ||||
} | } | ||||
return upToDate; | return upToDate; | ||||
@@ -185,14 +185,12 @@ public class UpToDate extends Task implements Condition { | |||||
boolean upToDate = true; | boolean upToDate = true; | ||||
if (sourceFile != null) { | if (sourceFile != null) { | ||||
if (mapperElement == null) { | if (mapperElement == null) { | ||||
upToDate = upToDate | |||||
&& (targetFile.lastModified() >= sourceFile.lastModified()); | |||||
upToDate = targetFile.lastModified() >= sourceFile.lastModified(); | |||||
} else { | } else { | ||||
SourceFileScanner sfs = new SourceFileScanner(this); | SourceFileScanner sfs = new SourceFileScanner(this); | ||||
upToDate = upToDate | |||||
&& (sfs.restrict(new String[] {sourceFile.getAbsolutePath()}, | |||||
upToDate = sfs.restrict(new String[] {sourceFile.getAbsolutePath()}, | |||||
null, null, | null, null, | ||||
mapperElement.getImplementation()).length == 0); | |||||
mapperElement.getImplementation()).length == 0; | |||||
} | } | ||||
} | } | ||||
@@ -204,15 +202,14 @@ public class UpToDate extends Task implements Condition { | |||||
while (upToDate && e.hasMoreElements()) { | while (upToDate && e.hasMoreElements()) { | ||||
FileSet fs = (FileSet) e.nextElement(); | FileSet fs = (FileSet) e.nextElement(); | ||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | ||||
upToDate = upToDate && scanDir(fs.getDir(getProject()), | |||||
upToDate = scanDir(fs.getDir(getProject()), | |||||
ds.getIncludedFiles()); | ds.getIncludedFiles()); | ||||
} | } | ||||
if (upToDate) { | if (upToDate) { | ||||
Resource[] r = sourceResources.listResources(); | 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; | return upToDate; | ||||
@@ -111,7 +111,7 @@ public class IsSigned extends DataType implements Condition { | |||||
if (file == null) { | if (file == null) { | ||||
throw new BuildException("The file attribute must be set."); | throw new BuildException("The file attribute must be set."); | ||||
} | } | ||||
if (file != null && !file.exists()) { | |||||
if (!file.exists()) { | |||||
log("The file \"" + file.getAbsolutePath() | log("The file \"" + file.getAbsolutePath() | ||||
+ "\" does not exist.", Project.MSG_VERBOSE); | + "\" does not exist.", Project.MSG_VERBOSE); | ||||
return false; | return false; | ||||
@@ -92,15 +92,15 @@ public class CvsTagEntry { | |||||
public String toString() { | public String toString() { | ||||
StringBuffer buffer = new StringBuffer(); | StringBuffer buffer = new StringBuffer(); | ||||
buffer.append(filename); | buffer.append(filename); | ||||
if ((revision == null)) { | |||||
if (revision == null) { | |||||
buffer.append(" was removed"); | buffer.append(" was removed"); | ||||
if (prevRevision != null) { | if (prevRevision != null) { | ||||
buffer.append("; previous revision was ").append(prevRevision); | buffer.append("; previous revision was ").append(prevRevision); | ||||
} | } | ||||
} else if (revision != null && prevRevision == null) { | |||||
} else if (prevRevision == null) { | |||||
buffer.append(" is new; current revision is ") | buffer.append(" is new; current revision is ") | ||||
.append(revision); | .append(revision); | ||||
} else if (revision != null && prevRevision != null) { | |||||
} else { | |||||
buffer.append(" has changed from ") | buffer.append(" has changed from ") | ||||
.append(prevRevision).append(" to ").append(revision); | .append(prevRevision).append(" to ").append(revision); | ||||
} | } | ||||
@@ -290,7 +290,7 @@ public class ANTLR extends Task { | |||||
if (targetIsOutOfDate) { | if (targetIsOutOfDate) { | ||||
log("Compiling " + targetFile + " as it is newer than " | log("Compiling " + targetFile + " as it is newer than " | ||||
+ generatedFile, Project.MSG_VERBOSE); | + generatedFile, Project.MSG_VERBOSE); | ||||
} else if (superGrammarIsOutOfDate) { | |||||
} else { | |||||
log("Compiling " + targetFile + " as " + superGrammar | log("Compiling " + targetFile + " as " + superGrammar | ||||
+ " is newer than " + generatedFile, Project.MSG_VERBOSE); | + " is newer than " + generatedFile, Project.MSG_VERBOSE); | ||||
} | } | ||||
@@ -417,7 +417,7 @@ public class Depend extends MatchingTask { | |||||
} | } | ||||
classpathFileCache.put(dependency, classpathFileObject); | classpathFileCache.put(dependency, classpathFileObject); | ||||
} | } | ||||
if (classpathFileObject != null && classpathFileObject != nullFileMarker) { | |||||
if (classpathFileObject != nullFileMarker) { | |||||
// we need to add this jar to the list for this class. | // we need to add this jar to the list for this class. | ||||
File jarFile = (File) classpathFileObject; | File jarFile = (File) classpathFileObject; | ||||
dependencies.put(jarFile, jarFile); | dependencies.put(jarFile, jarFile); | ||||
@@ -150,7 +150,7 @@ public abstract class BaseResourceCollectionContainer | |||||
//first the easy way, if all children are filesystem-only, return true: | //first the easy way, if all children are filesystem-only, return true: | ||||
boolean goEarly = true; | boolean goEarly = true; | ||||
for (Iterator i = rc.iterator(); goEarly && i.hasNext();) { | for (Iterator i = rc.iterator(); goEarly && i.hasNext();) { | ||||
goEarly &= ((ResourceCollection) i.next()).isFilesystemOnly(); | |||||
goEarly = ((ResourceCollection) i.next()).isFilesystemOnly(); | |||||
} | } | ||||
if (goEarly) { | if (goEarly) { | ||||
return true; | return true; | ||||
@@ -158,13 +158,11 @@ public class ContainsRegexpSelector extends BaseExtendSelector | |||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
throw new BuildException("Could not read " + r.toLongString()); | throw new BuildException("Could not read " + r.toLongString()); | ||||
} finally { | } 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()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -83,7 +83,7 @@ public abstract class ContainerMapper implements FileNameMapper { | |||||
boolean foundit = false; | boolean foundit = false; | ||||
for (Iterator iter = mappers.iterator(); iter.hasNext() && !foundit;) { | for (Iterator iter = mappers.iterator(); iter.hasNext() && !foundit;) { | ||||
FileNameMapper next = (FileNameMapper) (iter.next()); | FileNameMapper next = (FileNameMapper) (iter.next()); | ||||
foundit |= (next == fileNameMapper | |||||
foundit = (next == fileNameMapper | |||||
|| (next instanceof ContainerMapper | || (next instanceof ContainerMapper | ||||
&& ((ContainerMapper) next).contains(fileNameMapper))); | && ((ContainerMapper) next).contains(fileNameMapper))); | ||||
} | } | ||||