diff --git a/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/src/main/org/apache/tools/ant/taskdefs/Checksum.java index 8e3d70ad4..a276a8f6d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -129,55 +129,55 @@ public class Checksum extends MatchingTask implements Condition { /** * Sets the file for which the checksum is to be calculated. */ - public void setFile(File file) { - this.file = file; + public void setFile(File aFile) { + this.file = aFile; } /** * Sets the MessageDigest algorithm to be used * to calculate the checksum. */ - public void setAlgorithm(String algorithm) { - this.algorithm = algorithm; + public void setAlgorithm(String aAlgorithm) { + this.algorithm = aAlgorithm; } /** * Sets the MessageDigest algorithm provider to be used * to calculate the checksum. */ - public void setProvider(String provider) { - this.provider = provider; + public void setProvider(String aProvider) { + this.provider = aProvider; } /** * Sets the File Extension that is be to used to * create or identify destination file */ - public void setFileext(String fileext) { - this.fileext = fileext; + public void setFileext(String aFileext) { + this.fileext = aFileext; } /** * Sets the property to hold the generated checksum */ - public void setProperty(String property) { - this.property = property; + public void setProperty(String aProperty) { + this.property = aProperty; } /** * Sets verify property. This project property holds * the result of a checksum verification - "true" or "false" */ - public void setVerifyproperty(String verifyProperty) { - this.verifyProperty = verifyProperty; + public void setVerifyproperty(String aVerifyProperty) { + this.verifyProperty = aVerifyProperty; } /** * Overwrite existing file irrespective of whether it is newer than * the source file? Defaults to false. */ - public void setForceOverwrite(boolean forceOverwrite) { - this.forceOverwrite = forceOverwrite; + public void setForceOverwrite(boolean aForceOverwrite) { + this.forceOverwrite = aForceOverwrite; } /** @@ -311,24 +311,24 @@ public class Checksum extends MatchingTask implements Condition { * Add key-value pair to the hashtable upon which * to later operate upon. */ - private void addToIncludeFileMap(File file) throws BuildException { - if (file != null) { - if (file.exists()) { + private void addToIncludeFileMap(File aFile) throws BuildException { + if (aFile != null) { + if (aFile.exists()) { if (property == null) { - File dest = new File(file.getParent(), file.getName() + fileext); + File dest = new File(aFile.getParent(), aFile.getName() + fileext); if (forceOverwrite || isCondition || - (file.lastModified() > dest.lastModified())) { - includeFileMap.put(file, dest); + (aFile.lastModified() > dest.lastModified())) { + includeFileMap.put(aFile, dest); } else { - log(file + " omitted as " + dest + " is up to date.", + log(aFile + " omitted as " + dest + " is up to date.", Project.MSG_VERBOSE); } } else { - includeFileMap.put(file, property); + includeFileMap.put(aFile, property); } } else { String message = "Could not find file " - + file.getAbsolutePath() + + aFile.getAbsolutePath() + " to generate checksum for."; log(message); throw new BuildException(message, location); diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index 3ac8b9226..be337ee02 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -119,22 +119,22 @@ public class Copy extends Task { /** * Sets a single source file to copy. */ - public void setFile(File file) { - this.file = file; + public void setFile(File aFile) { + this.file = aFile; } /** * Sets the destination file. */ - public void setTofile(File destFile) { - this.destFile = destFile; + public void setTofile(File aDestFile) { + this.destFile = aDestFile; } /** * Sets the destination directory. */ - public void setTodir(File destDir) { - this.destDir = destDir; + public void setTodir(File aDestDir) { + this.destDir = aDestDir; } /** @@ -175,8 +175,8 @@ public class Copy extends Task { /** * Sets filtering. */ - public void setFiltering(boolean filtering) { - this.filtering = filtering; + public void setFiltering(boolean aFiltering) { + this.filtering = aFiltering; } /** @@ -193,8 +193,8 @@ public class Copy extends Task { * file will be copied into the "flattened" directory, unless * the forceoverwrite attribute is true. */ - public void setFlatten(boolean flatten) { - this.flatten = flatten; + public void setFlatten(boolean aFlatten) { + this.flatten = aFlatten; } /** @@ -211,8 +211,8 @@ public class Copy extends Task { /** * Used to copy empty directories. */ - public void setIncludeEmptyDirs(boolean includeEmpty) { - this.includeEmpty = includeEmpty; + public void setIncludeEmptyDirs(boolean aIncludeEmpty) { + this.includeEmpty = aIncludeEmpty; } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/Move.java b/src/main/org/apache/tools/ant/taskdefs/Move.java index 76d95bb50..ad847c388 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Move.java +++ b/src/main/org/apache/tools/ant/taskdefs/Move.java @@ -264,15 +264,15 @@ public class Move extends Copy { * * @throws IOException */ - protected boolean renameFile(File sourceFile, File destFile, - boolean filtering, boolean overwrite) + protected boolean renameFile(File sourceFile, File aDestFile, + boolean aFiltering, boolean overwrite) throws IOException, BuildException { boolean renamed = true; - if (!filtering) { + if (!aFiltering) { // ensure that parent dir of dest file exists! // not using getParentFile method to stay 1.1 compat - String parentPath = destFile.getParent(); + String parentPath = aDestFile.getParent(); if (parentPath != null) { File parent = new File(parentPath); if (!parent.exists()) { @@ -280,13 +280,13 @@ public class Move extends Copy { } } - if (destFile.exists()) { - if (!destFile.delete()) { + if (aDestFile.exists()) { + if (!aDestFile.delete()) { throw new BuildException("Unable to remove existing file " - + destFile); + + aDestFile); } } - renamed = sourceFile.renameTo(destFile); + renamed = sourceFile.renameTo(aDestFile); } else { renamed = false; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Unpack.java b/src/main/org/apache/tools/ant/taskdefs/Unpack.java index b0f922557..728350646 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Unpack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Unpack.java @@ -88,18 +88,18 @@ public abstract class Unpack extends Task { * mechanism do the work and also to encapsulate operations on * the type in its own class. */ - public void setDest(String dest) { + public void setDest(String aDest) { log("DEPRECATED - The setDest(String) method has been deprecated." + " Use setDest(File) instead."); - setDest(project.resolveFile(dest)); + setDest(project.resolveFile(aDest)); } public void setSrc(File src) { source = src; } - public void setDest(File dest) { - this.dest = dest; + public void setDest(File aDest) { + this.dest = aDest; } private void validate() throws BuildException { diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java index ec8b1fc6a..10a4df0db 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java @@ -81,8 +81,8 @@ public class Os implements Condition { public Os() {} - public Os(String family) { - setFamily(family); + public Os(String aFamily) { + setFamily(aFamily); } /** @@ -104,8 +104,8 @@ public class Os implements Condition { * * @param name The OS name */ - public void setName(String name) { - this.name = name.toLowerCase(Locale.US); + public void setName(String aName) { + this.name = aName.toLowerCase(Locale.US); } /** @@ -113,8 +113,8 @@ public class Os implements Condition { * * @param arch The OS architecture */ - public void setArch(String arch) { - this.arch = arch.toLowerCase(Locale.US); + public void setArch(String aArch) { + this.arch = aArch.toLowerCase(Locale.US); } /** @@ -122,8 +122,8 @@ public class Os implements Condition { * * @param version The OS version */ - public void setVersion(String version) { - this.version = version.toLowerCase(Locale.US); + public void setVersion(String aVersion) { + this.version = aVersion.toLowerCase(Locale.US); } /** @@ -141,8 +141,8 @@ public class Os implements Condition { * * @since 1.5 */ - public static boolean isFamily(String family) { - return isOs(family, null, null, null); + public static boolean isFamily(String aFamily) { + return isOs(aFamily, null, null, null); } /** @@ -151,8 +151,8 @@ public class Os implements Condition { * * @since 1.7 */ - public static boolean isName(String name) { - return isOs(null, name, null, null); + public static boolean isName(String aName) { + return isOs(null, aName, null, null); } /** @@ -161,8 +161,8 @@ public class Os implements Condition { * * @since 1.7 */ - public static boolean isArch(String arch) { - return isOs(null, null, arch, null); + public static boolean isArch(String aArch) { + return isOs(null, null, aArch, null); } /** @@ -171,8 +171,8 @@ public class Os implements Condition { * * @since 1.7 */ - public static boolean isVersion(String version) { - return isOs(null, null, null, version); + public static boolean isVersion(String aVersion) { + return isOs(null, null, null, aVersion); } /** @@ -186,46 +186,46 @@ public class Os implements Condition { * * @since 1.7 */ - public static boolean isOs(String family, String name, String arch, - String version) { + public static boolean isOs(String aFamily, String aName, String aArch, + String aVersion) { boolean retValue = false; - if (family != null || name != null || arch != null - || version != null) { + if (aFamily != null || aName != null || aArch != null + || aVersion != null) { boolean isFamily = true; boolean isName = true; boolean isArch = true; boolean isVersion = true; - if (family != null) { - if (family.equals("windows")) { + if (aFamily != null) { + if (aFamily.equals("windows")) { isFamily = osName.indexOf("windows") > -1; - } else if (family.equals("os/2")) { + } else if (aFamily.equals("os/2")) { isFamily = osName.indexOf("os/2") > -1; - } else if (family.equals("netware")) { + } else if (aFamily.equals("netware")) { isFamily = osName.indexOf("netware") > -1; - } else if (family.equals("dos")) { + } else if (aFamily.equals("dos")) { isFamily = pathSep.equals(";") && !isFamily("netware"); - } else if (family.equals("mac")) { + } else if (aFamily.equals("mac")) { isFamily = osName.indexOf("mac") > -1; - } else if (family.equals("unix")) { + } else if (aFamily.equals("unix")) { isFamily = pathSep.equals(":") && (!isFamily("mac") || osName.endsWith("x")); } else { throw new BuildException( "Don\'t know how to detect os family \"" - + family + "\""); + + aFamily + "\""); } } - if (name != null) { - isName = name.equals(osName); + if (aName != null) { + isName = aName.equals(osName); } - if (arch != null) { - isArch = arch.equals(osArch); + if (aArch != null) { + isArch = aArch.equals(osArch); } - if (version != null) { - isVersion = version.equals(osVersion); + if (aVersion != null) { + isVersion = aVersion.equals(osVersion); } retValue = isFamily && isName && isArch && isVersion; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index dc82938b2..0b8912dde 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -158,72 +158,72 @@ public class Translate extends MatchingTask { /** * Sets Family name of resource bundle */ - public void setBundle(String bundle) { - this.bundle = bundle; + public void setBundle(String aBundle) { + this.bundle = aBundle; } /** * Sets locale specific language of resource bundle */ - public void setBundleLanguage(String bundleLanguage ) { - this.bundleLanguage = bundleLanguage; + public void setBundleLanguage(String aBundleLanguage ) { + this.bundleLanguage = aBundleLanguage; } /** * Sets locale specific country of resource bundle */ - public void setBundleCountry(String bundleCountry) { - this.bundleCountry = bundleCountry; + public void setBundleCountry(String aBundleCountry) { + this.bundleCountry = aBundleCountry; } /** * Sets locale specific variant of resource bundle */ - public void setBundleVariant(String bundleVariant) { - this.bundleVariant = bundleVariant; + public void setBundleVariant(String aBundleVariant) { + this.bundleVariant = aBundleVariant; } /** * Sets Destination directory */ - public void setToDir(File toDir) { - this.toDir = toDir; + public void setToDir(File aToDir) { + this.toDir = aToDir; } /** * Sets starting token to identify keys */ - public void setStartToken(String startToken) { - this.startToken = startToken; + public void setStartToken(String aStartToken) { + this.startToken = aStartToken; } /** * Sets ending token to identify keys */ - public void setEndToken(String endToken) { - this.endToken = endToken; + public void setEndToken(String aEndToken) { + this.endToken = aEndToken; } /** * Sets source file encoding scheme */ - public void setSrcEncoding(String srcEncoding) { - this.srcEncoding = srcEncoding; + public void setSrcEncoding(String aSrcEncoding) { + this.srcEncoding = aSrcEncoding; } /** * Sets destination file encoding scheme. Defaults to source file * encoding */ - public void setDestEncoding(String destEncoding) { - this.destEncoding = destEncoding; + public void setDestEncoding(String aDestEncoding) { + this.destEncoding = aDestEncoding; } /** * Sets Resource Bundle file encoding scheme */ - public void setBundleEncoding(String bundleEncoding) { - this.bundleEncoding = bundleEncoding; + public void setBundleEncoding(String aBundleEncoding) { + this.bundleEncoding = aBundleEncoding; } /** @@ -231,8 +231,8 @@ public class Translate extends MatchingTask { * the source file as well as the resource bundle file? Defaults to * false. */ - public void setForceOverwrite(boolean forceOverwrite) { - this.forceOverwrite = forceOverwrite; + public void setForceOverwrite(boolean aForceOverwrite) { + this.forceOverwrite = aForceOverwrite; } /** @@ -339,17 +339,17 @@ public class Translate extends MatchingTask { * but with bundle encoding also considered while loading. */ private void loadResourceMaps() throws BuildException { - Locale locale = new Locale(bundleLanguage, + Locale aLocale = new Locale(bundleLanguage, bundleCountry, bundleVariant); - String language = locale.getLanguage().length() > 0 ? - "_" + locale.getLanguage() : + String language = aLocale.getLanguage().length() > 0 ? + "_" + aLocale.getLanguage() : ""; - String country = locale.getCountry().length() > 0 ? - "_" + locale.getCountry() : + String country = aLocale.getCountry().length() > 0 ? + "_" + aLocale.getCountry() : ""; - String variant = locale.getVariant().length() > 0 ? - "_" + locale.getVariant() : + String variant = aLocale.getVariant().length() > 0 ? + "_" + aLocale.getVariant() : ""; String bundleFile = bundle + language + country + variant; processBundle(bundleFile, 0, false); @@ -365,16 +365,16 @@ public class Translate extends MatchingTask { //Load default locale bundle files //using default file encoding scheme. - locale = Locale.getDefault(); + aLocale = Locale.getDefault(); - language = locale.getLanguage().length() > 0 ? - "_" + locale.getLanguage() : + language = aLocale.getLanguage().length() > 0 ? + "_" + aLocale.getLanguage() : ""; - country = locale.getCountry().length() > 0 ? - "_" + locale.getCountry() : + country = aLocale.getCountry().length() > 0 ? + "_" + aLocale.getCountry() : ""; - variant = locale.getVariant().length() > 0 ? - "_" + locale.getVariant() : + variant = aLocale.getVariant().length() > 0 ? + "_" + aLocale.getVariant() : ""; bundleEncoding = System.getProperty("file.encoding"); @@ -391,18 +391,19 @@ public class Translate extends MatchingTask { /** * Process each file that makes up this bundle. */ - private void processBundle(String bundleFile, int i, - boolean checkLoaded) throws BuildException { - bundleFile += ".properties"; + private void processBundle(final String bundleFile, final int i, + final boolean checkLoaded) + throws BuildException { + String lBundleFile = bundleFile + ".properties"; FileInputStream ins = null; try { - ins = new FileInputStream(bundleFile); + ins = new FileInputStream(lBundleFile); loaded = true; - bundleLastModified[i] = new File(bundleFile).lastModified(); - log("Using " + bundleFile, Project.MSG_DEBUG); + bundleLastModified[i] = new File(lBundleFile).lastModified(); + log("Using " + lBundleFile, Project.MSG_DEBUG); loadResourceMap(ins); } catch (IOException ioe) { - log(bundleFile + " not found.", Project.MSG_DEBUG); + log(lBundleFile + " not found.", Project.MSG_DEBUG); //if all resource files associated with this bundle //have been scanned for and still not able to //find a single resrouce file, throw exception @@ -524,50 +525,49 @@ public class Translate extends MatchingTask { srcEncoding)); String line; while((line = in.readLine()) != null) { - StringBuffer newline = new StringBuffer(line); int startIndex = -1; int endIndex = -1; - outer: while (true) { - startIndex = line.indexOf(startToken, endIndex + 1); - if (startIndex < 0 || - startIndex + 1 >= line.length()) { - break; - } - endIndex = line.indexOf(endToken, startIndex + 1); - if (endIndex < 0) { - break; - } - String matches = line.substring(startIndex + 1, - endIndex); - //If there is a white space or = or :, then - //it isn't to be treated as a valid key. - for (int k = 0; k < matches.length(); k++) { - char c = matches.charAt(k); - if (c == ':' || - c == '=' || - Character.isSpaceChar(c)) { - endIndex = endIndex - 1; - continue outer; +outer: while (true) { + startIndex = line.indexOf(startToken, endIndex + 1); + if (startIndex < 0 || + startIndex + 1 >= line.length()) { + break; + } + endIndex = line.indexOf(endToken, startIndex + 1); + if (endIndex < 0) { + break; + } + String matches = line.substring(startIndex + 1, + endIndex); + //If there is a white space or = or :, then + //it isn't to be treated as a valid key. + for (int k = 0; k < matches.length(); k++) { + char c = matches.charAt(k); + if (c == ':' || + c == '=' || + Character.isSpaceChar(c)) { + endIndex = endIndex - 1; + continue outer; + } + } + String replace = null; + replace = (String) resourceMap.get(matches); + //If the key hasn't been loaded into resourceMap, + //use the key itself as the value also. + if (replace == null) { + log("Warning: The key: " + matches + + " hasn't been defined.", + Project.MSG_DEBUG); + replace = matches; + } + line = line.substring(0, startIndex) + + replace + + line.substring(endIndex + 1); + endIndex = startIndex + replace.length() + 1; + if (endIndex + 1 >= line.length()) { + break; } } - String replace = null; - replace = (String) resourceMap.get(matches); - //If the key hasn't been loaded into resourceMap, - //use the key itself as the value also. - if (replace == null) { - log("Warning: The key: " + matches - + " hasn't been defined.", - Project.MSG_DEBUG); - replace = matches; - } - line = line.substring(0, startIndex) - + replace - + line.substring(endIndex + 1); - endIndex = startIndex + replace.length() + 1; - if (endIndex + 1 >= line.length()) { - break; - } - } out.write(line); out.newLine(); }