You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by mb...@apache.org on 2017/04/13 15:16:21 UTC
[21/34] ant git commit: java 5-8
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
index 81a386f..e761975 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
@@ -192,8 +192,8 @@ public class Native2Ascii extends MatchingTask {
*/
public void add(Native2AsciiAdapter adapter) {
if (nestedAdapter != null) {
- throw new BuildException("Can't have more than one native2ascii"
- + " adapter");
+ throw new BuildException(
+ "Can't have more than one native2ascii adapter");
}
nestedAdapter = adapter;
}
@@ -203,6 +203,7 @@ public class Native2Ascii extends MatchingTask {
*
* @throws BuildException is there is a problem in the task execution.
*/
+ @Override
public void execute() throws BuildException {
DirectoryScanner scanner = null; // Scanner to find our inputs
@@ -222,11 +223,11 @@ public class Native2Ascii extends MatchingTask {
// to be set, so we don't stomp every file. One could still
// include a file with the same extension, but ....
if (srcDir.equals(destDir) && extension == null && mapper == null) {
- throw new BuildException("The ext attribute or a mapper must be set if"
- + " src and dest dirs are the same.");
+ throw new BuildException(
+ "The ext attribute or a mapper must be set if src and dest dirs are the same.");
}
- FileNameMapper m = null;
+ FileNameMapper m;
if (mapper == null) {
if (extension == null) {
m = new IdentityMapper();
@@ -270,8 +271,7 @@ public class Native2Ascii extends MatchingTask {
// Make sure we're not about to clobber something
if (srcFile.equals(destFile)) {
- throw new BuildException("file " + srcFile
- + " would overwrite its self");
+ throw new BuildException("file %s would overwrite itself", srcFile);
}
// Make intermediate directories if needed
@@ -282,8 +282,8 @@ public class Native2Ascii extends MatchingTask {
if (!parentFile.exists()
&& !(parentFile.mkdirs() || parentFile.isDirectory())) {
- throw new BuildException("cannot create parent directory "
- + parentName);
+ throw new BuildException("cannot create parent directory %s",
+ parentName);
}
}
@@ -310,19 +310,22 @@ public class Native2Ascii extends MatchingTask {
private class ExtMapper implements FileNameMapper {
+ @Override
public void setFrom(String s) {
}
+
+ @Override
public void setTo(String s) {
}
+ @Override
public String[] mapFileName(String fileName) {
int lastDot = fileName.lastIndexOf('.');
if (lastDot >= 0) {
- return new String[] {fileName.substring(0, lastDot)
- + extension};
- } else {
- return new String[] {fileName + extension};
+ return new String[] {
+ fileName.substring(0, lastDot) + extension };
}
+ return new String[] { fileName + extension };
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index 21440f1..9c6da4a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -23,11 +23,14 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
-import java.util.Enumeration;
+import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import netrexx.lang.Rexx;
@@ -143,8 +146,8 @@ public class NetRexxC extends MatchingTask {
static final String MSG_DEPRECATION = "has been deprecated";
// other implementation variables
- private Vector compileList = new Vector();
- private Hashtable filecopyList = new Hashtable();
+ private Vector<String> compileList = new Vector<>();
+ private Hashtable<String, String> filecopyList = new Hashtable<>();
/**
* Set whether literals are treated as binary, rather than NetRexx types.
@@ -156,7 +159,6 @@ public class NetRexxC extends MatchingTask {
this.binary = binary;
}
-
/**
* Set the classpath used for NetRexx compilation.
* @param classpath the classpath to use.
@@ -165,7 +167,6 @@ public class NetRexxC extends MatchingTask {
this.classpath = classpath;
}
-
/**
* Set whether comments are passed through to the generated java source.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -176,7 +177,6 @@ public class NetRexxC extends MatchingTask {
this.comments = comments;
}
-
/**
* Set whether error messages come out in compact or verbose format.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -187,7 +187,6 @@ public class NetRexxC extends MatchingTask {
this.compact = compact;
}
-
/**
* Set whether the NetRexx compiler should compile the generated java code.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -202,7 +201,6 @@ public class NetRexxC extends MatchingTask {
}
}
-
/**
* Set whether or not compiler messages should be displayed on the 'console'.
* Note that this task will rely on the default value for filtering compile messages.
@@ -214,7 +212,6 @@ public class NetRexxC extends MatchingTask {
this.console = console;
}
-
/**
* Whether variable cross references are generated.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -225,7 +222,6 @@ public class NetRexxC extends MatchingTask {
this.crossref = crossref;
}
-
/**
* Set whether decimal arithmetic should be used for the netrexx code.
* Setting this to off will report decimal arithmetic as an error, for
@@ -238,7 +234,6 @@ public class NetRexxC extends MatchingTask {
this.decimal = decimal;
}
-
/**
* Set the destination directory into which the NetRexx source files
* should be copied and then compiled.
@@ -248,7 +243,6 @@ public class NetRexxC extends MatchingTask {
destDir = destDirName;
}
-
/**
* Whether diagnostic information about the compile is generated
* @param diag a <code>boolean</code> value.
@@ -257,7 +251,6 @@ public class NetRexxC extends MatchingTask {
this.diag = diag;
}
-
/**
* Sets whether variables must be declared explicitly before use.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -268,7 +261,6 @@ public class NetRexxC extends MatchingTask {
this.explicit = explicit;
}
-
/**
* Whether the generated java code is formatted nicely or left to match
* NetRexx line numbers for call stack debugging.
@@ -280,7 +272,6 @@ public class NetRexxC extends MatchingTask {
this.format = format;
}
-
/**
* Whether the generated java code is produced.
* This is not implemented yet.
@@ -290,7 +281,6 @@ public class NetRexxC extends MatchingTask {
log("The attribute java is currently unused.", Project.MSG_WARN);
}
-
/**
* Sets whether the generated java source file should be kept after
* compilation. The generated files will have an extension of .java.keep,
@@ -304,7 +294,6 @@ public class NetRexxC extends MatchingTask {
this.keep = keep;
}
-
/**
* Whether the compiler text logo is displayed when compiling.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -315,7 +304,6 @@ public class NetRexxC extends MatchingTask {
this.logo = logo;
}
-
/**
* Whether the generated .java file should be replaced when compiling.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -326,7 +314,6 @@ public class NetRexxC extends MatchingTask {
this.replace = replace;
}
-
/**
* Sets whether the compiler messages will be written to NetRexxC.log as
* well as to the console.
@@ -338,7 +325,6 @@ public class NetRexxC extends MatchingTask {
this.savelog = savelog;
}
-
/**
* Tells the NetRexx compiler to store the class files in the same
* directory as the source files. The alternative is the working directory.
@@ -350,7 +336,6 @@ public class NetRexxC extends MatchingTask {
this.sourcedir = sourcedir;
}
-
/**
* Set the source dir to find the source Java files.
* @param srcDirName the source directory.
@@ -359,7 +344,6 @@ public class NetRexxC extends MatchingTask {
srcDir = srcDirName;
}
-
/**
* Tells the NetRexx compiler that method calls always need parentheses,
* even if no arguments are needed, e.g. <code>aStringVar.getBytes</code>
@@ -372,7 +356,6 @@ public class NetRexxC extends MatchingTask {
this.strictargs = strictargs;
}
-
/**
* Tells the NetRexx compile that assignments must match exactly on type.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -383,7 +366,6 @@ public class NetRexxC extends MatchingTask {
this.strictassign = strictassign;
}
-
/**
* Specifies whether the NetRexx compiler should be case sensitive or not.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -394,7 +376,6 @@ public class NetRexxC extends MatchingTask {
this.strictcase = strictcase;
}
-
/**
* Sets whether classes need to be imported explicitly using an <code>import</code>
* statement. By default the NetRexx compiler will import certain packages
@@ -407,7 +388,6 @@ public class NetRexxC extends MatchingTask {
this.strictimport = strictimport;
}
-
/**
* Sets whether local properties need to be qualified explicitly using
* <code>this</code>.
@@ -419,7 +399,6 @@ public class NetRexxC extends MatchingTask {
this.strictprops = strictprops;
}
-
/**
* Whether the compiler should force catching of exceptions by explicitly
* named types.
@@ -431,7 +410,6 @@ public class NetRexxC extends MatchingTask {
this.strictsignal = strictsignal;
}
-
/**
* Sets whether debug symbols should be generated into the class file.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -442,7 +420,6 @@ public class NetRexxC extends MatchingTask {
this.symbols = symbols;
}
-
/**
* Asks the NetRexx compiler to print compilation times to the console
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -471,12 +448,10 @@ public class NetRexxC extends MatchingTask {
*/
public void setTrace(String trace) {
TraceAttr t = new TraceAttr();
-
t.setValue(trace);
setTrace(t);
}
-
/**
* Tells the NetRexx compiler that the source is in UTF8.
* Valid true values are "yes", "on" or "true". Anything else sets the flag to false.
@@ -487,7 +462,6 @@ public class NetRexxC extends MatchingTask {
this.utf8 = utf8;
}
-
/**
* Whether lots of warnings and error messages should be generated
* @param verbose the value to set - verbose<level> or noverbose.
@@ -496,14 +470,12 @@ public class NetRexxC extends MatchingTask {
this.verbose = verbose.getValue();
}
-
/**
* Whether lots of warnings and error messages should be generated
* @param verbose the value to set - verbose<level> or noverbose.
*/
public void setVerbose(String verbose) {
VerboseAttr v = new VerboseAttr();
-
v.setValue(verbose);
setVerbose(v);
}
@@ -518,7 +490,6 @@ public class NetRexxC extends MatchingTask {
this.suppressMethodArgumentNotUsed = suppressMethodArgumentNotUsed;
}
-
/**
* Whether the task should suppress the "Private property is defined but
* not used" in strictargs-Mode, which can be quite annoying while
@@ -529,7 +500,6 @@ public class NetRexxC extends MatchingTask {
this.suppressPrivatePropertyNotUsed = suppressPrivatePropertyNotUsed;
}
-
/**
* Whether the task should suppress the "Variable is set but not used" in
* strictargs-Mode. Be careful with this one! The warning is logged as
@@ -540,7 +510,6 @@ public class NetRexxC extends MatchingTask {
this.suppressVariableNotUsed = suppressVariableNotUsed;
}
-
/**
* Whether the task should suppress the "FooException is in SIGNALS list
* but is not signalled within the method", which is sometimes rather
@@ -551,7 +520,6 @@ public class NetRexxC extends MatchingTask {
this.suppressExceptionNotSignalled = suppressExceptionNotSignalled;
}
-
/**
* Tells whether we should filter out any deprecation-messages
* of the compiler out.
@@ -561,7 +529,6 @@ public class NetRexxC extends MatchingTask {
this.suppressDeprecation = suppressDeprecation;
}
-
/**
* Tells whether the trailing .keep in nocompile-mode should be removed
* so that the resulting java source really ends on .java.
@@ -571,12 +538,12 @@ public class NetRexxC extends MatchingTask {
this.removeKeepExtension = removeKeepExtension;
}
-
/**
* init-Method sets defaults from Properties. That way, when ant is called
* with arguments like -Dant.netrexxc.verbose=verbose5 one can easily take
* control of all netrexxc-tasks.
*/
+ @Override
public void init() {
String p;
@@ -681,11 +648,11 @@ public class NetRexxC extends MatchingTask {
}
}
-
/**
* Executes the task - performs the actual compiler call.
* @throws BuildException on error.
*/
+ @Override
public void execute() throws BuildException {
// first off, make sure that we've got a srcdir and destdir
@@ -695,7 +662,6 @@ public class NetRexxC extends MatchingTask {
// scan source and dest dirs to build up both copy lists and
// compile lists
- // scanDir(srcDir, destDir);
DirectoryScanner ds = getDirectoryScanner(srcDir);
String[] files = ds.getIncludedFiles();
@@ -706,7 +672,7 @@ public class NetRexxC extends MatchingTask {
copyFilesToDestination();
// compile the source files
- if (compileList.size() > 0) {
+ if (!compileList.isEmpty()) {
log("Compiling " + compileList.size() + " source file"
+ (compileList.size() == 1 ? "" : "s")
+ " to " + destDir);
@@ -717,16 +683,14 @@ public class NetRexxC extends MatchingTask {
}
}
-
/**
* Scans the directory looking for source files to be compiled and support
* files to be copied.
*/
private void scanDir(File srcDir, File destDir, String[] files) {
- for (int i = 0; i < files.length; i++) {
- File srcFile = new File(srcDir, files[i]);
- File destFile = new File(destDir, files[i]);
- String filename = files[i];
+ for (String filename : files) {
+ File srcFile = new File(srcDir, filename);
+ File destFile = new File(destDir, filename);
// if it's a non source file, copy it if a later date than the
// dest
// if it's a source file, see if the destination class file
@@ -749,113 +713,80 @@ public class NetRexxC extends MatchingTask {
filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
compileList.addElement(destFile.getAbsolutePath());
}
- } else {
- if (srcFile.lastModified() > destFile.lastModified()) {
- filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
- }
+ } else if (srcFile.lastModified() > destFile.lastModified()) {
+ filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
}
}
}
-
/** Copy eligible files from the srcDir to destDir */
private void copyFilesToDestination() {
- if (filecopyList.size() > 0) {
+ if (!filecopyList.isEmpty()) {
log("Copying " + filecopyList.size() + " file"
+ (filecopyList.size() == 1 ? "" : "s")
+ " to " + destDir.getAbsolutePath());
- Enumeration e = filecopyList.keys();
-
- while (e.hasMoreElements()) {
- String fromFile = (String) e.nextElement();
- String toFile = (String) filecopyList.get(fromFile);
-
+ filecopyList.forEach((fromFile, toFile) -> {
try {
FileUtils.getFileUtils().copyFile(fromFile, toFile);
} catch (IOException ioe) {
- String msg = "Failed to copy " + fromFile + " to " + toFile
- + " due to " + ioe.getMessage();
-
- throw new BuildException(msg, ioe);
+ throw new BuildException("Failed to copy " + fromFile
+ + " to " + toFile + " due to " + ioe.getMessage(), ioe);
}
- }
+ });
}
}
-
/**
* Rename .java.keep files (back) to .java. The netrexxc renames all
* .java files to .java.keep if either -keep or -nocompile option is set.
*/
private void removeKeepExtensions() {
- if (compileList.size() > 0) {
+ if (!compileList.isEmpty()) {
log("Removing .keep extension on " + compileList.size() + " file"
+ (compileList.size() == 1 ? "" : "s"));
- Enumeration e = compileList.elements();
- while (e.hasMoreElements()) {
- String nrxName = (String) e.nextElement();
- String baseName = nrxName.substring(0, nrxName.lastIndexOf('.'));
+ compileList.forEach(nrxName -> {
+ String baseName =
+ nrxName.substring(0, nrxName.lastIndexOf('.'));
File fromFile = new File(baseName + ".java.keep");
File toFile = new File(baseName + ".java");
if (fromFile.renameTo(toFile)) {
- log("Successfully renamed " + fromFile + " to " + toFile, Project.MSG_VERBOSE);
+ log("Successfully renamed " + fromFile + " to " + toFile,
+ Project.MSG_VERBOSE);
} else {
log("Failed to rename " + fromFile + " to " + toFile);
}
- }
+ });
}
}
-
/** Performs a compile using the NetRexx 1.1.x compiler */
private void doNetRexxCompile() throws BuildException {
log("Using NetRexx compiler", Project.MSG_VERBOSE);
String classpath = getCompileClasspath();
- StringBuffer compileOptions = new StringBuffer();
// create an array of strings for input to the compiler: one array
// comes from the compile options, the other from the compileList
String[] compileOptionsArray = getCompileOptionsAsArray();
- String[] fileListArray = new String[compileList.size()];
- Enumeration e = compileList.elements();
- int j = 0;
-
- while (e.hasMoreElements()) {
- fileListArray[j] = (String) e.nextElement();
- j++;
- }
- // create a single array of arguments for the compiler
- String[] compileArgs = new String[compileOptionsArray.length + fileListArray.length];
-
- for (int i = 0; i < compileOptionsArray.length; i++) {
- compileArgs[i] = compileOptionsArray[i];
- }
- for (int i = 0; i < fileListArray.length; i++) {
- compileArgs[i + compileOptionsArray.length] = fileListArray[i];
- }
// print nice output about what we are doing for the log
- compileOptions.append("Compilation args: ");
- for (int i = 0; i < compileOptionsArray.length; i++) {
- compileOptions.append(compileOptionsArray[i]);
- compileOptions.append(" ");
- }
- log(compileOptions.toString(), Project.MSG_VERBOSE);
+ log(Stream.of(compileOptionsArray)
+ .collect(Collectors.joining(" ", "Compilation args: ", "")),
+ Project.MSG_VERBOSE);
- String eol = System.getProperty("line.separator");
- StringBuffer niceSourceList = new StringBuffer("Files to be compiled:" + eol);
+ log("Files to be compiled:", Project.MSG_VERBOSE);
- final int size = compileList.size();
- for (int i = 0; i < size; i++) {
- niceSourceList.append(" ");
- niceSourceList.append(compileList.elementAt(i).toString());
- niceSourceList.append(eol);
- }
-
- log(niceSourceList.toString(), Project.MSG_VERBOSE);
+ final String eol = System.getProperty("line.separator");
+ log(
+ compileList.stream().map(s -> " " + s).collect(Collectors.joining(eol))
+ , Project.MSG_VERBOSE);
+ // create a single array of arguments for the compiler
+ String[] compileArgs =
+ Stream.concat(Stream.of(compileOptionsArray), compileList.stream())
+ .toArray(String[]::new);
+
// need to set java.class.path property and restore it later
// since the NetRexx compiler has no option for the classpath
String currentClassPath = System.getProperty("java.class.path");
@@ -865,7 +796,7 @@ public class NetRexxC extends MatchingTask {
try {
StringWriter out = new StringWriter();
- PrintWriter w = null;
+ PrintWriter w;
int rc =
COM.ibm.netrexx.process.NetRexxC.main(new Rexx(compileArgs),
w = new PrintWriter(out)); //NOSONAR
@@ -873,17 +804,18 @@ public class NetRexxC extends MatchingTask {
String ddir = destDir.getAbsolutePath();
boolean doReplace = !(sdir.equals(ddir));
int dlen = ddir.length();
- String l;
BufferedReader in = new BufferedReader(new StringReader(out.toString()));
log("replacing destdir '" + ddir + "' through sourcedir '"
+ sdir + "'", Project.MSG_VERBOSE);
+
+ String l;
while ((l = in.readLine()) != null) {
int idx;
while (doReplace && ((idx = l.indexOf(ddir)) != -1)) {
// path is mentioned in the message
- l = (new StringBuffer(l)).replace(idx, idx + dlen, sdir).toString();
+ l = new StringBuilder(l).replace(idx, idx + dlen, sdir).toString();
}
// verbose level logging for suppressed messages
if (suppressMethodArgumentNotUsed
@@ -912,28 +844,26 @@ public class NetRexxC extends MatchingTask {
}
}
if (rc > 1) {
- throw new BuildException("Compile failed, messages should "
- + "have been provided.");
+ throw new BuildException(
+ "Compile failed, messages should have been provided.");
}
if (w.checkError()) {
throw new IOException("Encountered an error");
}
} catch (IOException ioe) {
- throw new BuildException("Unexpected IOException while "
- + "playing with Strings", ioe);
+ throw new BuildException(
+ "Unexpected IOException while playing with Strings", ioe);
} finally {
// need to reset java.class.path property
// since the NetRexx compiler has no option for the classpath
currentProperties = System.getProperties();
currentProperties.put("java.class.path", currentClassPath);
}
-
}
-
/** Builds the compilation classpath. */
private String getCompileClasspath() {
- StringBuffer classpath = new StringBuffer();
+ StringBuilder classpath = new StringBuilder();
// add dest dir to classpath so that previously compiled and
// untouched classes are on classpath
@@ -945,49 +875,43 @@ public class NetRexxC extends MatchingTask {
}
// add the system classpath
- // addExistingToClasspath(classpath,System.getProperty("java.class.path"));
return classpath.toString();
}
-
/** This */
private String[] getCompileOptionsAsArray() {
- Vector options = new Vector();
-
- options.addElement(binary ? "-binary" : "-nobinary");
- options.addElement(comments ? "-comments" : "-nocomments");
- options.addElement(compile ? "-compile" : "-nocompile");
- options.addElement(compact ? "-compact" : "-nocompact");
- options.addElement(console ? "-console" : "-noconsole");
- options.addElement(crossref ? "-crossref" : "-nocrossref");
- options.addElement(decimal ? "-decimal" : "-nodecimal");
- options.addElement(diag ? "-diag" : "-nodiag");
- options.addElement(explicit ? "-explicit" : "-noexplicit");
- options.addElement(format ? "-format" : "-noformat");
- options.addElement(keep ? "-keep" : "-nokeep");
- options.addElement(logo ? "-logo" : "-nologo");
- options.addElement(replace ? "-replace" : "-noreplace");
- options.addElement(savelog ? "-savelog" : "-nosavelog");
- options.addElement(sourcedir ? "-sourcedir" : "-nosourcedir");
- options.addElement(strictargs ? "-strictargs" : "-nostrictargs");
- options.addElement(strictassign ? "-strictassign" : "-nostrictassign");
- options.addElement(strictcase ? "-strictcase" : "-nostrictcase");
- options.addElement(strictimport ? "-strictimport" : "-nostrictimport");
- options.addElement(strictprops ? "-strictprops" : "-nostrictprops");
- options.addElement(strictsignal ? "-strictsignal" : "-nostrictsignal");
- options.addElement(symbols ? "-symbols" : "-nosymbols");
- options.addElement(time ? "-time" : "-notime");
- options.addElement("-" + trace);
- options.addElement(utf8 ? "-utf8" : "-noutf8");
- options.addElement("-" + verbose);
-
- String[] results = new String[options.size()];
-
- options.copyInto(results);
- return results;
+ List<String> options = new ArrayList<>();
+
+ options.add(binary ? "-binary" : "-nobinary");
+ options.add(comments ? "-comments" : "-nocomments");
+ options.add(compile ? "-compile" : "-nocompile");
+ options.add(compact ? "-compact" : "-nocompact");
+ options.add(console ? "-console" : "-noconsole");
+ options.add(crossref ? "-crossref" : "-nocrossref");
+ options.add(decimal ? "-decimal" : "-nodecimal");
+ options.add(diag ? "-diag" : "-nodiag");
+ options.add(explicit ? "-explicit" : "-noexplicit");
+ options.add(format ? "-format" : "-noformat");
+ options.add(keep ? "-keep" : "-nokeep");
+ options.add(logo ? "-logo" : "-nologo");
+ options.add(replace ? "-replace" : "-noreplace");
+ options.add(savelog ? "-savelog" : "-nosavelog");
+ options.add(sourcedir ? "-sourcedir" : "-nosourcedir");
+ options.add(strictargs ? "-strictargs" : "-nostrictargs");
+ options.add(strictassign ? "-strictassign" : "-nostrictassign");
+ options.add(strictcase ? "-strictcase" : "-nostrictcase");
+ options.add(strictimport ? "-strictimport" : "-nostrictimport");
+ options.add(strictprops ? "-strictprops" : "-nostrictprops");
+ options.add(strictsignal ? "-strictsignal" : "-nostrictsignal");
+ options.add(symbols ? "-symbols" : "-nosymbols");
+ options.add(time ? "-time" : "-notime");
+ options.add("-" + trace);
+ options.add(utf8 ? "-utf8" : "-noutf8");
+ options.add("-" + verbose);
+
+ return options.toArray(new String[options.size()]);
}
-
/**
* Takes a classpath-like string, and adds each element of this string to
* a new classpath, if the components exist. Components that don't exist,
@@ -998,7 +922,7 @@ public class NetRexxC extends MatchingTask {
* @param target - target classpath
* @param source - source classpath to get file objects.
*/
- private void addExistingToClasspath(StringBuffer target, String source) {
+ private void addExistingToClasspath(StringBuilder target, String source) {
StringTokenizer tok = new StringTokenizer(source,
System.getProperty("path.separator"), false);
@@ -1013,17 +937,16 @@ public class NetRexxC extends MatchingTask {
+ f.getAbsolutePath(), Project.MSG_VERBOSE);
}
}
-
}
-
/**
* Enumerated class corresponding to the trace attribute.
*/
public static class TraceAttr extends EnumeratedAttribute {
/** {@inheritDoc}. */
+ @Override
public String[] getValues() {
- return new String[]{"trace", "trace1", "trace2", "notrace"};
+ return new String[] { "trace", "trace1", "trace2", "notrace" };
}
}
@@ -1032,11 +955,10 @@ public class NetRexxC extends MatchingTask {
*/
public static class VerboseAttr extends EnumeratedAttribute {
/** {@inheritDoc}. */
+ @Override
public String[] getValues() {
- return new String[]{"verbose", "verbose0", "verbose1",
- "verbose2", "verbose3", "verbose4",
- "verbose5", "noverbose"};
+ return new String[] { "verbose", "verbose0", "verbose1", "verbose2",
+ "verbose3", "verbose4", "verbose5", "noverbose" };
}
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
index 5a3c215..32239ce 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
@@ -31,7 +31,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -139,7 +138,7 @@ public class PropertyFile extends Task {
private File propertyfile;
private boolean useJDKProperties;
- private Vector entries = new Vector();
+ private Vector<Entry> entries = new Vector<>();
/* ========================================================================
*
@@ -174,10 +173,7 @@ public class PropertyFile extends Task {
}
private void executeOperation() throws BuildException {
- for (Enumeration e = entries.elements(); e.hasMoreElements();) {
- Entry entry = (Entry) e.nextElement();
- entry.executeOn(properties);
- }
+ entries.forEach(e -> e.executeOn(properties));
}
private void readFile() throws BuildException {
@@ -266,7 +262,7 @@ public class PropertyFile extends Task {
}
private boolean checkParam(File param) {
- return !(param == null);
+ return param != null;
}
/**
@@ -384,8 +380,8 @@ public class PropertyFile extends Task {
} else if (type == Type.STRING_TYPE) {
executeString(oldValue);
} else {
- throw new BuildException("Unknown operation type: "
- + type);
+ throw new BuildException("Unknown operation type: %d",
+ type);
}
} catch (NullPointerException npe) {
// Default to string type
@@ -447,7 +443,6 @@ public class PropertyFile extends Task {
newValue = fmt.format(currentValue.getTime());
}
-
/**
* Handle operations for type <code>int</code>.
*
@@ -459,7 +454,6 @@ public class PropertyFile extends Task {
int currentValue = DEFAULT_INT_VALUE;
int newV = DEFAULT_INT_VALUE;
-
DecimalFormat fmt = (pattern != null) ? new DecimalFormat(pattern)
: new DecimalFormat();
try {
@@ -535,15 +529,17 @@ public class PropertyFile extends Task {
+ "properties (key:" + key + ")");
}
if (value == null && defaultValue == null && operation != Operation.DELETE_OPER) {
- throw new BuildException("\"value\" and/or \"default\" "
- + "attribute must be specified (key:" + key + ")");
+ throw new BuildException(
+ "\"value\" and/or \"default\" attribute must be specified (key: %s)",
+ key);
}
if (key == null) {
throw new BuildException("key is mandatory");
}
if (type == Type.STRING_TYPE && pattern != null) {
- throw new BuildException("pattern is not supported for string "
- + "properties (key:" + key + ")");
+ throw new BuildException(
+ "pattern is not supported for string properties (key: %s)",
+ key);
}
}
@@ -582,7 +578,7 @@ public class PropertyFile extends Task {
ret = defaultValue;
}
} else {
- ret = (oldValue == null) ? defaultValue : oldValue;
+ ret = oldValue == null ? defaultValue : oldValue;
}
return ret;
@@ -606,7 +602,7 @@ public class PropertyFile extends Task {
/** {@inheritDoc}. */
@Override
public String[] getValues() {
- return new String[] {"+", "-", "=", "del"};
+ return new String[] { "+", "-", "=", "del" };
}
/**
@@ -617,9 +613,11 @@ public class PropertyFile extends Task {
public static int toOperation(String oper) {
if ("+".equals(oper)) {
return INCREMENT_OPER;
- } else if ("-".equals(oper)) {
+ }
+ if ("-".equals(oper)) {
return DECREMENT_OPER;
- } else if ("del".equals(oper)) {
+ }
+ if ("del".equals(oper)) {
return DELETE_OPER;
}
return EQUALS_OPER;
@@ -642,7 +640,7 @@ public class PropertyFile extends Task {
/** {@inheritDoc} */
@Override
public String[] getValues() {
- return new String[] {"int", "date", "string"};
+ return new String[] { "int", "date", "string" };
}
/**
@@ -653,7 +651,8 @@ public class PropertyFile extends Task {
public static int toType(String type) {
if ("int".equals(type)) {
return INTEGER_TYPE;
- } else if ("date".equals(type)) {
+ }
+ if ("date".equals(type)) {
return DATE_TYPE;
}
return STRING_TYPE;
@@ -677,23 +676,22 @@ public class PropertyFile extends Task {
private static final String MONTH = "month";
private static final String YEAR = "year";
- private static final String[] UNITS
- = {MILLISECOND, SECOND, MINUTE, HOUR,
- DAY, WEEK, MONTH, YEAR };
+ private static final String[] UNITS =
+ { MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR };
- private Map calendarFields = new HashMap();
+ private Map<String, Integer> calendarFields = new HashMap<>();
/** no arg constructor */
public Unit() {
calendarFields.put(MILLISECOND,
- new Integer(Calendar.MILLISECOND));
- calendarFields.put(SECOND, new Integer(Calendar.SECOND));
- calendarFields.put(MINUTE, new Integer(Calendar.MINUTE));
- calendarFields.put(HOUR, new Integer(Calendar.HOUR_OF_DAY));
- calendarFields.put(DAY, new Integer(Calendar.DATE));
- calendarFields.put(WEEK, new Integer(Calendar.WEEK_OF_YEAR));
- calendarFields.put(MONTH, new Integer(Calendar.MONTH));
- calendarFields.put(YEAR, new Integer(Calendar.YEAR));
+ Integer.valueOf(Calendar.MILLISECOND));
+ calendarFields.put(SECOND, Integer.valueOf(Calendar.SECOND));
+ calendarFields.put(MINUTE, Integer.valueOf(Calendar.MINUTE));
+ calendarFields.put(HOUR, Integer.valueOf(Calendar.HOUR_OF_DAY));
+ calendarFields.put(DAY, Integer.valueOf(Calendar.DATE));
+ calendarFields.put(WEEK, Integer.valueOf(Calendar.WEEK_OF_YEAR));
+ calendarFields.put(MONTH, Integer.valueOf(Calendar.MONTH));
+ calendarFields.put(YEAR, Integer.valueOf(Calendar.YEAR));
}
/**
@@ -701,9 +699,7 @@ public class PropertyFile extends Task {
* @return the calendar value.
*/
public int getCalendarField() {
- String key = getValue().toLowerCase();
- Integer i = (Integer) calendarFields.get(key);
- return i.intValue();
+ return calendarFields.get(getValue().toLowerCase()).intValue();
}
/** {@inheritDoc}. */
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
index f5357bb..afc9a54 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
@@ -27,6 +27,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import org.apache.tools.ant.BuildException;
@@ -143,7 +144,6 @@ public class ReplaceRegExp extends Task {
this.subs = null;
}
-
/**
* file for which the regular expression should be replaced;
* required unless a nested fileset is supplied.
@@ -153,7 +153,6 @@ public class ReplaceRegExp extends Task {
this.file = file;
}
-
/**
* the regular expression pattern to match in the file(s);
* required if no nested <regexp> is used
@@ -168,7 +167,6 @@ public class ReplaceRegExp extends Task {
regex.setPattern(match);
}
-
/**
* The substitution pattern to place in the file(s) in place
* of the regular expression.
@@ -178,8 +176,8 @@ public class ReplaceRegExp extends Task {
public void setReplace(String replace) {
if (subs != null) {
- throw new BuildException("Only one substitution expression is "
- + "allowed");
+ throw new BuildException(
+ "Only one substitution expression is allowed");
}
subs = new Substitution();
@@ -205,7 +203,6 @@ public class ReplaceRegExp extends Task {
this.flags = flags;
}
-
/**
* Process the file(s) one line at a time, executing the replacement
* on one line at a time. This is useful if you
@@ -219,12 +216,7 @@ public class ReplaceRegExp extends Task {
*/
@Deprecated
public void setByLine(String byline) {
- Boolean res = Boolean.valueOf(byline);
-
- if (res == null) {
- res = Boolean.FALSE;
- }
- this.byline = res.booleanValue();
+ this.byline = Boolean.parseBoolean(byline);
}
/**
@@ -297,8 +289,8 @@ public class ReplaceRegExp extends Task {
*/
public Substitution createSubstitution() {
if (subs != null) {
- throw new BuildException("Only one substitution expression is "
- + "allowed");
+ throw new BuildException(
+ "Only one substitution expression is allowed");
}
subs = new Substitution();
@@ -341,7 +333,6 @@ public class ReplaceRegExp extends Task {
return res;
}
-
/**
* Perform the replacement on a file
*
@@ -355,13 +346,14 @@ public class ReplaceRegExp extends Task {
try {
boolean changes = false;
+ final Charset charset = encoding == null ? Charset.defaultCharset() : Charset.forName(encoding);
try (InputStream is = Files.newInputStream(f.toPath());
OutputStream os = Files.newOutputStream(temp.toPath())) {
Reader r = null;
Writer w = null;
try {
- r = encoding != null ? new InputStreamReader(is, encoding) : new InputStreamReader(is);
- w = encoding != null ? new OutputStreamWriter(os, encoding) : new OutputStreamWriter(os);
+ r = new InputStreamReader(is, charset);
+ w = new OutputStreamWriter(os, charset);
log("Replacing pattern '" + regex.getPattern(getProject())
+ "' with '" + subs.getExpression(getProject())
+ "' in '" + f.getPath() + "'" + (byline ? " by line" : "")
@@ -372,7 +364,7 @@ public class ReplaceRegExp extends Task {
r = new BufferedReader(r);
w = new BufferedWriter(w);
- StringBuffer linebuf = new StringBuffer();
+ StringBuilder linebuf = new StringBuilder();
int c;
boolean hasCR = false;
@@ -386,7 +378,7 @@ public class ReplaceRegExp extends Task {
w, options);
w.write('\r');
- linebuf = new StringBuffer();
+ linebuf = new StringBuilder();
// hasCR is still true (for the second one)
} else {
// first CR in this line
@@ -402,7 +394,7 @@ public class ReplaceRegExp extends Task {
}
w.write('\n');
- linebuf = new StringBuffer();
+ linebuf = new StringBuilder();
} else { // any other char
if ((hasCR) || (c < 0)) {
// Mac-style linebreak or EOF (or both)
@@ -413,7 +405,7 @@ public class ReplaceRegExp extends Task {
hasCR = false;
}
- linebuf = new StringBuffer();
+ linebuf = new StringBuilder();
}
if (c >= 0) {
@@ -453,7 +445,6 @@ public class ReplaceRegExp extends Task {
}
}
-
/**
* Execute the task
*
@@ -469,9 +460,8 @@ public class ReplaceRegExp extends Task {
}
if (file != null && resources != null) {
- throw new BuildException("You cannot supply the 'file' attribute "
- + "and resource collections at the same "
- + "time.");
+ throw new BuildException(
+ "You cannot supply the 'file' attribute and resource collections at the same time.");
}
int options = RegexpUtil.asOptions(flags);
@@ -491,9 +481,7 @@ public class ReplaceRegExp extends Task {
if (resources != null) {
for (Resource r : resources) {
- FileProvider fp =
- r.as(FileProvider.class);
- File f = fp.getFile();
+ File f = r.as(FileProvider.class).getFile();
if (f.exists()) {
try {
@@ -523,5 +511,3 @@ public class ReplaceRegExp extends Task {
return !res.equals(s);
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java b/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
index d1e945c..7ecf35d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
@@ -110,6 +110,7 @@ public class Rpm extends Task {
*
* @throws BuildException is there is a problem in the task execution.
*/
+ @Override
public void execute() throws BuildException {
Commandline toExecute = new Commandline();
@@ -227,7 +228,7 @@ public class Rpm extends Task {
* @param sf the spec file name to use.
*/
public void setSpecFile(String sf) {
- if ((sf == null) || (sf.trim().length() == 0)) {
+ if (sf == null || sf.trim().isEmpty()) {
throw new BuildException("You must specify a spec file", getLocation());
}
this.specFile = sf;
@@ -320,20 +321,20 @@ public class Rpm extends Task {
* @since 1.6
*/
protected String guessRpmBuildCommand() {
- Map/*<String, String>*/ env = Execute.getEnvironmentVariables();
- String path = (String) env.get(PATH1);
+ Map<String, String> env = Execute.getEnvironmentVariables();
+ String path = env.get(PATH1);
if (path == null) {
- path = (String) env.get(PATH2);
+ path = env.get(PATH2);
if (path == null) {
- path = (String) env.get(PATH3);
+ path = env.get(PATH3);
}
}
if (path != null) {
Path p = new Path(getProject(), path);
String[] pElements = p.list();
- for (int i = 0; i < pElements.length; i++) {
- File f = new File(pElements[i],
+ for (String pElement : pElements) {
+ File f = new File(pElement,
"rpmbuild"
+ (Os.isFamily("dos") ? ".exe" : ""));
if (f.canRead()) {
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
index e57d6d2..a5db991 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
@@ -20,7 +20,8 @@ package org.apache.tools.ant.taskdefs.optional;
import java.io.File;
import java.net.MalformedURLException;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.Map;
+import java.util.stream.Collectors;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
@@ -48,23 +49,6 @@ import org.xml.sax.XMLReader;
*/
public class SchemaValidate extends XMLValidateTask {
-
- /** map of all declared schemas; we catch and complain about redefinitions */
- private HashMap schemaLocations = new HashMap();
-
- /** full checking of a schema */
- private boolean fullChecking = true;
-
- /**
- * flag to disable DTD support. Best left enabled.
- */
- private boolean disableDTD = false;
-
- /**
- * default URL for nonamespace schemas
- */
- private SchemaLocation anonymousSchema;
-
// Error strings
/** SAX1 not supported */
public static final String ERROR_SAX_1 = "SAX1 parsers are not supported";
@@ -88,12 +72,29 @@ public class SchemaValidate extends XMLValidateTask {
public static final String ERROR_DUPLICATE_SCHEMA
= "Duplicate declaration of schema ";
+ /** map of all declared schemas; we catch and complain about redefinitions */
+ private Map<String, SchemaLocation> schemaLocations = new HashMap<>();
+
+ /** full checking of a schema */
+ private boolean fullChecking = true;
+
+ /**
+ * flag to disable DTD support. Best left enabled.
+ */
+ private boolean disableDTD = false;
+
+ /**
+ * default URL for nonamespace schemas
+ */
+ private SchemaLocation anonymousSchema;
+
/**
* Called by the project to let the task initialize properly. The default
* implementation is a no-op.
*
* @throws BuildException if something goes wrong with the build
*/
+ @Override
public void init() throws BuildException {
super.init();
//validating
@@ -155,7 +156,7 @@ public class SchemaValidate extends XMLValidateTask {
public void addConfiguredSchema(SchemaLocation location) {
log("adding schema " + location, Project.MSG_DEBUG);
location.validateNamespace();
- SchemaLocation old = (SchemaLocation) schemaLocations.get(location.getNamespace());
+ SchemaLocation old = schemaLocations.get(location.getNamespace());
if (old != null && !old.equals(location)) {
throw new BuildException(ERROR_DUPLICATE_SCHEMA + location);
}
@@ -213,6 +214,7 @@ public class SchemaValidate extends XMLValidateTask {
*
* @throws BuildException if something went wrong
*/
+ @Override
protected void initValidator() {
super.initValidator();
//validate the parser type
@@ -221,7 +223,6 @@ public class SchemaValidate extends XMLValidateTask {
}
//enable schema
- //setFeature(XmlConstants.FEATURE_VALIDATION, false);
setFeature(XmlConstants.FEATURE_NAMESPACES, true);
if (!enableXercesSchemaValidation() && !enableJAXP12SchemaValidation()) {
//couldnt use the xerces or jaxp calls
@@ -244,6 +245,7 @@ public class SchemaValidate extends XMLValidateTask {
* create our own factory with our own options.
* @return a default XML parser
*/
+ @Override
protected XMLReader createDefaultReader() {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
@@ -252,9 +254,7 @@ public class SchemaValidate extends XMLValidateTask {
try {
SAXParser saxParser = factory.newSAXParser();
reader = saxParser.getXMLReader();
- } catch (ParserConfigurationException e) {
- throw new BuildException(ERROR_PARSER_CREATION_FAILURE, e);
- } catch (SAXException e) {
+ } catch (ParserConfigurationException | SAXException e) {
throw new BuildException(ERROR_PARSER_CREATION_FAILURE, e);
}
return reader;
@@ -265,23 +265,15 @@ public class SchemaValidate extends XMLValidateTask {
* property.
*/
protected void addSchemaLocations() {
- Iterator it = schemaLocations.values().iterator();
- StringBuffer buffer = new StringBuffer();
- int count = 0;
- while (it.hasNext()) {
- if (count > 0) {
- buffer.append(' ');
- }
- SchemaLocation schemaLocation = (SchemaLocation) it.next();
- String tuple = schemaLocation.getURIandLocation();
- buffer.append(tuple);
- log("Adding schema " + tuple, Project.MSG_VERBOSE);
- count++;
+ if (!schemaLocations.isEmpty()) {
+ String joinedValue = schemaLocations.values().stream()
+ .map(SchemaLocation::getURIandLocation)
+ .peek(
+ tuple -> log("Adding schema " + tuple, Project.MSG_VERBOSE))
+ .collect(Collectors.joining(" "));
+
+ setProperty(XmlConstants.PROPERTY_SCHEMA_LOCATION, joinedValue);
}
- if (count > 0) {
- setProperty(XmlConstants.PROPERTY_SCHEMA_LOCATION, buffer.toString());
- }
-
}
/**
@@ -289,11 +281,8 @@ public class SchemaValidate extends XMLValidateTask {
* @return the schema URL
*/
protected String getNoNamespaceSchemaURL() {
- if (anonymousSchema == null) {
- return null;
- } else {
- return anonymousSchema.getSchemaLocationURL();
- }
+ return anonymousSchema == null ? null
+ : anonymousSchema.getSchemaLocationURL();
}
/**
@@ -317,6 +306,7 @@ public class SchemaValidate extends XMLValidateTask {
*
* @param fileProcessed number of files processed.
*/
+ @Override
protected void onSuccessfulValidation(int fileProcessed) {
log(fileProcessed + MESSAGE_FILES_VALIDATED, Project.MSG_VERBOSE);
}
@@ -350,10 +340,6 @@ public class SchemaValidate extends XMLValidateTask {
public static final String ERROR_NO_LOCATION
= "No file or URL supplied for the schema ";
- /** No arg constructor */
- public SchemaLocation() {
- }
-
/**
* Get the namespace.
* @return the namespace.
@@ -442,11 +428,8 @@ public class SchemaValidate extends XMLValidateTask {
*/
public String getURIandLocation() throws BuildException {
validateNamespace();
- StringBuffer buffer = new StringBuffer();
- buffer.append(namespace);
- buffer.append(' ');
- buffer.append(getSchemaLocationURL());
- return new String(buffer);
+ return new StringBuilder(namespace).append(' ')
+ .append(getSchemaLocationURL()).toString();
}
/**
@@ -465,7 +448,7 @@ public class SchemaValidate extends XMLValidateTask {
* @return true if it is not null or empty
*/
private boolean isSet(String property) {
- return property != null && property.length() != 0;
+ return property != null && !property.isEmpty();
}
/**
@@ -474,6 +457,7 @@ public class SchemaValidate extends XMLValidateTask {
* @return true iff the objects are considered equal in value
*/
+ @Override
public boolean equals(Object o) {
if (this == o) {
return true;
@@ -502,6 +486,7 @@ public class SchemaValidate extends XMLValidateTask {
* Generate a hashcode depending on the namespace, url and file name.
* @return the hashcode.
*/
+ @Override
public int hashCode() {
int result;
// CheckStyle:MagicNumber OFF
@@ -517,8 +502,9 @@ public class SchemaValidate extends XMLValidateTask {
* and the like
* @return a string representation of the object.
*/
+ @Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
buffer.append(namespace != null ? namespace : "(anonymous)");
buffer.append(' ');
buffer.append(url != null ? (url + " ") : "");
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
index f6a94b5..a872f48 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
@@ -29,12 +29,20 @@ import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;
-
/**
* Class common to all check commands (checkout, checkin,checkin default task);
* @ant.task ignore="true"
*/
public class CCMCheck extends Continuus {
+ /**
+ * -comment flag -- comment to attach to the file
+ */
+ public static final String FLAG_COMMENT = "/comment";
+
+ /**
+ * -task flag -- associate checkout task with task
+ */
+ public static final String FLAG_TASK = "/task";
private File file = null;
private String comment = null;
@@ -42,15 +50,10 @@ public class CCMCheck extends Continuus {
// CheckStyle:VisibilityModifier OFF - bc
- protected Vector filesets = new Vector();
+ protected Vector<FileSet> filesets = new Vector<>();
// CheckStyle:VisibilityModifier ON
- /** Constructor for CCMCheck. */
- public CCMCheck() {
- super();
- }
-
/**
* Get the value of file.
* @return value of file.
@@ -84,7 +87,6 @@ public class CCMCheck extends Continuus {
this.comment = v;
}
-
/**
* Get the value of task.
* @return value of task.
@@ -102,7 +104,6 @@ public class CCMCheck extends Continuus {
this.task = v;
}
-
/**
* Adds a set of files to copy.
* @param set the set of files
@@ -120,9 +121,10 @@ public class CCMCheck extends Continuus {
* </p>
* @throws BuildException on error
*/
+ @Override
public void execute() throws BuildException {
- if (file == null && filesets.size() == 0) {
+ if (file == null && filesets.isEmpty()) {
throw new BuildException(
"Specify at least one source - a file or a fileset.");
}
@@ -131,7 +133,7 @@ public class CCMCheck extends Continuus {
throw new BuildException("CCMCheck cannot be generated for directories");
}
- if (file != null && filesets.size() > 0) {
+ if (file != null && !filesets.isEmpty()) {
throw new BuildException("Choose between file and fileset !");
}
@@ -140,14 +142,11 @@ public class CCMCheck extends Continuus {
return;
}
- int sizeofFileSet = filesets.size();
- for (int i = 0; i < sizeofFileSet; i++) {
- FileSet fs = (FileSet) filesets.elementAt(i);
+ for (FileSet fs : filesets) {
+ final File basedir = fs.getDir(getProject());
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
- String[] srcFiles = ds.getIncludedFiles();
- for (int j = 0; j < srcFiles.length; j++) {
- File src = new File(fs.getDir(getProject()), srcFiles[j]);
- setFile(src);
+ for (String srcFile : ds.getIncludedFiles()) {
+ setFile(new File(basedir, srcFile));
doit();
}
}
@@ -170,12 +169,11 @@ public class CCMCheck extends Continuus {
int result = run(commandLine);
if (Execute.isFailure(result)) {
- String msg = "Failed executing: " + commandLine.toString();
- throw new BuildException(msg, getLocation());
+ throw new BuildException("Failed executing: " + commandLine,
+ getLocation());
}
}
-
/**
* Check the command line options.
*/
@@ -195,14 +193,4 @@ public class CCMCheck extends Continuus {
}
}
- /**
- * -comment flag -- comment to attach to the file
- */
- public static final String FLAG_COMMENT = "/comment";
-
- /**
- * -task flag -- associate checkout task with task
- */
- public static final String FLAG_TASK = "/task";
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
index ff7472c..3f274d7 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
@@ -36,4 +36,3 @@ public class CCMCheckin extends CCMCheck {
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java
index 2fe2a2a..8bf9fe1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java
@@ -25,14 +25,13 @@ package org.apache.tools.ant.taskdefs.optional.ccm;
*/
public class CCMCheckinDefault extends CCMCheck {
+ /** The default task */
+ public static final String DEFAULT_TASK = "default";
+
/** Constructor for CCMCheckinDefault. */
public CCMCheckinDefault() {
super();
setCcmAction(COMMAND_CHECKIN);
setTask(DEFAULT_TASK);
}
-
- /** The default task */
- public static final String DEFAULT_TASK = "default";
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java
index 44bbc6b..1850cd3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java
@@ -32,4 +32,3 @@ public class CCMCheckout extends CCMCheck {
setCcmAction(COMMAND_CHECKOUT);
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
index 350d673..a3d2d46 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
@@ -38,6 +38,35 @@ import org.apache.tools.ant.util.StringUtils;
* @ant.task name="ccmcreatetask" category="scm"
*/
public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
+ /**
+ * /comment -- comments associated to the task
+ */
+ public static final String FLAG_COMMENT = "/synopsis";
+
+ /**
+ * /platform flag -- target platform
+ */
+ public static final String FLAG_PLATFORM = "/plat";
+
+ /**
+ * /resolver flag
+ */
+ public static final String FLAG_RESOLVER = "/resolver";
+
+ /**
+ * /release flag
+ */
+ public static final String FLAG_RELEASE = "/release";
+
+ /**
+ * /release flag
+ */
+ public static final String FLAG_SUBSYSTEM = "/subsystem";
+
+ /**
+ * -task flag -- associate checkout task with task
+ */
+ public static final String FLAG_TASK = "/task";
private String comment = null;
private String platform = null;
@@ -63,9 +92,9 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
* </p>
* @throws BuildException on error
*/
+ @Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
- int result = 0;
// build the command line from what we got the format
// as specified in the CCM.EXE help
@@ -74,10 +103,9 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
checkOptions(commandLine);
- result = run(commandLine, this);
- if (Execute.isFailure(result)) {
- String msg = "Failed executing: " + commandLine.toString();
- throw new BuildException(msg, getLocation());
+ if (Execute.isFailure(run(commandLine, this))) {
+ throw new BuildException("Failed executing: " + commandLine,
+ getLocation());
}
//create task ok, set this task as the default one
@@ -88,15 +116,12 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
log(commandLine.describeCommand(), Project.MSG_DEBUG);
- result = run(commandLine2);
- if (result != 0) {
- String msg = "Failed executing: " + commandLine2.toString();
- throw new BuildException(msg, getLocation());
+ if (run(commandLine2) != 0) {
+ throw new BuildException("Failed executing: " + commandLine2,
+ getLocation());
}
-
}
-
/**
* Check the command line options.
*/
@@ -127,7 +152,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
} // end of if ()
}
-
/**
* Get the value of comment.
* @return value of comment.
@@ -145,7 +169,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
this.comment = v;
}
-
/**
* Get the value of platform.
* @return value of platform.
@@ -163,7 +186,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
this.platform = v;
}
-
/**
* Get the value of resolver.
* @return value of resolver.
@@ -181,7 +203,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
this.resolver = v;
}
-
/**
* Get the value of release.
* @return value of release.
@@ -216,7 +237,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
this.subSystem = v;
}
-
/**
* Get the value of task.
* @return value of task.
@@ -235,71 +255,45 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
this.task = v;
}
- /**
- * /comment -- comments associated to the task
- */
- public static final String FLAG_COMMENT = "/synopsis";
-
- /**
- * /platform flag -- target platform
- */
- public static final String FLAG_PLATFORM = "/plat";
-
- /**
- * /resolver flag
- */
- public static final String FLAG_RESOLVER = "/resolver";
-
- /**
- * /release flag
- */
- public static final String FLAG_RELEASE = "/release";
-
- /**
- * /release flag
- */
- public static final String FLAG_SUBSYSTEM = "/subsystem";
-
- /**
- * -task flag -- associate checkout task with task
- */
- public static final String FLAG_TASK = "/task";
-
-
// implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface
/**
*
* @throws IOException on error
*/
+ @Override
public void start() throws IOException {
}
/**
*
*/
+ @Override
public void stop() {
}
/**
*
* @param param1 the output stream
- * @exception java.io.IOException on error
+ * @exception IOException on error
*/
+ @Override
public void setProcessInputStream(OutputStream param1) throws IOException {
}
/**
*
* @param is the input stream
- * @exception java.io.IOException on error
+ * @exception IOException on error
*/
+ @Override
public void setProcessErrorStream(InputStream is) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- String s = reader.readLine();
- if (s != null) {
- log("err " + s, Project.MSG_DEBUG);
- } // end of if ()
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
+ String s = reader.readLine();
+ if (s != null) {
+ log("err " + s, Project.MSG_DEBUG);
+ } // end of if ()
+ }
}
/**
@@ -307,12 +301,11 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
* @param is InputStream
* @throws IOException on error
*/
+ @Override
public void setProcessOutputStream(InputStream is) throws IOException {
-
- String buffer = "";
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- buffer = reader.readLine();
+ try (BufferedReader reader =
+ new BufferedReader(new InputStreamReader(is))) {
+ String buffer = reader.readLine();
if (buffer != null) {
log("buffer:" + buffer, Project.MSG_DEBUG);
String taskstring = buffer.substring(buffer.indexOf(' ')).trim();
@@ -323,7 +316,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
} catch (NullPointerException npe) {
log("error procession stream , null pointer exception", Project.MSG_ERR);
log(StringUtils.getStackTrace(npe), Project.MSG_ERR);
- throw new BuildException(npe.getClass().getName());
+ throw new BuildException(npe);
} catch (Exception e) {
log("error procession stream " + e.getMessage(), Project.MSG_ERR);
throw new BuildException(e.getMessage());
@@ -332,4 +325,3 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
index 28f8064..a45f8bf 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
@@ -28,6 +28,21 @@ import org.apache.tools.ant.types.Commandline;
* Task allows to reconfigure a project, recursively or not
*/
public class CCMReconfigure extends Continuus {
+ /**
+ * /recurse --
+ */
+ public static final String FLAG_RECURSE = "/recurse";
+
+ /**
+ * /recurse --
+ */
+ public static final String FLAG_VERBOSE = "/verbose";
+
+
+ /**
+ * /project flag -- target project
+ */
+ public static final String FLAG_PROJECT = "/project";
private String ccmProject = null;
private boolean recurse = false;
@@ -39,7 +54,6 @@ public class CCMReconfigure extends Continuus {
setCcmAction(COMMAND_RECONFIGURE);
}
-
/**
* Executes the task.
* <p>
@@ -48,9 +62,9 @@ public class CCMReconfigure extends Continuus {
* </p>
* @throws BuildException on error
*/
+ @Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
- int result = 0;
// build the command line from what we got the format
// as specified in the CCM.EXE help
@@ -59,14 +73,13 @@ public class CCMReconfigure extends Continuus {
checkOptions(commandLine);
- result = run(commandLine);
+ int result = run(commandLine);
if (Execute.isFailure(result)) {
- String msg = "Failed executing: " + commandLine.toString();
- throw new BuildException(msg, getLocation());
+ throw new BuildException("Failed executing: " + commandLine,
+ getLocation());
}
}
-
/**
* Check the command line options.
*/
@@ -103,7 +116,6 @@ public class CCMReconfigure extends Continuus {
this.ccmProject = v;
}
-
/**
* Get the value of recurse.
* @return value of recurse.
@@ -121,7 +133,6 @@ public class CCMReconfigure extends Continuus {
this.recurse = v;
}
-
/**
* Get the value of verbose.
* @return value of verbose.
@@ -138,22 +149,4 @@ public class CCMReconfigure extends Continuus {
this.verbose = v;
}
-
- /**
- * /recurse --
- */
- public static final String FLAG_RECURSE = "/recurse";
-
- /**
- * /recurse --
- */
- public static final String FLAG_VERBOSE = "/verbose";
-
-
- /**
- * /project flag -- target project
- */
- public static final String FLAG_PROJECT = "/project";
-
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
index 5618dd6..845c7bf 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
@@ -18,6 +18,8 @@
package org.apache.tools.ant.taskdefs.optional.ccm;
+import java.io.IOException;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -39,6 +41,32 @@ import org.apache.tools.ant.util.FileUtils;
*
*/
public abstract class Continuus extends Task {
+ /**
+ * Constant for the thing to execute
+ */
+ private static final String CCM_EXE = "ccm";
+
+ /**
+ * The 'CreateTask' command
+ */
+ public static final String COMMAND_CREATE_TASK = "create_task";
+ /**
+ * The 'Checkout' command
+ */
+ public static final String COMMAND_CHECKOUT = "co";
+ /**
+ * The 'Checkin' command
+ */
+ public static final String COMMAND_CHECKIN = "ci";
+ /**
+ * The 'Reconfigure' command
+ */
+ public static final String COMMAND_RECONFIGURE = "reconfigure";
+
+ /**
+ * The 'Reconfigure' command
+ */
+ public static final String COMMAND_DEFAULT_TASK = "default_task";
private String ccmDir = "";
private String ccmAction = "";
@@ -60,7 +88,6 @@ public abstract class Continuus extends Task {
this.ccmAction = v;
}
-
/**
* Set the directory where the ccm executable is located.
*
@@ -76,7 +103,7 @@ public abstract class Continuus extends Task {
*/
protected final String getCcmCommand() {
String toReturn = ccmDir;
- if (!toReturn.equals("") && !toReturn.endsWith("/")) {
+ if (!("".equals(toReturn) || toReturn.endsWith("/"))) {
toReturn += "/";
}
@@ -85,7 +112,6 @@ public abstract class Continuus extends Task {
return toReturn;
}
-
/**
* Run the command.
* @param cmd the command line
@@ -99,7 +125,7 @@ public abstract class Continuus extends Task {
exe.setWorkingDirectory(getProject().getBaseDir());
exe.setCommandline(cmd.getCommandline());
return exe.execute();
- } catch (java.io.IOException e) {
+ } catch (IOException e) {
throw new BuildException(e, getLocation());
}
}
@@ -113,32 +139,4 @@ public abstract class Continuus extends Task {
return run(cmd, new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN));
}
- /**
- * Constant for the thing to execute
- */
- private static final String CCM_EXE = "ccm";
-
- /**
- * The 'CreateTask' command
- */
- public static final String COMMAND_CREATE_TASK = "create_task";
- /**
- * The 'Checkout' command
- */
- public static final String COMMAND_CHECKOUT = "co";
- /**
- * The 'Checkin' command
- */
- public static final String COMMAND_CHECKIN = "ci";
- /**
- * The 'Reconfigure' command
- */
- public static final String COMMAND_RECONFIGURE = "reconfigure";
-
- /**
- * The 'Reconfigure' command
- */
- public static final String COMMAND_DEFAULT_TASK = "default_task";
-
-
}
http://git-wip-us.apache.org/repos/asf/ant/blob/b7d1e9bd/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
index 371d418..3e65848 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
@@ -78,6 +78,41 @@ import org.apache.tools.ant.types.Commandline;
*
*/
public class CCCheckin extends ClearCase {
+ /**
+ * -c flag -- comment to attach to the file
+ */
+ public static final String FLAG_COMMENT = "-c";
+
+ /**
+ * -cfile flag -- file containing a comment to attach to the file
+ */
+ public static final String FLAG_COMMENTFILE = "-cfile";
+
+ /**
+ * -nc flag -- no comment is specified
+ */
+ public static final String FLAG_NOCOMMENT = "-nc";
+
+ /**
+ * -nwarn flag -- suppresses warning messages
+ */
+ public static final String FLAG_NOWARN = "-nwarn";
+
+ /**
+ * -ptime flag -- preserves the modification time
+ */
+ public static final String FLAG_PRESERVETIME = "-ptime";
+
+ /**
+ * -keep flag -- keeps a copy of the file with a .keep extension
+ */
+ public static final String FLAG_KEEPCOPY = "-keep";
+
+ /**
+ * -identical flag -- allows the file to be checked in even if it is identical to the original
+ */
+ public static final String FLAG_IDENTICAL = "-identical";
+
private String mComment = null;
private String mCfile = null;
private boolean mNwarn = false;
@@ -92,10 +127,10 @@ public class CCCheckin extends ClearCase {
* to execute the command line.
* @throws BuildException if the command fails and failonerr is set to true
*/
+ @Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
Project aProj = getProject();
- int result = 0;
// Default the viewpath to basedir if it is not specified
if (getViewPath() == null) {
@@ -114,14 +149,12 @@ public class CCCheckin extends ClearCase {
getProject().log("Ignoring any errors that occur for: "
+ getViewPathBasename(), Project.MSG_VERBOSE);
}
- result = run(commandLine);
+ int result = run(commandLine);
if (Execute.isFailure(result) && getFailOnErr()) {
- String msg = "Failed executing: " + commandLine.toString();
- throw new BuildException(msg, getLocation());
+ throw new BuildException("Failed executing: " + commandLine, getLocation());
}
}
-
/**
* Check the command line options.
*/
@@ -272,7 +305,6 @@ public class CCCheckin extends ClearCase {
return mIdentical;
}
-
/**
* Get the 'comment' command
*
@@ -309,35 +341,5 @@ public class CCCheckin extends ClearCase {
}
}
-
- /**
- * -c flag -- comment to attach to the file
- */
- public static final String FLAG_COMMENT = "-c";
- /**
- * -cfile flag -- file containing a comment to attach to the file
- */
- public static final String FLAG_COMMENTFILE = "-cfile";
- /**
- * -nc flag -- no comment is specified
- */
- public static final String FLAG_NOCOMMENT = "-nc";
- /**
- * -nwarn flag -- suppresses warning messages
- */
- public static final String FLAG_NOWARN = "-nwarn";
- /**
- * -ptime flag -- preserves the modification time
- */
- public static final String FLAG_PRESERVETIME = "-ptime";
- /**
- * -keep flag -- keeps a copy of the file with a .keep extension
- */
- public static final String FLAG_KEEPCOPY = "-keep";
- /**
- * -identical flag -- allows the file to be checked in even if it is identical to the original
- */
- public static final String FLAG_IDENTICAL = "-identical";
-
}