umagesh 02/01/25 07:05:06
Modified: src/main/org/apache/tools/ant/taskdefs Checksum.java
Copy.java Move.java Unpack.java
src/main/org/apache/tools/ant/taskdefs/condition Os.java
src/main/org/apache/tools/ant/taskdefs/optional/i18n
Translate.java
Log:
Try to minimize Quality Analyzer's complaints - 1st pass.
Revision Changes Path
1.9 +23 -23
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java
Index: Checksum.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Checksum.java 8 Jan 2002 20:14:46 -0000 1.8
+++ Checksum.java 25 Jan 2002 15:05:06 -0000 1.9
@@ -129,55 +129,55 @@
/**
* 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 @@
* 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);
1.27 +12 -12
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Copy.java 10 Jan 2002 13:59:31 -0000 1.26
+++ Copy.java 25 Jan 2002 15:05:06 -0000 1.27
@@ -119,22 +119,22 @@
/**
* 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 @@
/**
* Sets filtering.
*/
- public void setFiltering(boolean filtering) {
- this.filtering = filtering;
+ public void setFiltering(boolean aFiltering) {
+ this.filtering = aFiltering;
}
/**
@@ -193,8 +193,8 @@
* 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 @@
/**
* Used to copy empty directories.
*/
- public void setIncludeEmptyDirs(boolean includeEmpty) {
- this.includeEmpty = includeEmpty;
+ public void setIncludeEmptyDirs(boolean aIncludeEmpty) {
+ this.includeEmpty = aIncludeEmpty;
}
/**
1.13 +8 -8
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java
Index: Move.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Move.java 10 Jan 2002 13:59:31 -0000 1.12
+++ Move.java 25 Jan 2002 15:05:06 -0000 1.13
@@ -264,15 +264,15 @@
*
* @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 @@
}
}
- 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;
}
1.6 +4 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Unpack.java
Index: Unpack.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Unpack.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Unpack.java 10 Jan 2002 13:59:32 -0000 1.5
+++ Unpack.java 25 Jan 2002 15:05:06 -0000 1.6
@@ -88,18 +88,18 @@
* 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 {
1.9 +35 -35
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
Index: Os.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Os.java 20 Jan 2002 20:45:57 -0000 1.8
+++ Os.java 25 Jan 2002 15:05:06 -0000 1.9
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public class Os implements Condition {
private final static String osName =
@@ -81,8 +81,8 @@
public Os() {}
- public Os(String family) {
- setFamily(family);
+ public Os(String aFamily) {
+ setFamily(aFamily);
}
/**
@@ -104,8 +104,8 @@
*
* @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 @@
*
* @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 @@
*
* @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 @@
*
* @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 @@
*
* @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 @@
*
* @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 @@
*
* @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 @@
*
* @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;
}
1.5 +83 -83
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
Index: Translate.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Translate.java 20 Jan 2002 20:45:57 -0000 1.4
+++ Translate.java 25 Jan 2002 15:05:06 -0000 1.5
@@ -158,72 +158,72 @@
/**
* 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 @@
* 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 @@
* 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 @@
//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 @@
/**
* 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 @@
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();
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>