diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java
index 88a81c498..f2ce34d1e 100644
--- a/src/main/org/apache/tools/ant/AntClassLoader.java
+++ b/src/main/org/apache/tools/ant/AntClassLoader.java
@@ -119,7 +119,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
* @return true if there are more elements in the
* enumeration; false otherwise.
*/
- @Override
public boolean hasMoreElements() {
return (this.nextResource != null);
}
@@ -129,7 +128,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @return the next resource in the enumeration
*/
- @Override
public URL nextElement() {
final URL ret = this.nextResource;
if (ret == null) {
@@ -1445,7 +1443,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the buildStarted event
*/
- @Override
public void buildStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1456,7 +1453,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the buildFinished event
*/
- @Override
public void buildFinished(final BuildEvent event) {
cleanup();
}
@@ -1470,7 +1466,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @since Ant 1.6.2
*/
- @Override
public void subBuildFinished(final BuildEvent event) {
if (event.getProject() == project) {
cleanup();
@@ -1484,7 +1479,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @since Ant 1.6.2
*/
- @Override
public void subBuildStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1494,7 +1488,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the targetStarted event
*/
- @Override
public void targetStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1504,7 +1497,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the targetFinished event
*/
- @Override
public void targetFinished(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1514,7 +1506,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the taskStarted event
*/
- @Override
public void taskStarted(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1524,7 +1515,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the taskFinished event
*/
- @Override
public void taskFinished(final BuildEvent event) {
// Not significant for the class loader.
}
@@ -1534,7 +1524,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener {
*
* @param event the messageLogged event
*/
- @Override
public void messageLogged(final BuildEvent event) {
// Not significant for the class loader.
}
diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java
index cf93eb7c3..3565c834e 100644
--- a/src/main/org/apache/tools/ant/DirectoryScanner.java
+++ b/src/main/org/apache/tools/ant/DirectoryScanner.java
@@ -310,7 +310,7 @@ public class DirectoryScanner
*
* @since Ant 1.6
*/
- private Set scannedDirs = new HashSet();
+ private final Set scannedDirs = new HashSet();
/**
* Map of all include patterns that are full file names and don't
@@ -327,7 +327,7 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- private Map includeNonPatterns = new HashMap();
+ private final Map includeNonPatterns = new HashMap();
/**
* Map of all exclude patterns that are full file names and don't
@@ -344,7 +344,7 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- private Map excludeNonPatterns = new HashMap();
+ private final Map excludeNonPatterns = new HashMap();
/**
* Array of all include patterns that contain wildcards.
@@ -384,7 +384,7 @@ public class DirectoryScanner
*
* @since Ant 1.6.3
*/
- private Object scanLock = new Object();
+ private final Object scanLock = new Object();
/**
* Slow scanning flag.
@@ -398,7 +398,7 @@ public class DirectoryScanner
*
* @since Ant 1.6.3
*/
- private Object slowScanLock = new Object();
+ private final Object slowScanLock = new Object();
/**
* Exception thrown during scan.
@@ -423,7 +423,7 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- private Set notFollowedSymlinks = new HashSet();
+ private final Set notFollowedSymlinks = new HashSet();
/**
* Sole constructor.
@@ -447,7 +447,7 @@ public class DirectoryScanner
* @return whether or not a given path matches the start of a given
* pattern up to the first "**".
*/
- protected static boolean matchPatternStart(String pattern, String str) {
+ protected static boolean matchPatternStart(final String pattern, final String str) {
return SelectorUtils.matchPatternStart(pattern, str);
}
@@ -469,8 +469,8 @@ public class DirectoryScanner
* @return whether or not a given path matches the start of a given
* pattern up to the first "**".
*/
- protected static boolean matchPatternStart(String pattern, String str,
- boolean isCaseSensitive) {
+ protected static boolean matchPatternStart(final String pattern, final String str,
+ final boolean isCaseSensitive) {
return SelectorUtils.matchPatternStart(pattern, str, isCaseSensitive);
}
@@ -485,7 +485,7 @@ public class DirectoryScanner
* @return true if the pattern matches against the string,
* or false otherwise.
*/
- protected static boolean matchPath(String pattern, String str) {
+ protected static boolean matchPath(final String pattern, final String str) {
return SelectorUtils.matchPath(pattern, str);
}
@@ -502,8 +502,8 @@ public class DirectoryScanner
* @return true if the pattern matches against the string,
* or false otherwise.
*/
- protected static boolean matchPath(String pattern, String str,
- boolean isCaseSensitive) {
+ protected static boolean matchPath(final String pattern, final String str,
+ final boolean isCaseSensitive) {
return SelectorUtils.matchPath(pattern, str, isCaseSensitive);
}
@@ -521,7 +521,7 @@ public class DirectoryScanner
* @return true if the string matches against the pattern,
* or false otherwise.
*/
- public static boolean match(String pattern, String str) {
+ public static boolean match(final String pattern, final String str) {
return SelectorUtils.match(pattern, str);
}
@@ -542,8 +542,8 @@ public class DirectoryScanner
* @return true if the string matches against the pattern,
* or false otherwise.
*/
- protected static boolean match(String pattern, String str,
- boolean isCaseSensitive) {
+ protected static boolean match(final String pattern, final String str,
+ final boolean isCaseSensitive) {
return SelectorUtils.match(pattern, str, isCaseSensitive);
}
@@ -574,7 +574,7 @@ public class DirectoryScanner
*
* @since Ant 1.6
*/
- public static boolean addDefaultExclude(String s) {
+ public static boolean addDefaultExclude(final String s) {
synchronized (defaultExcludes) {
return defaultExcludes.add(s);
}
@@ -591,7 +591,7 @@ public class DirectoryScanner
*
* @since Ant 1.6
*/
- public static boolean removeDefaultExclude(String s) {
+ public static boolean removeDefaultExclude(final String s) {
synchronized (defaultExcludes) {
return defaultExcludes.remove(s);
}
@@ -619,8 +619,7 @@ public class DirectoryScanner
*
* @param basedir The base directory to scan.
*/
- @Override
- public void setBasedir(String basedir) {
+ public void setBasedir(final String basedir) {
setBasedir(basedir == null ? (File) null
: new File(basedir.replace('/', File.separatorChar).replace(
'\\', File.separatorChar)));
@@ -632,8 +631,7 @@ public class DirectoryScanner
*
* @param basedir The base directory for scanning.
*/
- @Override
- public synchronized void setBasedir(File basedir) {
+ public synchronized void setBasedir(final File basedir) {
this.basedir = basedir;
}
@@ -643,7 +641,6 @@ public class DirectoryScanner
*
* @return the base directory to be scanned.
*/
- @Override
public synchronized File getBasedir() {
return basedir;
}
@@ -665,8 +662,7 @@ public class DirectoryScanner
* @param isCaseSensitive whether or not the file system should be
* regarded as a case sensitive one.
*/
- @Override
- public synchronized void setCaseSensitive(boolean isCaseSensitive) {
+ public synchronized void setCaseSensitive(final boolean isCaseSensitive) {
this.isCaseSensitive = isCaseSensitive;
}
@@ -677,7 +673,7 @@ public class DirectoryScanner
* is an error
* @since Ant 1.7.1
*/
- public void setErrorOnMissingDir(boolean errorOnMissingDir) {
+ public void setErrorOnMissingDir(final boolean errorOnMissingDir) {
this.errorOnMissingDir = errorOnMissingDir;
}
@@ -697,7 +693,7 @@ public class DirectoryScanner
*
* @param followSymlinks whether or not symbolic links should be followed.
*/
- public synchronized void setFollowSymlinks(boolean followSymlinks) {
+ public synchronized void setFollowSymlinks(final boolean followSymlinks) {
this.followSymlinks = followSymlinks;
}
@@ -707,7 +703,7 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- public void setMaxLevelsOfSymlinks(int max) {
+ public void setMaxLevelsOfSymlinks(final int max) {
maxLevelsOfSymlinks = max;
}
@@ -724,8 +720,7 @@ public class DirectoryScanner
* list is given, all elements must be
* non-null.
*/
- @Override
- public synchronized void setIncludes(String[] includes) {
+ public synchronized void setIncludes(final String[] includes) {
if (includes == null) {
this.includes = null;
} else {
@@ -748,8 +743,7 @@ public class DirectoryScanner
* should be excluded. If a non-null list is
* given, all elements must be non-null.
*/
- @Override
- public synchronized void setExcludes(String[] excludes) {
+ public synchronized void setExcludes(final String[] excludes) {
if (excludes == null) {
this.excludes = null;
} else {
@@ -773,10 +767,10 @@ public class DirectoryScanner
*
* @since Ant 1.6.3
*/
- public synchronized void addExcludes(String[] excludes) {
+ public synchronized void addExcludes(final String[] excludes) {
if (excludes != null && excludes.length > 0) {
if (this.excludes != null && this.excludes.length > 0) {
- String[] tmp = new String[excludes.length
+ final String[] tmp = new String[excludes.length
+ this.excludes.length];
System.arraycopy(this.excludes, 0, tmp, 0,
this.excludes.length);
@@ -800,7 +794,7 @@ public class DirectoryScanner
*
* @since Ant 1.6.3
*/
- private static String normalizePattern(String p) {
+ private static String normalizePattern(final String p) {
String pattern = p.replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
if (pattern.endsWith(File.separator)) {
@@ -814,8 +808,7 @@ public class DirectoryScanner
*
* @param selectors specifies the selectors to be invoked on a scan.
*/
- @Override
- public synchronized void setSelectors(FileSelector[] selectors) {
+ public synchronized void setSelectors(final FileSelector[] selectors) {
this.selectors = selectors;
}
@@ -840,14 +833,13 @@ public class DirectoryScanner
* @exception IllegalStateException if the base directory was set
* incorrectly (i.e. if it doesn't exist or isn't a directory).
*/
- @Override
public void scan() throws IllegalStateException {
synchronized (scanLock) {
if (scanning) {
while (scanning) {
try {
scanLock.wait();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
continue;
}
}
@@ -858,17 +850,17 @@ public class DirectoryScanner
}
scanning = true;
}
- File savedBase = basedir;
+ final File savedBase = basedir;
try {
synchronized (this) {
illegal = null;
clearResults();
// set in/excludes to reasonable defaults if needed:
- boolean nullIncludes = (includes == null);
+ final boolean nullIncludes = (includes == null);
includes = nullIncludes
? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes;
- boolean nullExcludes = (excludes == null);
+ final boolean nullExcludes = (excludes == null);
excludes = nullExcludes ? new String[0] : excludes;
if (basedir != null && !followSymlinks
@@ -920,7 +912,7 @@ public class DirectoryScanner
includes = nullIncludes ? null : includes;
excludes = nullExcludes ? null : excludes;
}
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new BuildException(ex);
} finally {
basedir = savedBase;
@@ -938,19 +930,19 @@ public class DirectoryScanner
*/
private void checkIncludePatterns() {
ensureNonPatternSetsReady();
- Map newroots = new HashMap();
+ final Map newroots = new HashMap();
// put in the newroots map the include patterns without
// wildcard tokens
for (int i = 0; i < includePatterns.length; i++) {
- String pattern = includePatterns[i].toString();
+ final String pattern = includePatterns[i].toString();
if (!shouldSkipPattern(pattern)) {
newroots.put(includePatterns[i].rtrimWildcardTokens(),
pattern);
}
}
- for (Map.Entry entry : includeNonPatterns.entrySet()) {
- String pattern = entry.getKey();
+ for (final Map.Entry entry : includeNonPatterns.entrySet()) {
+ final String pattern = entry.getKey();
if (!shouldSkipPattern(pattern)) {
newroots.put(entry.getValue(), pattern);
}
@@ -965,13 +957,13 @@ public class DirectoryScanner
if (basedir != null) {
try {
canonBase = basedir.getCanonicalFile();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new BuildException(ex);
}
}
// only scan directories that can include matched files or
// directories
- for (Map.Entry entry : newroots.entrySet()) {
+ for (final Map.Entry entry : newroots.entrySet()) {
TokenizedPath currentPath = entry.getKey();
String currentelement = currentPath.toString();
if (basedir == null
@@ -985,7 +977,7 @@ public class DirectoryScanner
// the results to show what's really on the disk, so
// we need to double check.
try {
- String path = (basedir == null)
+ final String path = (basedir == null)
? myfile.getCanonicalPath()
: FILE_UTILS.removeLeadingPath(canonBase,
myfile.getCanonicalFile());
@@ -1001,13 +993,13 @@ public class DirectoryScanner
}
}
}
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new BuildException(ex);
}
}
if ((myfile == null || !myfile.exists()) && !isCaseSensitive()) {
- File f = currentPath.findFile(basedir, false);
+ final File f = currentPath.findFile(basedir, false);
if (f != null && f.exists()) {
// adapt currentelement to the case we've
// actually found
@@ -1032,8 +1024,8 @@ public class DirectoryScanner
scandir(myfile, currentPath, true);
}
} else if (myfile.isFile()) {
- String originalpattern = entry.getValue();
- boolean included = isCaseSensitive()
+ final String originalpattern = entry.getValue();
+ final boolean included = isCaseSensitive()
? originalpattern.equals(currentelement)
: originalpattern.equalsIgnoreCase(currentelement);
if (included) {
@@ -1051,7 +1043,7 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- private boolean shouldSkipPattern(String pattern) {
+ private boolean shouldSkipPattern(final String pattern) {
if (FileUtils.isAbsolutePath(pattern)) {
//skip abs. paths not under basedir, if set:
if (basedir != null
@@ -1101,7 +1093,7 @@ public class DirectoryScanner
while (slowScanning) {
try {
slowScanLock.wait();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
// Empty
}
}
@@ -1113,16 +1105,16 @@ public class DirectoryScanner
synchronized (this) {
// set in/excludes to reasonable defaults if needed:
- boolean nullIncludes = (includes == null);
+ final boolean nullIncludes = (includes == null);
includes = nullIncludes
? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes;
- boolean nullExcludes = (excludes == null);
+ final boolean nullExcludes = (excludes == null);
excludes = nullExcludes ? new String[0] : excludes;
- String[] excl = new String[dirsExcluded.size()];
+ final String[] excl = new String[dirsExcluded.size()];
dirsExcluded.copyInto(excl);
- String[] notIncl = new String[dirsNotIncluded.size()];
+ final String[] notIncl = new String[dirsNotIncluded.size()];
dirsNotIncluded.copyInto(notIncl);
ensureNonPatternSetsReady();
@@ -1142,9 +1134,9 @@ public class DirectoryScanner
}
}
- private void processSlowScan(String[] arr) {
+ private void processSlowScan(final String[] arr) {
for (int i = 0; i < arr.length; i++) {
- TokenizedPath path = new TokenizedPath(arr[i]);
+ final TokenizedPath path = new TokenizedPath(arr[i]);
if (!couldHoldIncluded(path) || contentsExcluded(path)) {
scandir(new File(basedir, arr[i]), path, false);
}
@@ -1171,7 +1163,7 @@ public class DirectoryScanner
* @see #dirsExcluded
* @see #slowScan
*/
- protected void scandir(File dir, String vpath, boolean fast) {
+ protected void scandir(final File dir, final String vpath, final boolean fast) {
scandir(dir, new TokenizedPath(vpath), fast);
}
@@ -1195,11 +1187,11 @@ public class DirectoryScanner
* @see #dirsExcluded
* @see #slowScan
*/
- private void scandir(File dir, TokenizedPath path, boolean fast) {
+ private void scandir(final File dir, final TokenizedPath path, final boolean fast) {
if (dir == null) {
throw new BuildException("dir must not be null.");
}
- String[] newfiles = dir.list();
+ final String[] newfiles = dir.list();
if (newfiles == null) {
if (!dir.exists()) {
throw new BuildException(dir + DOES_NOT_EXIST_POSTFIX);
@@ -1213,8 +1205,8 @@ public class DirectoryScanner
scandir(dir, path, fast, newfiles, new LinkedList());
}
- private void scandir(File dir, TokenizedPath path, boolean fast,
- String[] newfiles, LinkedList directoryNamesFollowed) {
+ private void scandir(final File dir, final TokenizedPath path, final boolean fast,
+ String[] newfiles, final LinkedList directoryNamesFollowed) {
String vpath = path.toString();
if (vpath.length() > 0 && !vpath.endsWith(File.separator)) {
vpath += File.separator;
@@ -1225,12 +1217,12 @@ public class DirectoryScanner
return;
}
if (!followSymlinks) {
- ArrayList noLinks = new ArrayList();
+ final ArrayList noLinks = new ArrayList();
for (int i = 0; i < newfiles.length; i++) {
try {
if (SYMLINK_UTILS.isSymbolicLink(dir, newfiles[i])) {
- String name = vpath + newfiles[i];
- File file = new File(dir, newfiles[i]);
+ final String name = vpath + newfiles[i];
+ final File file = new File(dir, newfiles[i]);
if (file.isDirectory()) {
dirsExcluded.addElement(name);
} else if (file.isFile()) {
@@ -1240,8 +1232,8 @@ public class DirectoryScanner
} else {
noLinks.add(newfiles[i]);
}
- } catch (IOException ioe) {
- String msg = "IOException caught while checking "
+ } catch (final IOException ioe) {
+ final String msg = "IOException caught while checking "
+ "for links, couldn't get canonical path!";
// will be caught and redirected to Ant's logging system
System.err.println(msg);
@@ -1254,10 +1246,10 @@ public class DirectoryScanner
}
for (int i = 0; i < newfiles.length; i++) {
- String name = vpath + newfiles[i];
- TokenizedPath newPath = new TokenizedPath(path, newfiles[i]);
- File file = new File(dir, newfiles[i]);
- String[] children = file.list();
+ final String name = vpath + newfiles[i];
+ final TokenizedPath newPath = new TokenizedPath(path, newfiles[i]);
+ final File file = new File(dir, newfiles[i]);
+ final String[] children = file.list();
if (children == null || (children.length == 0 && file.isFile())) {
if (isIncluded(newPath)) {
accountForIncludedFile(newPath, file);
@@ -1307,7 +1299,7 @@ public class DirectoryScanner
* @param name path of the file relative to the directory of the FileSet.
* @param file included File.
*/
- private void accountForIncludedFile(TokenizedPath name, File file) {
+ private void accountForIncludedFile(final TokenizedPath name, final File file) {
processIncluded(name, file, filesIncluded, filesExcluded,
filesDeselected);
}
@@ -1319,29 +1311,29 @@ public class DirectoryScanner
* @param file directory as File.
* @param fast whether to perform fast scans.
*/
- private void accountForIncludedDir(TokenizedPath name, File file,
- boolean fast) {
+ private void accountForIncludedDir(final TokenizedPath name, final File file,
+ final boolean fast) {
processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected);
if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) {
scandir(file, name, fast);
}
}
- private void accountForIncludedDir(TokenizedPath name,
- File file, boolean fast,
- String[] children,
- LinkedList directoryNamesFollowed) {
+ private void accountForIncludedDir(final TokenizedPath name,
+ final File file, final boolean fast,
+ final String[] children,
+ final LinkedList directoryNamesFollowed) {
processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected);
if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) {
scandir(file, name, fast, children, directoryNamesFollowed);
}
}
- private void accountForNotFollowedSymlink(String name, File file) {
+ private void accountForNotFollowedSymlink(final String name, final File file) {
accountForNotFollowedSymlink(new TokenizedPath(name), file);
}
- private void accountForNotFollowedSymlink(TokenizedPath name, File file) {
+ private void accountForNotFollowedSymlink(final TokenizedPath name, final File file) {
if (!isExcluded(name) &&
(isIncluded(name)
|| (file.isDirectory() && couldHoldIncluded(name)
@@ -1350,10 +1342,10 @@ public class DirectoryScanner
}
}
- private void processIncluded(TokenizedPath path,
- File file, Vector inc, Vector exc,
- Vector des) {
- String name = path.toString();
+ private void processIncluded(final TokenizedPath path,
+ final File file, final Vector inc, final Vector exc,
+ final Vector des) {
+ final String name = path.toString();
if (inc.contains(name) || exc.contains(name) || des.contains(name)) {
return;
}
@@ -1378,7 +1370,7 @@ public class DirectoryScanner
* @return true when the name matches against at least one
* include pattern, or false otherwise.
*/
- protected boolean isIncluded(String name) {
+ protected boolean isIncluded(final String name) {
return isIncluded(new TokenizedPath(name));
}
@@ -1390,7 +1382,7 @@ public class DirectoryScanner
* @return true when the name matches against at least one
* include pattern, or false otherwise.
*/
- private boolean isIncluded(TokenizedPath path) {
+ private boolean isIncluded(final TokenizedPath path) {
ensureNonPatternSetsReady();
if (isCaseSensitive()
@@ -1414,7 +1406,7 @@ public class DirectoryScanner
* @return true when the name matches against the start of at
* least one include pattern, or false otherwise.
*/
- protected boolean couldHoldIncluded(String name) {
+ protected boolean couldHoldIncluded(final String name) {
return couldHoldIncluded(new TokenizedPath(name));
}
@@ -1426,13 +1418,13 @@ public class DirectoryScanner
* @return true when the name matches against the start of at
* least one include pattern, or false otherwise.
*/
- private boolean couldHoldIncluded(TokenizedPath tokenizedName) {
+ private boolean couldHoldIncluded(final TokenizedPath tokenizedName) {
for (int i = 0; i < includePatterns.length; i++) {
if (couldHoldIncluded(tokenizedName, includePatterns[i])) {
return true;
}
}
- for (Iterator iter = includeNonPatterns.values().iterator();
+ for (final Iterator iter = includeNonPatterns.values().iterator();
iter.hasNext();) {
if (couldHoldIncluded(tokenizedName,
iter.next().toPattern())) {
@@ -1450,8 +1442,8 @@ public class DirectoryScanner
* @return true when the name matches against the start of the
* include pattern, or false otherwise.
*/
- private boolean couldHoldIncluded(TokenizedPath tokenizedName,
- TokenizedPattern tokenizedInclude) {
+ private boolean couldHoldIncluded(final TokenizedPath tokenizedName,
+ final TokenizedPattern tokenizedInclude) {
return tokenizedInclude.matchStartOf(tokenizedName, isCaseSensitive())
&& isMorePowerfulThanExcludes(tokenizedName.toString())
&& isDeeper(tokenizedInclude, tokenizedName);
@@ -1465,7 +1457,7 @@ public class DirectoryScanner
* @return whether the pattern is deeper than the name.
* @since Ant 1.6.3
*/
- private boolean isDeeper(TokenizedPattern pattern, TokenizedPath name) {
+ private boolean isDeeper(final TokenizedPattern pattern, final TokenizedPath name) {
return pattern.containsPattern(SelectorUtils.DEEP_TREE_MATCH)
|| pattern.depth() > name.depth();
}
@@ -1486,7 +1478,7 @@ public class DirectoryScanner
* this include pattern.
* @since Ant 1.6
*/
- private boolean isMorePowerfulThanExcludes(String name) {
+ private boolean isMorePowerfulThanExcludes(final String name) {
final String soughtexclude =
name + File.separatorChar + SelectorUtils.DEEP_TREE_MATCH;
for (int counter = 0; counter < excludePatterns.length; counter++) {
@@ -1502,7 +1494,7 @@ public class DirectoryScanner
* @param path the path to check.
* @return whether all the specified directory's contents are excluded.
*/
- /* package */ boolean contentsExcluded(TokenizedPath path) {
+ /* package */ boolean contentsExcluded(final TokenizedPath path) {
for (int i = 0; i < excludePatterns.length; i++) {
if (excludePatterns[i].endsWith(SelectorUtils.DEEP_TREE_MATCH)
&& excludePatterns[i].withoutLastToken()
@@ -1521,7 +1513,7 @@ public class DirectoryScanner
* @return true when the name matches against at least one
* exclude pattern, or false otherwise.
*/
- protected boolean isExcluded(String name) {
+ protected boolean isExcluded(final String name) {
return isExcluded(new TokenizedPath(name));
}
@@ -1533,7 +1525,7 @@ public class DirectoryScanner
* @return true when the name matches against at least one
* exclude pattern, or false otherwise.
*/
- private boolean isExcluded(TokenizedPath name) {
+ private boolean isExcluded(final TokenizedPath name) {
ensureNonPatternSetsReady();
if (isCaseSensitive()
@@ -1557,7 +1549,7 @@ public class DirectoryScanner
* @return false when the selectors says that the file
* should not be selected, true otherwise.
*/
- protected boolean isSelected(String name, File file) {
+ protected boolean isSelected(final String name, final File file) {
if (selectors != null) {
for (int i = 0; i < selectors.length; i++) {
if (!selectors[i].isSelected(basedir, name, file)) {
@@ -1576,7 +1568,6 @@ public class DirectoryScanner
* @return the names of the files which matched at least one of the
* include patterns and none of the exclude patterns.
*/
- @Override
public String[] getIncludedFiles() {
String[] files;
synchronized (this) {
@@ -1612,10 +1603,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getNotIncludedFiles() {
slowScan();
- String[] files = new String[filesNotIncluded.size()];
+ final String[] files = new String[filesNotIncluded.size()];
filesNotIncluded.copyInto(files);
return files;
}
@@ -1631,10 +1621,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getExcludedFiles() {
slowScan();
- String[] files = new String[filesExcluded.size()];
+ final String[] files = new String[filesExcluded.size()];
filesExcluded.copyInto(files);
return files;
}
@@ -1650,10 +1639,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getDeselectedFiles() {
slowScan();
- String[] files = new String[filesDeselected.size()];
+ final String[] files = new String[filesDeselected.size()];
filesDeselected.copyInto(files);
return files;
}
@@ -1666,7 +1654,6 @@ public class DirectoryScanner
* @return the names of the directories which matched at least one of the
* include patterns and none of the exclude patterns.
*/
- @Override
public String[] getIncludedDirectories() {
String[] directories;
synchronized (this) {
@@ -1702,10 +1689,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getNotIncludedDirectories() {
slowScan();
- String[] directories = new String[dirsNotIncluded.size()];
+ final String[] directories = new String[dirsNotIncluded.size()];
dirsNotIncluded.copyInto(directories);
return directories;
}
@@ -1721,10 +1707,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getExcludedDirectories() {
slowScan();
- String[] directories = new String[dirsExcluded.size()];
+ final String[] directories = new String[dirsExcluded.size()];
dirsExcluded.copyInto(directories);
return directories;
}
@@ -1740,10 +1725,9 @@ public class DirectoryScanner
*
* @see #slowScan
*/
- @Override
public synchronized String[] getDeselectedDirectories() {
slowScan();
- String[] directories = new String[dirsDeselected.size()];
+ final String[] directories = new String[dirsDeselected.size()];
dirsDeselected.copyInto(directories);
return directories;
}
@@ -1770,11 +1754,10 @@ public class DirectoryScanner
/**
* Add default exclusions to the current exclusions set.
*/
- @Override
public synchronized void addDefaultExcludes() {
- int excludesLength = excludes == null ? 0 : excludes.length;
+ final int excludesLength = excludes == null ? 0 : excludes.length;
String[] newExcludes;
- String[] defaultExcludesTemp = getDefaultExcludes();
+ final String[] defaultExcludesTemp = getDefaultExcludes();
newExcludes = new String[excludesLength + defaultExcludesTemp.length];
if (excludesLength > 0) {
System.arraycopy(excludes, 0, newExcludes, 0, excludesLength);
@@ -1794,8 +1777,7 @@ public class DirectoryScanner
* @return the resource with the given name.
* @since Ant 1.5.2
*/
- @Override
- public synchronized Resource getResource(String name) {
+ public synchronized Resource getResource(final String name) {
return new FileResource(basedir, name);
}
@@ -1807,7 +1789,7 @@ public class DirectoryScanner
*
* @since Ant 1.6
*/
- private boolean hasBeenScanned(String vpath) {
+ private boolean hasBeenScanned(final String vpath) {
return !scannedDirs.add(vpath);
}
@@ -1855,11 +1837,11 @@ public class DirectoryScanner
* @param patterns String[] of patterns.
* @since Ant 1.8.0
*/
- private TokenizedPattern[] fillNonPatternSet(Map map, String[] patterns) {
- ArrayList al = new ArrayList(patterns.length);
+ private TokenizedPattern[] fillNonPatternSet(final Map map, final String[] patterns) {
+ final ArrayList al = new ArrayList(patterns.length);
for (int i = 0; i < patterns.length; i++) {
if (!SelectorUtils.hasWildcards(patterns[i])) {
- String s = isCaseSensitive()
+ final String s = isCaseSensitive()
? patterns[i] : patterns[i].toUpperCase();
map.put(s, new TokenizedPath(s));
} else {
@@ -1880,21 +1862,21 @@ public class DirectoryScanner
*
* @since Ant 1.8.0
*/
- private boolean causesIllegalSymlinkLoop(String dirName, File parent,
- LinkedList directoryNamesFollowed) {
+ private boolean causesIllegalSymlinkLoop(final String dirName, final File parent,
+ final LinkedList directoryNamesFollowed) {
try {
if (directoryNamesFollowed.size() >= maxLevelsOfSymlinks
&& CollectionUtils.frequency(directoryNamesFollowed, dirName)
>= maxLevelsOfSymlinks
&& SYMLINK_UTILS.isSymbolicLink(parent, dirName)) {
- ArrayList files = new ArrayList();
+ final ArrayList files = new ArrayList();
File f = FILE_UTILS.resolveFile(parent, dirName);
- String target = f.getCanonicalPath();
+ final String target = f.getCanonicalPath();
files.add(target);
String relPath = "";
- for (String dir : directoryNamesFollowed) {
+ for (final String dir : directoryNamesFollowed) {
relPath += "../";
if (dirName.equals(dir)) {
f = FILE_UTILS.resolveFile(parent, relPath + dir);
@@ -1909,7 +1891,7 @@ public class DirectoryScanner
}
return false;
- } catch (IOException ex) {
+ } catch (final IOException ex) {
throw new BuildException("Caught error while checking for"
+ " symbolic links", ex);
}
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 6cf4718a9..845317681 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -157,7 +157,6 @@ public class Main implements AntMain {
private final Map, List> extraArguments = new HashMap, List>();
private static final GetProperty NOPROPERTIES = new GetProperty() {
- @Override
public Object getProperty(final String aName) {
// No existing property takes precedence
return null;
@@ -208,7 +207,6 @@ public class Main implements AntMain {
*
* @since Ant 1.6
*/
- @Override
public void startAnt(final String[] args, final Properties additionalUserProperties,
final ClassLoader coreLoader) {
diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java
index 02b23c95d..0412efa70 100644
--- a/src/main/org/apache/tools/ant/Project.java
+++ b/src/main/org/apache/tools/ant/Project.java
@@ -2487,7 +2487,6 @@ public class Project implements ResourceFactory {
* @return the file resource.
* @since Ant 1.7
*/
- @Override
public Resource getResource(final String name) {
return new FileResource(getBaseDir(), name);
}
diff --git a/src/main/org/apache/tools/ant/filters/ConcatFilter.java b/src/main/org/apache/tools/ant/filters/ConcatFilter.java
index a28edbfef..593e74a80 100644
--- a/src/main/org/apache/tools/ant/filters/ConcatFilter.java
+++ b/src/main/org/apache/tools/ant/filters/ConcatFilter.java
@@ -171,9 +171,8 @@ public final class ConcatFilter extends BaseParamFilterReader
* @return a new filter based on this configuration, but filtering
* the specified reader
*/
- @Override
public Reader chain(final Reader rdr) {
- ConcatFilter newFilter = new ConcatFilter(rdr);
+ final ConcatFilter newFilter = new ConcatFilter(rdr);
newFilter.setPrepend(getPrepend());
newFilter.setAppend(getAppend());
// Usually the initialized is set to true. But here it must not.
@@ -190,7 +189,7 @@ public final class ConcatFilter extends BaseParamFilterReader
*/
private void initialize() throws IOException {
// get parameters
- Parameter[] params = getParameters();
+ final Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if ("prepend".equals(params[i].getName())) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
index f5677d898..db7d916c0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -182,12 +182,10 @@ public class AntStructure extends Task {
private final Hashtable visited = new Hashtable();
- @Override
public void printTail(final PrintWriter out) {
visited.clear();
}
- @Override
public void printHead(final PrintWriter out, final Project p, final Hashtable> tasks,
final Hashtable> types) {
printHead(out, tasks.keys(), types.keys());
@@ -246,7 +244,6 @@ public class AntStructure extends Task {
/**
* Prints the definition for the target element.
*/
- @Override
public void printTargetDecl(final PrintWriter out) {
out.print(" element) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java
index 7fdfaf2f4..191b9e31c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copy.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java
@@ -823,16 +823,16 @@ public class Copy extends Task {
toCopy = new Resource[v.size()];
v.copyInto(toCopy);
} else {
- toCopy =
- ResourceUtils.selectOutOfDateSources(this, fromResources,
- mapper,
- new ResourceFactory() {
- @Override
+ toCopy = ResourceUtils.selectOutOfDateSources(
+ this,
+ fromResources,
+ mapper,
+ new ResourceFactory() {
public Resource getResource(final String name) {
- return new FileResource(toDir, name);
- }
- },
- granularity);
+ return new FileResource(toDir, name);
+ }
+ },
+ granularity);
}
for (int i = 0; i < toCopy.length; i++) {
final String[] mappedFiles = mapper.mapFileName(toCopy[i].getName());
diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java
index de0792170..0577d515f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Get.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Get.java
@@ -71,7 +71,7 @@ public class Get extends Task {
private static final String DEFAULT_AGENT_PREFIX = "Apache Ant";
private static final String GZIP_CONTENT_ENCODING = "gzip";
- private Resources sources = new Resources();
+ private final Resources sources = new Resources();
private File destination; // required
private boolean verbose = false;
private boolean quiet = false;
@@ -98,9 +98,9 @@ public class Get extends Task {
public void execute() throws BuildException {
checkAttributes();
- for (Resource r : sources) {
- URLProvider up = r.as(URLProvider.class);
- URL source = up.getURL();
+ for (final Resource r : sources) {
+ final URLProvider up = r.as(URLProvider.class);
+ final URL source = up.getURL();
File dest = destination;
if (destination.isDirectory()) {
@@ -109,14 +109,14 @@ public class Get extends Task {
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
- int slash = path.lastIndexOf("/");
+ final int slash = path.lastIndexOf("/");
if (slash > -1) {
path = path.substring(slash + 1);
}
dest = new File(destination, path);
} else {
- FileNameMapper mapper = mapperElement.getImplementation();
- String[] d = mapper.mapFileName(source.toString());
+ final FileNameMapper mapper = mapperElement.getImplementation();
+ final String[] d = mapper.mapFileName(source.toString());
if (d == null) {
log("skipping " + r + " - mapper can't handle it",
Project.MSG_WARN);
@@ -135,7 +135,7 @@ public class Get extends Task {
}
//set up logging
- int logLevel = Project.MSG_INFO;
+ final int logLevel = Project.MSG_INFO;
DownloadProgress progress = null;
if (verbose) {
progress = new VerboseProgress(System.out);
@@ -144,7 +144,7 @@ public class Get extends Task {
//execute the get
try {
doGet(source, dest, logLevel, progress);
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
log("Error getting " + source + " to " + dest);
if (!ignoreErrors) {
throw new BuildException(ioe, getLocation());
@@ -168,12 +168,12 @@ public class Get extends Task {
* @deprecated only gets the first configured resource
*/
@Deprecated
- public boolean doGet(int logLevel, DownloadProgress progress)
+ public boolean doGet(final int logLevel, final DownloadProgress progress)
throws IOException {
checkAttributes();
- for (Resource r : sources) {
- URLProvider up = r.as(URLProvider.class);
- URL source = up.getURL();
+ for (final Resource r : sources) {
+ final URLProvider up = r.as(URLProvider.class);
+ final URL source = up.getURL();
return doGet(source, destination, logLevel, progress);
}
/*NOTREACHED*/
@@ -197,7 +197,7 @@ public class Get extends Task {
* is false.
* @since Ant 1.8.0
*/
- public boolean doGet(URL source, File dest, int logLevel,
+ public boolean doGet(final URL source, final File dest, final int logLevel,
DownloadProgress progress)
throws IOException {
@@ -221,13 +221,13 @@ public class Get extends Task {
if (useTimestamp && dest.exists()) {
timestamp = dest.lastModified();
if (verbose) {
- Date t = new Date(timestamp);
+ final Date t = new Date(timestamp);
log("local file date : " + t.toString(), logLevel);
}
hasTimestamp = true;
}
- GetThread getThread = new GetThread(source, dest,
+ final GetThread getThread = new GetThread(source, dest,
hasTimestamp, timestamp, progress,
logLevel, userAgent);
getThread.setDaemon(true);
@@ -235,13 +235,13 @@ public class Get extends Task {
getThread.start();
try {
getThread.join(maxTime * 1000);
- } catch (InterruptedException ie) {
+ } catch (final InterruptedException ie) {
log("interrupted waiting for GET to finish",
Project.MSG_VERBOSE);
}
if (getThread.isAlive()) {
- String msg = "The GET operation took longer than " + maxTime
+ final String msg = "The GET operation took longer than " + maxTime
+ " seconds, stopping it.";
if (ignoreErrors) {
log(msg);
@@ -257,7 +257,7 @@ public class Get extends Task {
}
@Override
- public void log(String msg, int msgLevel) {
+ public void log(final String msg, final int msgLevel) {
if (!quiet || msgLevel >= Project.MSG_ERR) {
super.log(msg, msgLevel);
}
@@ -276,8 +276,8 @@ public class Get extends Task {
throw new BuildException("at least one source is required",
getLocation());
}
- for (Resource r : sources) {
- URLProvider up = r.as(URLProvider.class);
+ for (final Resource r : sources) {
+ final URLProvider up = r.as(URLProvider.class);
if (up == null) {
throw new BuildException("Only URLProvider resources are"
+ " supported", getLocation());
@@ -311,7 +311,7 @@ public class Get extends Task {
*
* @param u URL for the file.
*/
- public void setSrc(URL u) {
+ public void setSrc(final URL u) {
add(new URLResource(u));
}
@@ -319,7 +319,7 @@ public class Get extends Task {
* Adds URLs to get.
* @since Ant 1.8.0
*/
- public void add(ResourceCollection rc) {
+ public void add(final ResourceCollection rc) {
sources.add(rc);
}
@@ -328,7 +328,7 @@ public class Get extends Task {
*
* @param dest Path to file.
*/
- public void setDest(File dest) {
+ public void setDest(final File dest) {
this.destination = dest;
}
@@ -337,7 +337,7 @@ public class Get extends Task {
*
* @param v if "true" then be verbose
*/
- public void setVerbose(boolean v) {
+ public void setVerbose(final boolean v) {
verbose = v;
}
@@ -347,7 +347,7 @@ public class Get extends Task {
* @param v if "true" then be quiet
* @since Ant 1.9.4
*/
- public void setQuiet(boolean v){
+ public void setQuiet(final boolean v){
this.quiet = v;
}
@@ -356,7 +356,7 @@ public class Get extends Task {
*
* @param v if "true" then don't report download errors up to ant
*/
- public void setIgnoreErrors(boolean v) {
+ public void setIgnoreErrors(final boolean v) {
ignoreErrors = v;
}
@@ -378,7 +378,7 @@ public class Get extends Task {
* cause no end of grief.
* @param v "true" to enable file time fetching
*/
- public void setUseTimestamp(boolean v) {
+ public void setUseTimestamp(final boolean v) {
useTimestamp = v;
}
@@ -388,7 +388,7 @@ public class Get extends Task {
*
* @param u username for authentication
*/
- public void setUsername(String u) {
+ public void setUsername(final String u) {
this.uname = u;
}
@@ -397,7 +397,7 @@ public class Get extends Task {
*
* @param p password for authentication
*/
- public void setPassword(String p) {
+ public void setPassword(final String p) {
this.pword = p;
}
@@ -407,7 +407,7 @@ public class Get extends Task {
*
* @since Ant 1.8.0
*/
- public void setMaxTime(long maxTime) {
+ public void setMaxTime(final long maxTime) {
this.maxTime = maxTime;
}
@@ -418,7 +418,7 @@ public class Get extends Task {
*
* @since Ant 1.8.0
*/
- public void setRetries(int r) {
+ public void setRetries(final int r) {
this.numberRetries = r;
}
@@ -429,7 +429,7 @@ public class Get extends Task {
*
* @since Ant 1.8.0
*/
- public void setSkipExisting(boolean s) {
+ public void setSkipExisting(final boolean s) {
this.skipExisting = s;
}
@@ -441,7 +441,7 @@ public class Get extends Task {
*
* @since Ant 1.9.3
*/
- public void setUserAgent(String userAgent) {
+ public void setUserAgent(final String userAgent) {
this.userAgent = userAgent;
}
@@ -455,7 +455,7 @@ public class Get extends Task {
*
* @since Ant 1.8.0
*/
- public void setHttpUseCaches(boolean httpUseCache) {
+ public void setHttpUseCaches(final boolean httpUseCache) {
this.httpUseCaches = httpUseCache;
}
@@ -479,7 +479,7 @@ public class Get extends Task {
* @param fileNameMapper the mapper to add.
* @since Ant 1.8.0
*/
- public void add(FileNameMapper fileNameMapper) {
+ public void add(final FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}
@@ -520,25 +520,20 @@ public class Get extends Task {
/**
* begin a download
*/
- @Override
public void beginDownload() {
-
}
/**
* tick handler
*
*/
- @Override
public void onTick() {
}
/**
* end a download
*/
- @Override
public void endDownload() {
-
}
}
@@ -555,14 +550,13 @@ public class Get extends Task {
* Construct a verbose progress reporter.
* @param out the output stream.
*/
- public VerboseProgress(PrintStream out) {
+ public VerboseProgress(final PrintStream out) {
this.out = out;
}
/**
* begin a download
*/
- @Override
public void beginDownload() {
dots = 0;
}
@@ -571,7 +565,6 @@ public class Get extends Task {
* tick handler
*
*/
- @Override
public void onTick() {
out.print(".");
if (dots++ > DOTS_PER_LINE) {
@@ -583,7 +576,6 @@ public class Get extends Task {
/**
* end a download
*/
- @Override
public void endDownload() {
out.println();
out.flush();
@@ -608,8 +600,8 @@ public class Get extends Task {
private int redirections = 0;
private String userAgent = null;
- GetThread(URL source, File dest,
- boolean h, long t, DownloadProgress p, int l, String userAgent) {
+ GetThread(final URL source, final File dest,
+ final boolean h, final long t, final DownloadProgress p, final int l, final String userAgent) {
this.source = source;
this.dest = dest;
hasTimestamp = h;
@@ -623,9 +615,9 @@ public class Get extends Task {
public void run() {
try {
success = get();
- } catch (IOException ioex) {
+ } catch (final IOException ioex) {
ioexception = ioex;
- } catch (BuildException bex) {
+ } catch (final BuildException bex) {
exception = bex;
}
}
@@ -638,7 +630,7 @@ public class Get extends Task {
return false;
}
- boolean downloadSucceeded = downloadFile();
+ final boolean downloadSucceeded = downloadFile();
//if (and only if) the use file time option is set, then
//the saved file now has its timestamp set to that of the
@@ -651,11 +643,11 @@ public class Get extends Task {
}
- private boolean redirectionAllowed(URL aSource, URL aDest) {
+ private boolean redirectionAllowed(final URL aSource, final URL aDest) {
if (!(aSource.getProtocol().equals(aDest.getProtocol()) || (HTTP
.equals(aSource.getProtocol()) && HTTPS.equals(aDest
.getProtocol())))) {
- String message = "Redirection detected from "
+ final String message = "Redirection detected from "
+ aSource.getProtocol() + " to " + aDest.getProtocol()
+ ". Protocol switch unsafe, not allowed.";
if (ignoreErrors) {
@@ -668,7 +660,7 @@ public class Get extends Task {
redirections++;
if (redirections > REDIRECT_LIMIT) {
- String message = "More than " + REDIRECT_LIMIT
+ final String message = "More than " + REDIRECT_LIMIT
+ " times redirected, giving up";
if (ignoreErrors) {
log(message, logLevel);
@@ -682,10 +674,10 @@ public class Get extends Task {
return true;
}
- private URLConnection openConnection(URL aSource) throws IOException {
+ private URLConnection openConnection(final URL aSource) throws IOException {
// set up the URL connection
- URLConnection connection = aSource.openConnection();
+ final URLConnection connection = aSource.openConnection();
// modify the headers
// NB: things like user authentication could go in here too.
if (hasTimestamp) {
@@ -696,12 +688,12 @@ public class Get extends Task {
// prepare Java 1.1 style credentials
if (uname != null || pword != null) {
- String up = uname + ":" + pword;
+ final String up = uname + ":" + pword;
String encoding;
// we do not use the sun impl for portability,
// and always use our own implementation for consistent
// testing
- Base64Converter encoder = new Base64Converter();
+ final Base64Converter encoder = new Base64Converter();
encoding = encoder.encode(up.getBytes());
connection.setRequestProperty("Authorization", "Basic "
+ encoding);
@@ -718,29 +710,29 @@ public class Get extends Task {
// connect to the remote site (may take some time)
try {
connection.connect();
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
//bad URLs can trigger NPEs in some JVMs
throw new BuildException("Failed to parse " + source.toString(), e);
}
// First check on a 301 / 302 (moved) response (HTTP only)
if (connection instanceof HttpURLConnection) {
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
- int responseCode = httpConnection.getResponseCode();
+ final HttpURLConnection httpConnection = (HttpURLConnection) connection;
+ final int responseCode = httpConnection.getResponseCode();
if (isMoved(responseCode)) {
- String newLocation = httpConnection.getHeaderField("Location");
- String message = aSource
+ final String newLocation = httpConnection.getHeaderField("Location");
+ final String message = aSource
+ (responseCode == HttpURLConnection.HTTP_MOVED_PERM ? " permanently"
: "") + " moved to " + newLocation;
log(message, logLevel);
- URL newURL = new URL(aSource, newLocation);
+ final URL newURL = new URL(aSource, newLocation);
if (!redirectionAllowed(aSource, newURL)) {
return null;
}
return openConnection(newURL);
}
// next test for a 304 result (HTTP only)
- long lastModified = httpConnection.getLastModified();
+ final long lastModified = httpConnection.getLastModified();
if (responseCode == HttpURLConnection.HTTP_NOT_MODIFIED
|| (lastModified != 0 && hasTimestamp && timestamp >= lastModified)) {
// not modified so no file download. just return
@@ -752,7 +744,7 @@ public class Get extends Task {
}
// test for 401 result (HTTP only)
if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
- String message = "HTTP Authorization failure";
+ final String message = "HTTP Authorization failure";
if (ignoreErrors) {
log(message, logLevel);
return null;
@@ -770,7 +762,7 @@ public class Get extends Task {
return connection;
}
- private boolean isMoved(int responseCode) {
+ private boolean isMoved(final int responseCode) {
return responseCode == HttpURLConnection.HTTP_MOVED_PERM ||
responseCode == HttpURLConnection.HTTP_MOVED_TEMP ||
responseCode == HttpURLConnection.HTTP_SEE_OTHER ||
@@ -786,7 +778,7 @@ public class Get extends Task {
try {
is = connection.getInputStream();
break;
- } catch (IOException ex) {
+ } catch (final IOException ex) {
log("Error opening connection " + ex, logLevel);
}
}
@@ -807,7 +799,7 @@ public class Get extends Task {
progress.beginDownload();
boolean finished = false;
try {
- byte[] buffer = new byte[BIG_BUFFER_SIZE];
+ final byte[] buffer = new byte[BIG_BUFFER_SIZE];
int length;
while (!isInterrupted() && (length = is.read(buffer)) >= 0) {
os.write(buffer, 0, length);
@@ -830,9 +822,9 @@ public class Get extends Task {
}
private void updateTimeStamp() {
- long remoteTimestamp = connection.getLastModified();
+ final long remoteTimestamp = connection.getLastModified();
if (verbose) {
- Date t = new Date(remoteTimestamp);
+ final Date t = new Date(remoteTimestamp);
log("last modified = " + t.toString()
+ ((remoteTimestamp == 0)
? " - using current time instead"
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index 5ce62ef86..a82b52a0b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -107,7 +107,7 @@ public class Javadoc extends Task {
*
* @param name the name of the doclet parameter
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -128,7 +128,7 @@ public class Javadoc extends Task {
*
* @param value the parameter value.
*/
- public void setValue(String value) {
+ public void setValue(final String value) {
this.value = value;
}
@@ -159,7 +159,7 @@ public class Javadoc extends Task {
*
* @param name the extension's name.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name;
}
@@ -177,7 +177,7 @@ public class Javadoc extends Task {
*
* @param path a Path instance containing the classpath to use.
*/
- public void setPath(Path path) {
+ public void setPath(final Path path) {
if (this.path == null) {
this.path = path;
} else {
@@ -213,7 +213,7 @@ public class Javadoc extends Task {
*
* @param r the reference containing the path.
*/
- public void setPathRef(Reference r) {
+ public void setPathRef(final Reference r) {
createPath().setRefid(r);
}
}
@@ -225,7 +225,7 @@ public class Javadoc extends Task {
public class DocletInfo extends ExtensionInfo {
/** Collection of doclet parameters. */
- private Vector params = new Vector();
+ private final Vector params = new Vector();
/**
* Create a doclet parameter to be configured by Ant.
@@ -233,7 +233,7 @@ public class Javadoc extends Task {
* @return a new DocletParam instance to be configured.
*/
public DocletParam createParam() {
- DocletParam param = new DocletParam();
+ final DocletParam param = new DocletParam();
params.addElement(param);
return param;
@@ -261,7 +261,7 @@ public class Javadoc extends Task {
*
* @param name the package name.
*/
- public void setName(String name) {
+ public void setName(final String name) {
this.name = name.trim();
}
@@ -303,7 +303,7 @@ public class Javadoc extends Task {
*
* @param file the source file
*/
- public SourceFile(File file) {
+ public SourceFile(final File file) {
this.file = file;
}
@@ -312,7 +312,7 @@ public class Javadoc extends Task {
*
* @param file the source file.
*/
- public void setFile(File file) {
+ public void setFile(final File file) {
this.file = file;
}
@@ -334,14 +334,14 @@ public class Javadoc extends Task {
*/
public static class Html {
/** The text for the element */
- private StringBuffer text = new StringBuffer();
+ private final StringBuffer text = new StringBuffer();
/**
* Add text to the element.
*
* @param t the text to be added.
*/
- public void addText(String t) {
+ public void addText(final String t) {
text.append(t);
}
@@ -379,12 +379,12 @@ public class Javadoc extends Task {
* task runtime.
*/
public class ResourceCollectionContainer {
- private ArrayList rcs = new ArrayList();
+ private final ArrayList rcs = new ArrayList();
/**
* Add a resource collection to the container.
* @param rc the collection to add.
*/
- public void add(ResourceCollection rc) {
+ public void add(final ResourceCollection rc) {
rcs.add(rc);
}
@@ -400,7 +400,7 @@ public class Javadoc extends Task {
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
/** The command line built to execute Javadoc. */
- private Commandline cmd = new Commandline();
+ private final Commandline cmd = new Commandline();
/**
* Utility method to add an argument to the command line conditionally
@@ -409,7 +409,7 @@ public class Javadoc extends Task {
* @param b the flag which controls if the argument is added.
* @param arg the argument value.
*/
- private void addArgIf(boolean b, String arg) {
+ private void addArgIf(final boolean b, final String arg) {
if (b) {
cmd.createArgument().setValue(arg);
}
@@ -421,7 +421,7 @@ public class Javadoc extends Task {
* @param key the argument name.
* @param value the argument value.
*/
- private void addArgIfNotEmpty(String key, String value) {
+ private void addArgIfNotEmpty(final String key, final String value) {
if (value != null && value.length() != 0) {
cmd.createArgument().setValue(key);
cmd.createArgument().setValue(value);
@@ -443,9 +443,9 @@ public class Javadoc extends Task {
private boolean failOnWarning = false;
private Path sourcePath = null;
private File destDir = null;
- private Vector sourceFiles = new Vector();
- private Vector packageNames = new Vector();
- private Vector excludePackageNames = new Vector(1);
+ private final Vector sourceFiles = new Vector();
+ private final Vector packageNames = new Vector();
+ private final Vector excludePackageNames = new Vector(1);
private boolean author = true;
private boolean version = true;
private DocletInfo doclet = null;
@@ -453,9 +453,9 @@ public class Javadoc extends Task {
private Path bootclasspath = null;
private String group = null;
private String packageList = null;
- private Vector links = new Vector();
- private Vector groups = new Vector();
- private Vector