Submitted by: Larry Shatzer And some (untabify (point-min) (point-max)) on some files. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277063 13f79535-47bb-0310-9956-ffa450edef68master
@@ -21,7 +21,7 @@ | |||
The purpose have this XSL is to provide a fast way to update a buildfile | |||
from deprecated tasks. | |||
It should particulary be useful when there is a lot of build files to migrate. | |||
It should particularly be useful when there is a lot of build files to migrate. | |||
If you do not want to migrate to a particular task and want to keep it for | |||
various reason, just comment the appropriate template. | |||
@@ -518,7 +518,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener { | |||
if (cons.length > 0 && cons[0] != null) { | |||
final String[] strs = new String[NUMBER_OF_STRINGS]; | |||
try { | |||
cons[0].newInstance((Object[])strs); | |||
cons[0].newInstance((Object[]) strs); | |||
// Expecting an exception to be thrown by this call: | |||
// IllegalArgumentException: wrong number of Arguments | |||
} catch (Throwable t) { | |||
@@ -873,7 +873,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener { | |||
base = parent.getResources(name); | |||
// Note: could cause overlaps in case ClassLoader.this.parent has matches. | |||
} else { | |||
// ClassLoader.this.parent is already delegated to from ClassLoader.getResources, no need: | |||
// ClassLoader.this.parent is already delegated to from | |||
// ClassLoader.getResources, no need: | |||
base = new CollectionUtils.EmptyEnumeration(); | |||
} | |||
if (isParentFirst(name)) { | |||
@@ -295,7 +295,7 @@ public class ComponentHelper { | |||
throw new BuildException(message); | |||
} | |||
try { | |||
taskClass.getConstructor((Class[])null); | |||
taskClass.getConstructor((Class[]) null); | |||
// don't have to check for public, since | |||
// getConstructor finds public constructors only. | |||
} catch (NoSuchMethodException e) { | |||
@@ -798,7 +798,7 @@ public class ComponentHelper { | |||
} | |||
public AntTypeDefinition getDefinition(String key) { | |||
return (AntTypeDefinition)(super.get(key)); | |||
return (AntTypeDefinition) (super.get(key)); | |||
} | |||
/** Equivalent to getTypeType */ | |||
@@ -825,7 +825,7 @@ public class ComponentHelper { | |||
boolean found = false; | |||
if (clazz instanceof Class) { | |||
for (Iterator i = values().iterator(); i.hasNext() && !found;) { | |||
found |= (((AntTypeDefinition)(i.next())).getExposedClass( | |||
found |= (((AntTypeDefinition) (i.next())).getExposedClass( | |||
project) == clazz); | |||
} | |||
} | |||
@@ -131,11 +131,11 @@ public final class Diagnostics { | |||
try { | |||
// Package pkg = clazz.getPackage(); | |||
Method method = Class.class.getMethod("getPackage", new Class[0]); | |||
Object pkg = method.invoke(clazz, (Object[])null); | |||
Object pkg = method.invoke(clazz, (Object[]) null); | |||
if (pkg != null) { | |||
// pkg.getImplementationVersion(); | |||
method = pkg.getClass().getMethod("getImplementationVersion", new Class[0]); | |||
Object version = method.invoke(pkg, (Object[])null); | |||
Object version = method.invoke(pkg, (Object[]) null); | |||
return (String) version; | |||
} | |||
} catch (Exception e) { | |||
@@ -1059,7 +1059,9 @@ public class DirectoryScanner | |||
* @since Ant 1.6.3 | |||
*/ | |||
public int getIncludedFilesCount() { | |||
if (filesIncluded == null) throw new IllegalStateException(); | |||
if (filesIncluded == null) { | |||
throw new IllegalStateException(); | |||
} | |||
return filesIncluded.size(); | |||
} | |||
@@ -1137,7 +1139,9 @@ public class DirectoryScanner | |||
* @since Ant 1.6.3 | |||
*/ | |||
public int getIncludedDirsCount() { | |||
if (dirsIncluded == null) throw new IllegalStateException(); | |||
if (dirsIncluded == null) { | |||
throw new IllegalStateException(); | |||
} | |||
return dirsIncluded.size(); | |||
} | |||
@@ -1050,7 +1050,7 @@ public final class IntrospectionHelper implements BuildListener { | |||
return new AttributeSetter(m) { | |||
public void set(Project p, Object parent, String value) | |||
throws InvocationTargetException, IllegalAccessException { | |||
m.invoke(parent, (Object[])(new String[] {value})); | |||
m.invoke(parent, (Object[]) (new String[] {value})); | |||
} | |||
}; | |||
@@ -1075,7 +1075,7 @@ public final class IntrospectionHelper implements BuildListener { | |||
return new AttributeSetter(m) { | |||
public void set(Project p, Object parent, String value) | |||
throws InvocationTargetException, IllegalAccessException { | |||
m.invoke(parent,(Object[])( | |||
m.invoke(parent, (Object[]) ( | |||
new Boolean[] {Project.toBoolean(value) | |||
? Boolean.TRUE : Boolean.FALSE})); | |||
} | |||
@@ -888,7 +888,7 @@ public class Project { | |||
throw new BuildException(message); | |||
} | |||
try { | |||
taskClass.getConstructor((Class[])null); | |||
taskClass.getConstructor((Class[]) null); | |||
// don't have to check for public, since | |||
// getConstructor finds public constructors only. | |||
} catch (NoSuchMethodException e) { | |||
@@ -1089,9 +1089,9 @@ public class Project { | |||
if (o == null) { | |||
throw new BuildException("Unable to obtain a Target Executor instance."); | |||
} else { | |||
String[] targetNameArray = (String[])(targetNames.toArray( | |||
String[] targetNameArray = (String[]) (targetNames.toArray( | |||
new String[targetNames.size()])); | |||
((Executor)o).executeTargets(this, targetNameArray); | |||
((Executor) o).executeTargets(this, targetNameArray); | |||
} | |||
} | |||
@@ -1651,7 +1651,7 @@ public class Project { | |||
// build Target. | |||
for (int i = 0; i < root.length; i++) { | |||
String st = (String)(state.get(root[i])); | |||
String st = (String) (state.get(root[i])); | |||
if (st == null) { | |||
tsort(root[i], targets, state, visiting, ret); | |||
} else if (st == VISITING) { | |||
@@ -59,7 +59,7 @@ public class TaskAdapter extends Task implements TypeAdapter { | |||
// don't have to check for interface, since then | |||
// taskClass would be abstract too. | |||
try { | |||
final Method executeM = taskClass.getMethod("execute", (Class[])null); | |||
final Method executeM = taskClass.getMethod("execute", (Class[]) null); | |||
// don't have to check for public, since | |||
// getMethod finds public method only. | |||
// don't have to check for abstract, since then | |||
@@ -37,7 +37,7 @@ public class DispatchUtils { | |||
if (task instanceof Dispatchable) { | |||
dispatchable = (Dispatchable) task; | |||
} else if (task instanceof UnknownElement) { | |||
UnknownElement ue = (UnknownElement)task; | |||
UnknownElement ue = (UnknownElement) task; | |||
Object realThing = ue.getRealThing(); | |||
if (realThing != null && realThing instanceof Dispatchable && realThing instanceof Task) { | |||
dispatchable = (Dispatchable) realThing; | |||
@@ -55,7 +55,7 @@ public class DispatchUtils { | |||
final Class c = dispatchable.getClass(); | |||
final Method actionM = c.getMethod(mName, new Class[0]); | |||
if (actionM != null) { | |||
final Object o = actionM.invoke(dispatchable, (Object[])null); | |||
final Object o = actionM.invoke(dispatchable, (Object[]) null); | |||
if (o != null) { | |||
final String s = o.toString(); | |||
if (s != null && s.trim().length() > 0) { | |||
@@ -66,7 +66,7 @@ public class DispatchUtils { | |||
throw new BuildException("No public " + methodName + "() in " | |||
+ dispatchable.getClass()); | |||
} | |||
executeM.invoke(dispatchable, (Object[])null); | |||
executeM.invoke(dispatchable, (Object[]) null); | |||
if (task instanceof UnknownElement) { | |||
((UnknownElement) task).setRealThing(null); | |||
} | |||
@@ -92,12 +92,12 @@ public class DispatchUtils { | |||
throw new BuildException("No public " + methodName + "() in " | |||
+ task.getClass()); | |||
} | |||
executeM.invoke(task, (Object[])null); | |||
executeM.invoke(task, (Object[]) null); | |||
if (task instanceof UnknownElement) { | |||
((UnknownElement) task).setRealThing(null); | |||
} | |||
} | |||
} catch(InvocationTargetException ie) { | |||
} catch (InvocationTargetException ie) { | |||
Throwable t = ie.getTargetException(); | |||
if (t instanceof BuildException) { | |||
throw ((BuildException) t); | |||
@@ -175,7 +175,7 @@ public final class ChainReaderHelper { | |||
} | |||
final Reader[] rdr = {instream}; | |||
instream = | |||
(Reader) constructors[j].newInstance((Object[])rdr); | |||
(Reader) constructors[j].newInstance((Object[]) rdr); | |||
setProjectOnObject(instream); | |||
if (Parameterizable.class.isAssignableFrom(clazz)) { | |||
final Parameter[] params = filter.getParams(); | |||
@@ -375,8 +375,8 @@ public class Ant extends Task { | |||
} else { | |||
boolean circular = false; | |||
for (Iterator it = locals.iterator(); !circular && it.hasNext();) { | |||
Target other = (Target)(getProject().getTargets().get( | |||
(String)(it.next()))); | |||
Target other = (Target) (getProject().getTargets().get( | |||
(String) (it.next()))); | |||
circular |= (other != null | |||
&& other.dependsOn(owningTargetName)); | |||
} | |||
@@ -399,7 +399,7 @@ public class Ant extends Task { | |||
log("Entering " + antFile + "...", Project.MSG_VERBOSE); | |||
newProject.fireSubBuildStarted(); | |||
executor.executeTargets(newProject, | |||
(String[])(locals.toArray(new String[locals.size()]))); | |||
(String[]) (locals.toArray(new String[locals.size()]))); | |||
} catch (BuildException ex) { | |||
t = ProjectHelper | |||
@@ -738,7 +738,8 @@ public class Ant extends Task { | |||
/** | |||
* Default constructor. | |||
*/ | |||
public TargetElement() {} | |||
public TargetElement() { | |||
} | |||
/** | |||
* Set the name of this TargetElement. | |||
@@ -38,7 +38,7 @@ import java.io.File; | |||
public class Apt | |||
extends Javac { | |||
private boolean compile=true; | |||
private boolean compile = true; | |||
private String factory; | |||
private Path factoryPath; | |||
private Vector options; | |||
@@ -479,7 +479,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
File existingFile = (File) destination; | |||
if (existingFile.exists()) { | |||
try { | |||
String suppliedChecksum = | |||
String suppliedChecksum = | |||
readChecksum(existingFile); | |||
checksumMatches = checksumMatches | |||
&& checksum.equals(suppliedChecksum); | |||
@@ -629,7 +629,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
static { | |||
formatMap.put(CHECKSUM, new MessageFormat("{0}")); | |||
formatMap.put(MD5SUM, new MessageFormat("{0} *{1}")); | |||
formatMap.put(MD5SUM, new MessageFormat("{0} *{1}")); | |||
formatMap.put(SVF, new MessageFormat("MD5 ({1}) = {0}")); | |||
} | |||
@@ -642,7 +642,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
e.setValue(CHECKSUM); | |||
return e; | |||
} | |||
public MessageFormat getFormat() { | |||
return (MessageFormat) formatMap.get(getValue()); | |||
} | |||
@@ -111,7 +111,7 @@ public class Echo extends Task { | |||
* @param echoLevel the logging level | |||
*/ | |||
public void setLevel(EchoLevel echoLevel) { | |||
logLevel=echoLevel.getLevel(); | |||
logLevel = echoLevel.getLevel(); | |||
} | |||
/** | |||
@@ -134,7 +134,7 @@ public class Echo extends Task { | |||
/** | |||
* mapping of enumerated values to log levels | |||
*/ | |||
private static int levels[]={ | |||
private static int levels[] = { | |||
Project.MSG_ERR, | |||
Project.MSG_WARN, | |||
Project.MSG_INFO, | |||
@@ -408,7 +408,7 @@ public class ExecTask extends Task { | |||
if (environment != null) { | |||
for (int i = 0; i < environment.length; i++) { | |||
if (isPath(environment[i])) { | |||
p = new Path(getProject(), | |||
p = new Path(getProject(), | |||
environment[i].substring(5)); | |||
break; | |||
} | |||
@@ -489,7 +489,7 @@ public class ExecTask extends Task { | |||
getProject().log("spawn does not allow attributes related to input, " | |||
+ "output, error, result", Project.MSG_ERR); | |||
getProject().log("spawn also does not allow timeout", Project.MSG_ERR); | |||
getProject().log( "finally, spawn is not compatible " | |||
getProject().log("finally, spawn is not compatible " | |||
+ "with a nested I/O <redirector>", Project.MSG_ERR); | |||
throw new BuildException("You have used an attribute " | |||
+ "or nested element which is not compatible with spawn"); | |||
@@ -1152,7 +1152,7 @@ public class Execute { | |||
*/ | |||
private File createCommandFile(String[] cmd, String[] env) | |||
throws IOException { | |||
File script = FileUtils.newFileUtils().createTempFile("ANT", ".COM",null); | |||
File script = FileUtils.newFileUtils().createTempFile("ANT", ".COM", null); | |||
//TODO: bind the longevity of the file to the exe | |||
script.deleteOnExit(); | |||
PrintWriter out = null; | |||
@@ -1162,7 +1162,7 @@ public class Execute { | |||
// add the environment as logicals to the DCL script | |||
if (env != null) { | |||
int eqIndex; | |||
for (int i = 1; i < env.length ; i++) { | |||
for (int i = 1; i < env.length; i++) { | |||
eqIndex = env[i].indexOf('='); | |||
if (eqIndex != -1) { | |||
out.print("$ DEFINE/NOLOG "); | |||
@@ -1175,7 +1175,7 @@ public class Execute { | |||
} | |||
out.print("$ " + cmd[0]); | |||
for (int i = 1; i < cmd.length ; i++) { | |||
for (int i = 1; i < cmd.length; i++) { | |||
out.println(" -"); | |||
out.print(cmd[i]); | |||
} | |||
@@ -53,7 +53,7 @@ public class Exit extends Task { | |||
throw new BuildException( | |||
"A single nested condition is required."); | |||
} | |||
return ((Condition)(getConditions().nextElement())).eval(); | |||
return ((Condition) (getConditions().nextElement())).eval(); | |||
} | |||
} | |||
@@ -227,7 +227,7 @@ public class Expand extends Task { | |||
} | |||
String[] mappedNames = mapper.mapFileName(entryName); | |||
if (mappedNames == null || mappedNames.length == 0) { | |||
mappedNames = new String[] { entryName }; | |||
mappedNames = new String[] {entryName}; | |||
} | |||
File f = fileUtils.resolveFile(dir, mappedNames[0]); | |||
try { | |||
@@ -62,7 +62,7 @@ public class Get extends Task { | |||
//set up logging | |||
int logLevel = Project.MSG_INFO; | |||
DownloadProgress progress=null; | |||
DownloadProgress progress = null; | |||
if (verbose) { | |||
progress = new VerboseProgress(System.out); | |||
} | |||
@@ -86,7 +86,7 @@ public class Get extends Task { | |||
* @param progress progress callback; null for no-callbacks | |||
* @return true for a successful download, false otherwise. | |||
* The return value is only relevant when {@link #ignoreErrors} is true, as | |||
* when false all failures raise BuildExceptions. | |||
* when false all failures raise BuildExceptions. | |||
* @throws IOException for network trouble | |||
* @throws BuildException for argument errors, or other trouble when ignoreErrors | |||
* is false. | |||
@@ -111,7 +111,7 @@ public class Get extends Task { | |||
getLocation()); | |||
} | |||
//dont do any progress, unless asked | |||
if(progress==null) { | |||
if (progress == null) { | |||
progress = new NullProgress(); | |||
} | |||
log("Getting: " + source, logLevel); | |||
@@ -194,11 +194,11 @@ public class Get extends Task { | |||
is = connection.getInputStream(); | |||
break; | |||
} catch (IOException ex) { | |||
log("Error opening connection " + ex,logLevel); | |||
log("Error opening connection " + ex, logLevel); | |||
} | |||
} | |||
if (is == null) { | |||
log("Can't get " + source + " to " + dest,logLevel); | |||
log("Can't get " + source + " to " + dest, logLevel); | |||
if (ignoreErrors) { | |||
return false; | |||
} | |||
@@ -240,7 +240,7 @@ public class Get extends Task { | |||
log("last modified = " + t.toString() | |||
+ ((remoteTimestamp == 0) | |||
? " - using current time instead" | |||
: ""),logLevel); | |||
: ""), logLevel); | |||
} | |||
if (remoteTimestamp != 0) { | |||
FileUtils.newFileUtils() | |||
@@ -469,7 +469,7 @@ public class Get extends Task { | |||
* begin a download | |||
*/ | |||
public void beginDownload() { | |||
dots=0; | |||
dots = 0; | |||
} | |||
/** | |||
@@ -429,7 +429,7 @@ public class Jar extends Zip { | |||
// header newline | |||
writer.println(zipFile.getName()); | |||
writeIndexLikeList(new ArrayList(addedDirs.keySet()), | |||
writeIndexLikeList(new ArrayList(addedDirs.keySet()), | |||
rootEntries, writer); | |||
writer.println(); | |||
@@ -766,7 +766,7 @@ public class Jar extends Zip { | |||
* | |||
* @since Ant 1.6.2 | |||
*/ | |||
protected static final String findJarName(String fileName, | |||
protected static final String findJarName(String fileName, | |||
String[] classpath) { | |||
if (classpath == null) { | |||
return (new File(fileName)).getName(); | |||
@@ -799,8 +799,8 @@ public class Jar extends Zip { | |||
} | |||
} | |||
} | |||
return matches.size() == 0 | |||
return matches.size() == 0 | |||
? null : (String) matches.get(matches.firstKey()); | |||
} | |||
@@ -810,7 +810,7 @@ public class Jar extends Zip { | |||
* | |||
* @since Ant 1.7 | |||
*/ | |||
protected static final void grabFilesAndDirs(String file, List dirs, | |||
protected static final void grabFilesAndDirs(String file, List dirs, | |||
List files) | |||
throws IOException { | |||
org.apache.tools.zip.ZipFile zf = null; | |||
@@ -819,7 +819,7 @@ public class Jar extends Zip { | |||
Enumeration entries = zf.getEntries(); | |||
HashSet dirSet = new HashSet(); | |||
while (entries.hasMoreElements()) { | |||
org.apache.tools.zip.ZipEntry ze = | |||
org.apache.tools.zip.ZipEntry ze = | |||
(org.apache.tools.zip.ZipEntry) entries.nextElement(); | |||
String name = ze.getName(); | |||
// META-INF would be skipped anyway, avoid index for | |||
@@ -834,7 +834,7 @@ public class Jar extends Zip { | |||
// since the jar may be one without directory | |||
// entries, add the parent dir of this file as | |||
// well. | |||
dirSet.add(name.substring(0, | |||
dirSet.add(name.substring(0, | |||
name.lastIndexOf("/") + 1)); | |||
} | |||
} | |||
@@ -62,10 +62,10 @@ public class Java extends Task { | |||
private File input; | |||
private File output; | |||
private File error; | |||
protected Redirector redirector = new Redirector(this); | |||
protected RedirectorElement redirectorElement; | |||
private String resultProperty; | |||
private Permissions perm = null; | |||
@@ -123,7 +123,7 @@ public class Java extends Task { | |||
getProject().log("spawn does not allow attributes related to input, " | |||
+ "output, error, result", Project.MSG_ERR); | |||
getProject().log("spawn also does not allow timeout", Project.MSG_ERR); | |||
getProject().log( "finally, spawn is not compatible " | |||
getProject().log("finally, spawn is not compatible " | |||
+ "with a nested I/O <redirector>", Project.MSG_ERR); | |||
throw new BuildException("You have used an attribute " | |||
+ "or nested element which is not compatible with spawn"); | |||
@@ -591,7 +591,7 @@ public class Java extends Task { | |||
* @param asserts assertion set | |||
*/ | |||
public void addAssertions(Assertions asserts) { | |||
if(cmdl.getAssertions() != null) { | |||
if (cmdl.getAssertions() != null) { | |||
throw new BuildException("Only one assertion declaration is allowed"); | |||
} | |||
cmdl.setAssertions(asserts); | |||
@@ -839,10 +839,10 @@ public class Java extends Task { | |||
private void setupCommandLineForVMS(Execute exe, String[] command) { | |||
//Use the VM launcher instead of shell launcher on VMS | |||
exe.setVMLauncher(true); | |||
File vmsJavaOptionFile=null; | |||
File vmsJavaOptionFile = null; | |||
try { | |||
String [] args = new String[command.length-1]; | |||
System.arraycopy(command, 1, args, 0, command.length-1); | |||
String [] args = new String[command.length - 1]; | |||
System.arraycopy(command, 1, args, 0, command.length - 1); | |||
vmsJavaOptionFile = JavaEnvUtils.createVmsJavaOptionFile(args); | |||
//we mark the file to be deleted on exit. | |||
//the alternative would be to cache the filename and delete | |||
@@ -152,7 +152,7 @@ public final class LoadProperties extends Task { | |||
BufferedInputStream bis = null; | |||
if (srcFile != null ) { | |||
if (srcFile != null) { | |||
if (!srcFile.exists()) { | |||
throw new BuildException("Source file does not exist."); | |||
} | |||
@@ -67,7 +67,7 @@ public class Move extends Copy { | |||
protected void validateAttributes() throws BuildException { | |||
if (file != null && file.isDirectory()) { | |||
if ((destFile != null && destDir != null) | |||
|| (destFile == null && destDir == null)){ | |||
|| (destFile == null && destDir == null)) { | |||
throw new BuildException("One and only one of tofile and todir " | |||
+ "must be set."); | |||
} | |||
@@ -71,7 +71,7 @@ public class PathConvert extends Task { | |||
/** | |||
* The property to receive the conversion | |||
*/ | |||
private String property = null;// | |||
private String property = null; | |||
/** | |||
* Path prefix map | |||
*/ | |||
@@ -200,7 +200,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
out.println(mesg); | |||
} | |||
} | |||
private void flush() { | |||
if (record && out != null) { | |||
out.flush(); | |||
@@ -272,7 +272,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
} | |||
project = null; | |||
} | |||
/** | |||
* Initially opens the file associated with this recorder. | |||
* Used by Recorder. | |||
@@ -296,7 +296,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
out = null; | |||
} | |||
} | |||
/** | |||
* Re-opens the file associated with this recorder. | |||
* Used by Recorder. | |||
@@ -312,10 +312,10 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||
try { | |||
out = new PrintStream(new FileOutputStream(filename, append)); | |||
} catch (IOException ioe) { | |||
throw new BuildException("Problems opening file using a " + | |||
"recorder entry", ioe); | |||
throw new BuildException("Problems opening file using a " | |||
+ "recorder entry", ioe); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
@@ -494,7 +494,7 @@ public class Redirector { | |||
try { | |||
LeadPipeInputStream snk = new LeadPipeInputStream(); | |||
snk.setManagingTask(managingTask); | |||
InputStream outPumpIn = snk; | |||
Reader reader = new InputStreamReader(outPumpIn, inputEncoding); | |||
@@ -523,7 +523,7 @@ public class Redirector { | |||
try { | |||
LeadPipeInputStream snk = new LeadPipeInputStream(); | |||
snk.setManagingTask(managingTask); | |||
InputStream errPumpIn = snk; | |||
Reader reader = new InputStreamReader(errPumpIn, inputEncoding); | |||
@@ -558,7 +558,7 @@ public class Redirector { | |||
} catch (IOException eyeOhEx) { | |||
throw new BuildException(eyeOhEx); | |||
} | |||
((ConcatFileInputStream)inputStream).setManagingTask(managingTask); | |||
((ConcatFileInputStream) inputStream).setManagingTask(managingTask); | |||
} else if (inputString != null) { | |||
managingTask.log("Using input \"" + inputString + "\"", | |||
Project.MSG_VERBOSE); | |||
@@ -770,7 +770,7 @@ public class Redirector { | |||
Arrays.fill(c, ' '); | |||
String indent = new String(c); | |||
for (int i = 1; i < file.length ; i++) { | |||
for (int i = 1; i < file.length; i++) { | |||
outputStream = new TeeOutputStream(outputStream, | |||
new LazyFileOutputStream(file[i], append, createEmptyFiles)); | |||
managingTask.log(indent + file[i], loglevel); | |||
@@ -397,7 +397,7 @@ public class Rmic extends MatchingTask { | |||
* @since Ant 1.5 | |||
*/ | |||
public void setCompiler(String compiler) { | |||
if(compiler.length()>0) { | |||
if (compiler.length() > 0) { | |||
facade.setImplementation(compiler); | |||
} | |||
} | |||
@@ -441,10 +441,10 @@ public class Rmic extends MatchingTask { | |||
throw new BuildException(ERROR_BASE_NOT_SET, getLocation()); | |||
} | |||
if (!baseDir.exists()) { | |||
throw new BuildException(ERROR_NO_BASE_EXISTS+baseDir, getLocation()); | |||
throw new BuildException(ERROR_NO_BASE_EXISTS + baseDir, getLocation()); | |||
} | |||
if ( !baseDir.isDirectory() ) { | |||
throw new BuildException(ERROR_NOT_A_DIR+baseDir, getLocation()); | |||
if (!baseDir.isDirectory()) { | |||
throw new BuildException(ERROR_NOT_A_DIR + baseDir, getLocation()); | |||
} | |||
if (verify) { | |||
log("Verify has been turned on.", Project.MSG_VERBOSE); | |||
@@ -319,7 +319,7 @@ public class SignJar extends Task { | |||
if (jarFile.equals(signedjarFile)) { | |||
return false; | |||
} | |||
if (FileUtils.newFileUtils().isUpToDate(jarFile,signedjarFile)) { | |||
if (FileUtils.newFileUtils().isUpToDate(jarFile, signedjarFile)) { | |||
return true; | |||
} | |||
} else { | |||
@@ -280,12 +280,12 @@ public class SubAnt | |||
Project.MSG_WARN); | |||
} finally { | |||
ant = null; | |||
} | |||
} | |||
} | |||
/** | |||
* This method builds the file name to use in conjunction with directories. | |||
* | |||
* | |||
* <p>Defaults to "build.xml". | |||
* If <code>genericantfile</code> is set, this attribute is ignored.</p> | |||
* | |||
@@ -297,7 +297,7 @@ public class SubAnt | |||
/** | |||
* This method builds a file path to use in conjunction with directories. | |||
* | |||
* | |||
* <p>Use <code>genericantfile</code>, in order to run the same build file | |||
* with different basedirs.</p> | |||
* If this attribute is set, <code>antfile</code> is ignored. | |||
@@ -152,7 +152,7 @@ public class Sync extends Task { | |||
int[] removedCount = new int[] {0, 0}; | |||
DirectoryScanner ds = new DirectoryScanner(); | |||
ds.setBasedir(toDir); | |||
String[] excls = | |||
String[] excls = | |||
(String[]) nonOrphans.toArray(new String[nonOrphans.size() + 1]); | |||
// want to keep toDir itself | |||
excls[nonOrphans.size()] = ""; | |||
@@ -171,7 +171,7 @@ public class Sync extends Task { | |||
// leaves before their parent nodes - thus making sure (well, | |||
// more likely) that the directories are empty when we try to | |||
// delete them. | |||
for (int i = dirs.length - 1 ; i >= 0 ; --i) { | |||
for (int i = dirs.length - 1; i >= 0; --i) { | |||
File f = new File(toDir, dirs[i]); | |||
log("Removing orphan directory: " + f, Project.MSG_DEBUG); | |||
f.delete(); | |||
@@ -967,8 +967,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
* @since Ant 1.6.2 | |||
*/ | |||
private class StyleMapper implements FileNameMapper { | |||
public void setFrom(String from) {} | |||
public void setTo(String to) {} | |||
public void setFrom(String from) { | |||
} | |||
public void setTo(String to) { | |||
} | |||
public String[] mapFileName(String xmlFile) { | |||
int dotPos = xmlFile.lastIndexOf('.'); | |||
if (dotPos > 0) { | |||
@@ -750,7 +750,7 @@ public class Zip extends MatchingTask { | |||
* @param needsUpdate whether we already know that the archive is | |||
* out-of-date. Subclasses overriding this method are supposed to | |||
* set this value correctly in their call to | |||
* super.getResourcesToAdd. | |||
* <code>super.getResourcesToAdd</code>. | |||
* @return an array of resources to add for each fileset passed in as well | |||
* as a flag that indicates whether the archive is uptodate. | |||
* | |||
@@ -1064,7 +1064,7 @@ public class Zip extends MatchingTask { | |||
} | |||
/** | |||
* Method that gets called when adding from java.io.File instances. | |||
* Method that gets called when adding from <code>java.io.File</code> instances. | |||
* | |||
* <p>This implementation delegates to the six-arg version.</p> | |||
* | |||
@@ -1086,7 +1086,7 @@ public class Zip extends MatchingTask { | |||
FileInputStream fIn = new FileInputStream(file); | |||
try { | |||
// ZIPs store time with a granularity of 2 seconds, round up | |||
zipFile(fIn, zOut, vPath, | |||
zipFile(fIn, zOut, vPath, | |||
file.lastModified() + (roundUp ? 1999 : 0), | |||
null, mode); | |||
} finally { | |||
@@ -52,7 +52,7 @@ public class AptExternalCompilerAdapter extends DefaultCompilerAdapter { | |||
logAndAddFilesToCompile(cmd); | |||
//run | |||
return 0==executeExternalCompile(cmd.getCommandline(), | |||
return 0 == executeExternalCompile(cmd.getCommandline(), | |||
cmd.size(), | |||
true); | |||
@@ -298,8 +298,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
if (attributes.getSource() != null && !assumeJava13()) { | |||
cmd.createArgument().setValue("-source"); | |||
String source = attributes.getSource(); | |||
if (assumeJava14() && | |||
(source.equals("1.1") || source.equals("1.2"))) { | |||
if (assumeJava14() | |||
&& (source.equals("1.1") || source.equals("1.2"))) { | |||
// support for -source 1.1 and -source 1.2 has been | |||
// added with JDK 1.4.2 | |||
cmd.createArgument().setValue("1.3"); | |||
@@ -122,10 +122,10 @@ public class Gcj extends DefaultCompilerAdapter { | |||
public boolean isNativeBuild() { | |||
boolean nativeBuild = false; | |||
String[] additionalArguments = getJavac().getCurrentCompilerArgs(); | |||
int argsLength=0; | |||
int argsLength = 0; | |||
while (!nativeBuild && argsLength < additionalArguments.length) { | |||
int conflictLength = 0; | |||
while (!nativeBuild | |||
while (!nativeBuild | |||
&& conflictLength < CONFLICT_WITH_DASH_C.length) { | |||
nativeBuild = (additionalArguments[argsLength].startsWith | |||
(CONFLICT_WITH_DASH_C[conflictLength])); | |||
@@ -136,8 +136,8 @@ public class Gcj extends DefaultCompilerAdapter { | |||
return nativeBuild; | |||
} | |||
private static final String [] CONFLICT_WITH_DASH_C = { | |||
"-o" , "--main=", "-D", "-fjni", "-L" | |||
private static final String [] CONFLICT_WITH_DASH_C = { | |||
"-o" , "--main=", "-D", "-fjni", "-L" | |||
}; | |||
} |
@@ -64,13 +64,13 @@ public class JavacExternal extends DefaultCompilerAdapter { | |||
* @return | |||
*/ | |||
private boolean execOnVMS(Commandline cmd, int firstFileName) { | |||
File vmsFile=null; | |||
File vmsFile = null; | |||
try { | |||
vmsFile = JavaEnvUtils.createVmsJavaOptionFile(cmd.getArguments()); | |||
String[] commandLine = {cmd.getExecutable(), | |||
"-V", | |||
vmsFile.getPath()}; | |||
return 0==executeExternalCompile(commandLine, | |||
return 0 == executeExternalCompile(commandLine, | |||
firstFileName, | |||
true); | |||
@@ -56,7 +56,7 @@ class CvsTagEntry { | |||
buffer.append(m_filename); | |||
if ((m_revision == null)) { | |||
buffer.append(" was removed"); | |||
if(m_prevRevision != null) { | |||
if (m_prevRevision != null) { | |||
buffer.append("; previous revision was ").append(m_prevRevision); | |||
} | |||
} else if (m_revision != null && m_prevRevision == null) { | |||
@@ -349,7 +349,7 @@ public class EchoProperties extends Task { | |||
/** | |||
* a tuple for the sort list. | |||
*/ | |||
private static class Tuple implements Comparable{ | |||
private static class Tuple implements Comparable { | |||
public String key; | |||
public String value; | |||
@@ -367,7 +367,7 @@ public class EchoProperties extends Task { | |||
* from being compared to this Object. | |||
*/ | |||
public int compareTo(Object o) { | |||
Tuple that=(Tuple) o; | |||
Tuple that = (Tuple) o; | |||
return key.compareTo(that.key); | |||
} | |||
} | |||
@@ -390,7 +390,7 @@ public class EchoProperties extends Task { | |||
Document doc = getDocumentBuilder().newDocument(); | |||
Element rootElement = doc.createElement(PROPERTIES); | |||
List sorted=sortProperties(props); | |||
List sorted = sortProperties(props); | |||
// output properties | |||
@@ -92,7 +92,7 @@ public class NetRexxC extends MatchingTask { | |||
private boolean binary; | |||
private String classpath; | |||
private boolean comments; | |||
private boolean compact = true;// should be the default, as it integrates better in ant. | |||
private boolean compact = true; // should be the default, as it integrates better in ant. | |||
private boolean compile = true; | |||
private boolean console; | |||
private boolean crossref; | |||
@@ -106,7 +106,7 @@ public class NetRexxC extends MatchingTask { | |||
private boolean replace; | |||
private boolean savelog; | |||
private File srcDir; | |||
private boolean sourcedir = true;// ?? Should this be the default for ant? | |||
private boolean sourcedir = true; // ?? Should this be the default for ant? | |||
private boolean strictargs; | |||
private boolean strictassign; | |||
private boolean strictcase; | |||
@@ -116,7 +116,7 @@ public class ReplaceRegExp extends Task { | |||
private File file; | |||
private String flags; | |||
private boolean byline; | |||
private Vector filesets;// Keep jdk 1.1 compliant so others can use this | |||
private Vector filesets; // Keep jdk 1.1 compliant so others can use this | |||
private RegularExpression regex; | |||
private Substitution subs; | |||
@@ -391,7 +391,7 @@ public class XMLValidateTask extends Task { | |||
*/ | |||
private void setFeature(String feature, boolean value) | |||
throws BuildException { | |||
log("Setting feature "+feature+"="+value,Project.MSG_DEBUG); | |||
log("Setting feature " + feature + "=" + value, Project.MSG_DEBUG); | |||
try { | |||
xmlReader.setFeature(feature, value); | |||
} catch (SAXNotRecognizedException e) { | |||
@@ -459,7 +459,7 @@ public class XMLValidateTask extends Task { | |||
is.setSystemId(uri); | |||
xmlReader.parse(is); | |||
} catch (SAXException ex) { | |||
log("Caught when validating: "+ex.toString(),Project.MSG_DEBUG); | |||
log("Caught when validating: " + ex.toString(), Project.MSG_DEBUG); | |||
if (failOnError) { | |||
throw new BuildException( | |||
"Could not validate document " + afile); | |||
@@ -41,7 +41,7 @@ public class IsPingable extends ProjectComponent implements Condition { | |||
private String host; | |||
public static final int DEFAULT_TIMEOUT = 30; | |||
private int timeout=DEFAULT_TIMEOUT; | |||
private int timeout = DEFAULT_TIMEOUT; | |||
public static final String ERROR_NO_HOSTNAME = "No hostname defined"; | |||
public static final String ERROR_BAD_TIMEOUT = "Invalid timeout value"; | |||
public static final String ERROR_UNKNOWN_HOST = "Unknown host:"; | |||
@@ -71,20 +71,20 @@ public class IsPingable extends ProjectComponent implements Condition { | |||
* if an error occurs | |||
*/ | |||
public boolean eval() throws BuildException { | |||
if(host==null || host.length()==0) { | |||
if (host == null || host.length() == 0) { | |||
throw new BuildException(ERROR_NO_HOSTNAME); | |||
} | |||
if(timeout<0) { | |||
if (timeout < 0) { | |||
throw new BuildException(ERROR_BAD_TIMEOUT); | |||
} | |||
try { | |||
InetAddress address=InetAddress.getByName(host); | |||
return address.isReachable(timeout*1000); | |||
InetAddress address = InetAddress.getByName(host); | |||
return address.isReachable(timeout * 1000); | |||
} catch (UnknownHostException e) { | |||
log(ERROR_UNKNOWN_HOST+host,Project.MSG_VERBOSE); | |||
log(ERROR_UNKNOWN_HOST + host, Project.MSG_VERBOSE); | |||
return false; | |||
} catch (IOException e) { | |||
log(ERROR_ON_NETWORK + host +": "+e.toString(), | |||
log(ERROR_ON_NETWORK + host + ": " + e.toString(), | |||
Project.MSG_VERBOSE); | |||
return false; | |||
} | |||
@@ -100,7 +100,7 @@ public class Depend extends MatchingTask { | |||
/** | |||
* flag to enable warning if we encounter RMI stubs | |||
*/ | |||
private boolean warnOnRmiStubs=true; | |||
private boolean warnOnRmiStubs = true; | |||
/** | |||
* Flag which controls whether the reversed dependencies should be | |||
@@ -526,12 +526,12 @@ public class Depend extends MatchingTask { | |||
return; | |||
} | |||
int level = Project.MSG_WARN; | |||
if(!warnOnRmiStubs) { | |||
if (!warnOnRmiStubs) { | |||
//downgrade warnings on RMI stublike classes, as they are generated | |||
//by rmic, so there is no need to tell the user that their source is | |||
//missing. | |||
if(isRmiStub(affectedClass, className)) { | |||
level=Project.MSG_VERBOSE; | |||
if (isRmiStub(affectedClass, className)) { | |||
level = Project.MSG_VERBOSE; | |||
} | |||
} | |||
log("The class " + affectedClass + " in file " | |||
@@ -549,14 +549,14 @@ public class Depend extends MatchingTask { | |||
* @return | |||
*/ | |||
private boolean isRmiStub(String affectedClass, String className) { | |||
return isStub(affectedClass,className, DefaultRmicAdapter.RMI_STUB_SUFFIX) | |||
return isStub(affectedClass, className, DefaultRmicAdapter.RMI_STUB_SUFFIX) | |||
|| isStub(affectedClass, className, DefaultRmicAdapter.RMI_SKEL_SUFFIX) | |||
|| isStub(affectedClass, className, WLRmic.RMI_STUB_SUFFIX) | |||
|| isStub(affectedClass, className, WLRmic.RMI_SKEL_SUFFIX); | |||
} | |||
private boolean isStub(String affectedClass,String baseClass,String suffix) { | |||
return (baseClass+suffix).equals(affectedClass); | |||
private boolean isStub(String affectedClass, String baseClass, String suffix) { | |||
return (baseClass + suffix).equals(affectedClass); | |||
} | |||
/** | |||
@@ -686,14 +686,14 @@ public class Depend extends MatchingTask { | |||
int count = deleteAllAffectedFiles(); | |||
long duration = (System.currentTimeMillis() - start) / 1000; | |||
final int summaryLogLevel; | |||
if(count>0) { | |||
if (count > 0) { | |||
summaryLogLevel = Project.MSG_INFO; | |||
} else { | |||
summaryLogLevel = Project.MSG_DEBUG; | |||
} | |||
log("Deleted " + count + " out of date files in " | |||
+ duration + " seconds", summaryLogLevel); | |||
} catch (Exception e) { | |||
@@ -40,9 +40,9 @@ import org.apache.tools.ant.taskdefs.condition.Os; | |||
/** | |||
* Compiles C# source into executables or modules. | |||
* | |||
* csc.exe on Windows or mcs on other platforms must be on the execute path, unless another executable | |||
* or the full path to that executable is specified in the <tt>executable</tt> | |||
* parameter | |||
* csc.exe on Windows or mcs on other platforms must be on the execute | |||
* path, unless another executable or the full path to that executable | |||
* is specified in the <tt>executable</tt> parameter | |||
* <p> | |||
* All parameters are optional: <csc/> should suffice to produce a debug | |||
* build of all *.cs files. However, naming an <tt>destFile</tt>stops the | |||
@@ -71,17 +71,17 @@ import org.apache.tools.ant.taskdefs.condition.Os; | |||
* Example | |||
* | |||
* <pre><csc | |||
* optimize="true" | |||
* debug="false" | |||
* docFile="documentation.xml" | |||
* warnLevel="4" | |||
* unsafe="false" | |||
* targetType="exe" | |||
* incremental="false" | |||
* mainClass = "MainApp" | |||
* destFile="NetApp.exe" | |||
* > | |||
* <src dir="src" includes="*.cs" /> | |||
* optimize="true" | |||
* debug="false" | |||
* docFile="documentation.xml" | |||
* warnLevel="4" | |||
* unsafe="false" | |||
* targetType="exe" | |||
* incremental="false" | |||
* mainClass = "MainApp" | |||
* destFile="NetApp.exe" | |||
* > | |||
* <src dir="src" includes="*.cs" /> | |||
* <reference file="${testCSC.dll}" /> | |||
* <define name="RELEASE" /> | |||
* <define name="DEBUG" if="debug.property"/> | |||
@@ -328,7 +328,7 @@ public class Ildasm extends Task { | |||
} | |||
long sourceTime = sourceFile.lastModified(); | |||
long destTime = destFile.lastModified(); | |||
if(sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity())) { | |||
if (sourceTime > (destTime + FileUtils.newFileUtils().getFileTimestampGranularity())) { | |||
log("Source file is newer than the dest file: a rebuild is required", | |||
Project.MSG_VERBOSE); | |||
return true; | |||
@@ -344,7 +344,7 @@ public class Ildasm extends Task { | |||
*/ | |||
public void execute() throws BuildException { | |||
validate(); | |||
if(!isDisassemblyNeeded()) { | |||
if (!isDisassemblyNeeded()) { | |||
return; | |||
} | |||
NetCommand command = new NetCommand(this, "ildasm", executable); | |||
@@ -77,7 +77,7 @@ public class ImportTypelib extends Task { | |||
/** | |||
* This method names the output file. | |||
* | |||
* | |||
* This is an operation which is required to have been performed. | |||
* @param destFile | |||
*/ | |||
@@ -95,7 +95,7 @@ public class ImportTypelib extends Task { | |||
} | |||
/** | |||
* This method sets which is the source .tlb file. | |||
* This method sets which is the source .tlb file. | |||
* This is an operation which is required to have been performed. | |||
* @param srcFile | |||
*/ | |||
@@ -188,7 +188,7 @@ public class ImportTypelib extends Task { | |||
+ " to assembly " + destFile | |||
+ " in namespace " + namespace, Project.MSG_VERBOSE); | |||
//rebuild unless the dest file is newer than the source file | |||
if(!isExecuteNeeded()) { | |||
if (!isExecuteNeeded()) { | |||
return; | |||
} | |||
@@ -100,7 +100,7 @@ public class NetCommand { | |||
/** | |||
* flag to set to to use @file based command cache | |||
*/ | |||
private boolean useResponseFile=false; | |||
private boolean useResponseFile = false; | |||
/** | |||
* name of a temp file; may be null | |||
@@ -206,7 +206,7 @@ public class NetCommand { | |||
* | |||
*@param argument1 The first argument | |||
*@param argument2 The second argument | |||
*/ | |||
*/ | |||
public void addArgument(String argument1, String argument2) { | |||
if (argument2 != null && argument2.length() != 0) { | |||
commandLine.createArgument().setValue(argument1 + argument2); | |||
@@ -314,8 +314,8 @@ public class NetCommand { | |||
String[] commands = commandLine.getCommandline(); | |||
//always trigger file mode if commands are big enough | |||
if (automaticResponseFileThreshold>0 && | |||
commands.length > automaticResponseFileThreshold) { | |||
if (automaticResponseFileThreshold > 0 | |||
&& commands.length > automaticResponseFileThreshold) { | |||
useResponseFile = true; | |||
} | |||
if (!useResponseFile || commands.length <= 1) { | |||
@@ -329,7 +329,7 @@ public class NetCommand { | |||
FileUtils fileUtils = FileUtils.newFileUtils(); | |||
temporaryCommandFile = fileUtils.createTempFile("cmd", ".txt", null); | |||
owner.log("Using response file"+temporaryCommandFile,Project.MSG_VERBOSE); | |||
owner.log("Using response file" + temporaryCommandFile, Project.MSG_VERBOSE); | |||
try { | |||
fos = new FileOutputStream(temporaryCommandFile); | |||
@@ -106,13 +106,13 @@ public class WsdlToDotnet extends Task { | |||
* our WSDL file. | |||
* @since ant1.7 | |||
*/ | |||
private Schema wsdl=new Schema(); | |||
private Schema wsdl = new Schema(); | |||
/** | |||
* compiler | |||
* @since ant1.7 | |||
*/ | |||
private Compiler compiler=null; | |||
private Compiler compiler = null; | |||
/** | |||
* error message: dest file is a directory | |||
@@ -127,7 +127,7 @@ public class WsdlToDotnet extends Task { | |||
/** | |||
* used for timestamp checking | |||
*/ | |||
private FileUtils fileutils= FileUtils.newFileUtils(); | |||
private FileUtils fileutils = FileUtils.newFileUtils(); | |||
/** | |||
* Name of the file to generate. Required | |||
@@ -276,8 +276,8 @@ public class WsdlToDotnet extends Task { | |||
*/ | |||
public void execute() | |||
throws BuildException { | |||
if(compiler==null) { | |||
compiler=Compiler.createDefaultCompiler(); | |||
if (compiler == null) { | |||
compiler = Compiler.createDefaultCompiler(); | |||
} | |||
validate(); | |||
NetCommand command = new NetCommand(this, | |||
@@ -293,10 +293,10 @@ public class WsdlToDotnet extends Task { | |||
command.addArgument("/server"); | |||
} | |||
command.addArgument("/namespace:", namespace); | |||
if(protocol!=null) { | |||
command.addArgument("/protocol:"+protocol); | |||
if (protocol != null) { | |||
command.addArgument("/protocol:" + protocol); | |||
} | |||
if(ideErrors) { | |||
if (ideErrors) { | |||
command.addArgument("/parsableErrors"); | |||
} | |||
command.addArgument(extraOptions); | |||
@@ -306,7 +306,7 @@ public class WsdlToDotnet extends Task { | |||
long destLastModified = -1; | |||
//rebuild unless the dest file is newer than the source file | |||
if ( destFile.exists() ) { | |||
if (destFile.exists()) { | |||
destLastModified = destFile.lastModified(); | |||
rebuild = isRebuildNeeded(wsdl, destLastModified); | |||
} | |||
@@ -323,8 +323,8 @@ public class WsdlToDotnet extends Task { | |||
//add in any extra files. | |||
//this is an error in mono, but we do not warn on it as they may fix that outside | |||
//the ant build cycle. | |||
Iterator it=schemas.iterator(); | |||
while ( it.hasNext() ) { | |||
Iterator it = schemas.iterator(); | |||
while (it.hasNext()) { | |||
Schema schema = (Schema) it.next(); | |||
//mark for a rebuild if we are newer | |||
rebuild |= isRebuildNeeded(schema, destLastModified); | |||
@@ -343,7 +343,7 @@ public class WsdlToDotnet extends Task { | |||
* @return true if a rebuild is needed. | |||
*/ | |||
private boolean isRebuildNeeded(Schema schema, long destLastModified) { | |||
if(destLastModified==-1) { | |||
if (destLastModified == -1) { | |||
return true; | |||
} | |||
return !fileutils.isUpToDate(schema.getTimestamp(), destLastModified); | |||
@@ -357,7 +357,7 @@ public class WsdlToDotnet extends Task { | |||
public static class Schema { | |||
private File file; | |||
private String url; | |||
private boolean makeURL=false; | |||
private boolean makeURL = false; | |||
public static final String ERROR_NONE_DECLARED = "One of file and url must be set"; | |||
public static final String ERROR_BOTH_DECLARED = "Only one of file or url can be set"; | |||
@@ -370,18 +370,18 @@ public class WsdlToDotnet extends Task { | |||
*/ | |||
public void validate() { | |||
if(file!=null) { | |||
if (file != null) { | |||
if (!file.exists()) { | |||
throw new BuildException(ERROR_FILE_NOT_FOUND+file.toString()); | |||
throw new BuildException(ERROR_FILE_NOT_FOUND + file.toString()); | |||
} | |||
if ( file.isDirectory() ) { | |||
throw new BuildException(ERROR_FILE_IS_DIR+file.toString()); | |||
if (file.isDirectory()) { | |||
throw new BuildException(ERROR_FILE_IS_DIR + file.toString()); | |||
} | |||
} | |||
if(file!=null && url!=null) { | |||
if (file != null && url != null) { | |||
throw new BuildException(ERROR_BOTH_DECLARED); | |||
} | |||
if(file==null && url==null) { | |||
if (file == null && url == null) { | |||
throw new BuildException(ERROR_NONE_DECLARED); | |||
} | |||
} | |||
@@ -392,14 +392,14 @@ public class WsdlToDotnet extends Task { | |||
*/ | |||
public String evaluate() { | |||
validate(); | |||
if(url!=null) { | |||
if (url != null) { | |||
return getUrl(); | |||
} | |||
if(makeURL) { | |||
if (makeURL) { | |||
try { | |||
return file.toURL().toExternalForm(); | |||
} catch (MalformedURLException e) { | |||
throw new BuildException(ERROR_NO_URL_CONVERT+file); | |||
throw new BuildException(ERROR_NO_URL_CONVERT + file); | |||
} | |||
} | |||
return file.toString(); | |||
@@ -448,10 +448,11 @@ public class WsdlToDotnet extends Task { | |||
* @return | |||
*/ | |||
public long getTimestamp() { | |||
if(file!=null) { | |||
if (file != null) { | |||
return file.lastModified(); | |||
} else | |||
} else { | |||
return -1; | |||
} | |||
} | |||
} | |||
@@ -463,7 +464,7 @@ public class WsdlToDotnet extends Task { | |||
public static final String COMPILER_MS = "microsoft"; | |||
public static final String COMPILER_MONO = "mono"; | |||
public static final String COMPILER_MS_ON_MONO = "microsoft-on-mono"; | |||
String[] compilers={ | |||
String[] compilers = { | |||
COMPILER_MS, | |||
COMPILER_MONO, | |||
COMPILER_MS_ON_MONO | |||
@@ -487,7 +488,7 @@ public class WsdlToDotnet extends Task { | |||
String[][] extraCompilerArgs = { | |||
{}, | |||
{}, | |||
{EXE_WSDL+".exe"} | |||
{EXE_WSDL + ".exe"} | |||
}; | |||
boolean[] absoluteFiles = { | |||
@@ -512,9 +513,9 @@ public class WsdlToDotnet extends Task { | |||
* @return | |||
*/ | |||
public static Compiler createDefaultCompiler() { | |||
Compiler c=new Compiler(); | |||
Compiler c = new Compiler(); | |||
String compilerName; | |||
compilerName= Os.isFamily("windows")?COMPILER_MS:COMPILER_MONO; | |||
compilerName = Os.isFamily("windows") ? COMPILER_MS : COMPILER_MONO; | |||
c.setValue(compilerName); | |||
return c; | |||
} | |||
@@ -544,8 +545,8 @@ public class WsdlToDotnet extends Task { | |||
* @param command | |||
*/ | |||
public void applyExtraArgs(NetCommand command) { | |||
String[] args=getExtraArgs(); | |||
for(int i=0;i<args.length;i++) { | |||
String[] args = getExtraArgs(); | |||
for (int i = 0; i < args.length; i++) { | |||
command.addArgument(args[i]); | |||
} | |||
} | |||
@@ -353,7 +353,7 @@ public final class Specification { | |||
} | |||
// Implementation Vendor ID must match | |||
final String otherImplementationVendor | |||
final String otherImplementationVendor | |||
= other.getImplementationVendor(); | |||
if (null != implementationVendor) { | |||
if (null == otherImplementationVendor | |||
@@ -363,7 +363,7 @@ public final class Specification { | |||
} | |||
// Implementation version must be >= required | |||
final String otherImplementationVersion | |||
final String otherImplementationVersion | |||
= other.getImplementationVersion(); | |||
if (null != implementationVersion) { | |||
if (null == otherImplementationVersion | |||
@@ -184,7 +184,7 @@ public class Image extends MatchingTask { | |||
destDir = srcDir; | |||
} | |||
File new_file = new File(destDir.getAbsolutePath() | |||
File new_file = new File(destDir.getAbsolutePath() | |||
+ File.separator + file.getName()); | |||
if ((overwrite && new_file.exists()) && (!new_file.equals(file))) { | |||
@@ -193,7 +193,7 @@ public class Image extends MatchingTask { | |||
FileOutputStream stream = new FileOutputStream(new_file); | |||
JAI.create("encode", image, stream, str_encoding.toUpperCase(), | |||
JAI.create("encode", image, stream, str_encoding.toUpperCase(), | |||
null); | |||
stream.flush(); | |||
stream.close(); | |||
@@ -234,7 +234,7 @@ public class Image extends MatchingTask { | |||
files = ds.getIncludedFiles(); | |||
for (int i = 0; i < files.length; i++) { | |||
filesList.add(new File(srcDir.getAbsolutePath() | |||
filesList.add(new File(srcDir.getAbsolutePath() | |||
+ File.separator + files[i])); | |||
} | |||
} | |||
@@ -245,7 +245,7 @@ public class Image extends MatchingTask { | |||
files = ds.getIncludedFiles(); | |||
File fromDir = fs.getDir(getProject()); | |||
for (int j = 0; j < files.length; j++) { | |||
filesList.add(new File(fromDir.getAbsolutePath() | |||
filesList.add(new File(fromDir.getAbsolutePath() | |||
+ File.separator + files[j])); | |||
} | |||
} | |||
@@ -83,26 +83,30 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool | |||
String action = getTask().getAction(); | |||
// check that the password has been set | |||
if ((getPassword() == null)) | |||
if ((getPassword() == null)) { | |||
throw new BuildException("The password attribute must be set."); | |||
} | |||
// check for missing application on deploy & update | |||
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) | |||
&& application == null) | |||
&& application == null) { | |||
throw new BuildException("The application attribute must be set " | |||
+ "if action = " + action); | |||
} | |||
// check for missing source on deploy & update | |||
if ((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) | |||
&& getTask().getSource() == null) | |||
&& getTask().getSource() == null) { | |||
throw new BuildException("The source attribute must be set if " | |||
+ "action = " + action); | |||
} | |||
// check for missing application on delete & undeploy | |||
if ((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) | |||
&& application == null) | |||
&& application == null) { | |||
throw new BuildException("The application attribute must be set if " | |||
+ "action = " + action); | |||
} | |||
} | |||
/** | |||
@@ -114,12 +118,15 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool | |||
String action = getTask().getAction(); | |||
String args = null; | |||
if (action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) | |||
if (action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) { | |||
args = buildDeployArgs(); | |||
else if (action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) | |||
} | |||
else if (action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) { | |||
args = buildUndeployArgs(); | |||
else if (action.equals(ACTION_LIST)) | |||
} | |||
else if (action.equals(ACTION_LIST)) { | |||
args = buildListArgs(); | |||
} | |||
return args; | |||
} | |||
@@ -136,7 +136,7 @@ public class JJDoc extends Task { | |||
final File javaccJar = JavaCC.getArchiveFile(javaccHome); | |||
classpath.createPathElement().setPath(javaccJar.getAbsolutePath()); | |||
classpath.addJavaRuntime(); | |||
cmdl.setClassname(JavaCC.getMainClass(classpath, | |||
JavaCC.TASKDEF_TYPE_JJDOC)); | |||
@@ -411,17 +411,17 @@ public class JavaCC extends Task { | |||
switch (type) { | |||
case TASKDEF_TYPE_JAVACC: | |||
mainClass = ORG_JAVACC_CLASS; | |||
break; | |||
case TASKDEF_TYPE_JJTREE: | |||
mainClass = ORG_JJTREE_CLASS; | |||
break; | |||
case TASKDEF_TYPE_JJDOC: | |||
mainClass = ORG_JJDOC_CLASS; | |||
break; | |||
} | |||
} | |||
@@ -66,15 +66,15 @@ public class JspC extends MatchingTask { | |||
private Path compilerClasspath; | |||
private Path src; | |||
private File destDir; | |||
private String packageName ; | |||
private String packageName; | |||
/** name of the compiler to use */ | |||
private String compilerName = "jasper"; | |||
/** | |||
* -ieplugin <clsid> Java Plugin classid for Internet Explorer | |||
*/ | |||
private String iepluginid ; | |||
private boolean mapped ; | |||
private String iepluginid; | |||
private boolean mapped; | |||
private int verbose = 0; | |||
protected Vector compileList = new Vector(); | |||
Vector javaFiles = new Vector(); | |||
@@ -59,7 +59,7 @@ public class JasperC extends DefaultJspCompilerAdapter { | |||
Java java = (Java) (getProject().createTask("java")); | |||
Path p = getClasspath(); | |||
if (getJspc().getClasspath() != null) { | |||
getProject().log("using user supplied classpath: " + p, | |||
getProject().log("using user supplied classpath: " + p, | |||
Project.MSG_DEBUG); | |||
} else { | |||
getProject().log("using system classpath: " + p, | |||
@@ -111,7 +111,7 @@ public class JasperC extends DefaultJspCompilerAdapter { | |||
+ "please use the Tomcat provided jspc task " | |||
+ "instead"); | |||
} | |||
addArg(cmd, "-uriroot", jspc.getUriroot()); | |||
addArg(cmd, "-uribase", jspc.getUribase()); | |||
addArg(cmd, "-ieplugin", jspc.getIeplugin()); | |||
@@ -608,10 +608,10 @@ public class JUnitTask extends Task { | |||
* @since Ant 1.6 | |||
*/ | |||
public void setTempdir(File tmpDir) { | |||
if (tmpDir!=null) { | |||
if (tmpDir != null) { | |||
if (!tmpDir.exists() || !tmpDir.isDirectory()) { | |||
throw new BuildException(tmpDir.toString() | |||
+" is not a valid temp directory"); | |||
+ " is not a valid temp directory"); | |||
} | |||
} | |||
this.tmpDir = tmpDir; | |||
@@ -662,7 +662,7 @@ public class JUnitTask extends Task { | |||
execute((JUnitTest) l.get(0)); | |||
} else { | |||
execute(l); | |||
} | |||
} | |||
} | |||
} finally { | |||
if (classLoader != null && reloading) { | |||
@@ -706,17 +706,17 @@ public class JUnitTask extends Task { | |||
*/ | |||
protected void execute(List tests) throws BuildException { | |||
JUnitTest test = null; | |||
// Create a temporary file to pass the test cases to run to | |||
// Create a temporary file to pass the test cases to run to | |||
// the runner (one test case per line) | |||
File casesFile = createTempPropertiesFile("junittestcases"); | |||
PrintWriter writer = null; | |||
try { | |||
writer = | |||
writer = | |||
new PrintWriter(new BufferedWriter(new FileWriter(casesFile))); | |||
Iterator iter = tests.iterator(); | |||
while (iter.hasNext()) { | |||
test = (JUnitTest) iter.next(); | |||
writer.print(test.getName()); | |||
writer.print(test.getName()); | |||
if (test.getTodir() == null) { | |||
writer.print("," + getProject().resolveFile(".")); | |||
} else { | |||
@@ -735,17 +735,17 @@ public class JUnitTask extends Task { | |||
// execute the test and get the return code | |||
ExecuteWatchdog watchdog = createWatchdog(); | |||
TestResultHolder result = | |||
TestResultHolder result = | |||
executeAsForked(test, watchdog, casesFile); | |||
actOnTestResult(result, test, "Tests"); | |||
} catch(IOException e) { | |||
} catch (IOException e) { | |||
log(e.toString(), Project.MSG_ERR); | |||
throw new BuildException(e); | |||
} finally { | |||
if (writer != null) { | |||
writer.close(); | |||
} | |||
try { | |||
casesFile.delete(); | |||
} catch (Exception e) { | |||
@@ -768,8 +768,8 @@ public class JUnitTask extends Task { | |||
* @throws BuildException in case of error creating a temporary property file, | |||
* or if the junit process can not be forked | |||
*/ | |||
private TestResultHolder executeAsForked(JUnitTest test, | |||
ExecuteWatchdog watchdog, | |||
private TestResultHolder executeAsForked(JUnitTest test, | |||
ExecuteWatchdog watchdog, | |||
File casesFile) | |||
throws BuildException { | |||
@@ -780,7 +780,7 @@ public class JUnitTask extends Task { | |||
CommandlineJava cmd = null; | |||
try { | |||
cmd = (CommandlineJava)(getCommandline().clone()); | |||
cmd = (CommandlineJava) (getCommandline().clone()); | |||
} catch (CloneNotSupportedException e) { | |||
throw new BuildException("This shouldn't happen", e, getLocation()); | |||
} | |||
@@ -791,7 +791,7 @@ public class JUnitTask extends Task { | |||
log("Running multiple tests in the same VM", Project.MSG_VERBOSE); | |||
cmd.createArgument().setValue("testsfile=" + casesFile); | |||
} | |||
cmd.createArgument().setValue("filtertrace=" + test.getFiltertrace()); | |||
cmd.createArgument().setValue("haltOnError=" + test.getHaltonerror()); | |||
cmd.createArgument().setValue("haltOnFailure=" | |||
@@ -1292,7 +1292,7 @@ public class JUnitTask extends Task { | |||
//the trick to integrating test output to the formatter, is to | |||
//create a special test class that asserts an error | |||
//and tell the formatter that it raised. | |||
//and tell the formatter that it raised. | |||
Test t = new Test() { | |||
public int countTestCases() { return 1; } | |||
public void run(TestResult r) { | |||
@@ -1323,7 +1323,7 @@ public class JUnitTask extends Task { | |||
classLoader = getProject().createClassLoader(classpath); | |||
classLoader.setParentFirst(false); | |||
classLoader.addJavaLibraries(); | |||
log("Using CLASSPATH " + classLoader.getClasspath(), | |||
log("Using CLASSPATH " + classLoader.getClasspath(), | |||
Project.MSG_VERBOSE); | |||
// make sure the test will be accepted as a TestCase | |||
classLoader.addSystemPackageRoot("junit"); | |||
@@ -1390,21 +1390,21 @@ public class JUnitTask extends Task { | |||
* @return true if everything is equal | |||
*/ | |||
public boolean equals(Object other) { | |||
if (other == null | |||
if (other == null | |||
|| other.getClass() != ForkedTestConfiguration.class) { | |||
return false; | |||
} | |||
ForkedTestConfiguration o = (ForkedTestConfiguration) other; | |||
return filterTrace == o.filterTrace | |||
return filterTrace == o.filterTrace | |||
&& haltOnError == o.haltOnError | |||
&& haltOnFailure == o.haltOnFailure | |||
&& ((errorProperty == null && o.errorProperty == null) | |||
|| | |||
(errorProperty != null | |||
|| | |||
(errorProperty != null | |||
&& errorProperty.equals(o.errorProperty))) | |||
&& ((failureProperty == null && o.failureProperty == null) | |||
|| | |||
(failureProperty != null | |||
|| | |||
(failureProperty != null | |||
&& failureProperty.equals(o.failureProperty))); | |||
} | |||
@@ -1414,7 +1414,7 @@ public class JUnitTask extends Task { | |||
* @return | |||
*/ | |||
public int hashCode() { | |||
return (filterTrace ? 1 : 0) | |||
return (filterTrace ? 1 : 0) | |||
+ (haltOnError ? 2 : 0) | |||
+ (haltOnFailure ? 4 : 0); | |||
} | |||
@@ -1506,7 +1506,7 @@ public class JUnitTask extends Task { | |||
* | |||
* @since Ant 1.7 | |||
*/ | |||
protected void actOnTestResult(TestResultHolder result, JUnitTest test, | |||
protected void actOnTestResult(TestResultHolder result, JUnitTest test, | |||
String name) { | |||
// if there is an error/failure and that it should halt, stop | |||
// everything otherwise just log a statement | |||
@@ -244,7 +244,7 @@ public class JUnitTestRunner implements TestListener { | |||
if (loader == null) { | |||
testClass = Class.forName(junitTest.getName()); | |||
} else { | |||
testClass = Class.forName(junitTest.getName(), true, | |||
testClass = Class.forName(junitTest.getName(), true, | |||
loader); | |||
} | |||
@@ -524,7 +524,7 @@ public class JUnitTestRunner implements TestListener { | |||
int returnCode = SUCCESS; | |||
if (multipleTests) { | |||
try { | |||
java.io.BufferedReader reader = | |||
java.io.BufferedReader reader = | |||
new java.io.BufferedReader(new java.io.FileReader(args[0])); | |||
String testCaseName; | |||
int code = 0; | |||
@@ -537,12 +537,12 @@ public class JUnitTestRunner implements TestListener { | |||
JUnitTest t = new JUnitTest(testCaseName); | |||
t.setTodir(new File(st.nextToken())); | |||
t.setOutfile(st.nextToken()); | |||
code = launch(t, haltError, stackfilter, haltFail, | |||
code = launch(t, haltError, stackfilter, haltFail, | |||
showOut, props); | |||
errorOccured = (code == ERRORS); | |||
failureOccured = (code != SUCCESS); | |||
if (errorOccured || failureOccured ) { | |||
if ((errorOccured && haltError) | |||
if (errorOccured || failureOccured) { | |||
if ((errorOccured && haltError) | |||
|| (failureOccured && haltFail)) { | |||
registerNonCrash(noCrashFile); | |||
System.exit(code); | |||
@@ -550,12 +550,12 @@ public class JUnitTestRunner implements TestListener { | |||
if (code > returnCode) { | |||
returnCode = code; | |||
} | |||
System.out.println("TEST " + t.getName() | |||
System.out.println("TEST " + t.getName() | |||
+ " FAILED"); | |||
} | |||
} | |||
} | |||
} catch(IOException e) { | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
} | |||
} else { | |||
@@ -574,8 +574,8 @@ public class JUnitTestRunner implements TestListener { | |||
for (int i = 0; i < fromCmdLine.size(); i++) { | |||
FormatterElement fe = (FormatterElement) fromCmdLine.elementAt(i); | |||
if (multipleTests && fe.getUseFile()) { | |||
File destFile = | |||
new File(test.getTodir(), | |||
File destFile = | |||
new File(test.getTodir(), | |||
test.getOutfile() + fe.getExtension()); | |||
fe.setOutfile(destFile); | |||
} | |||
@@ -650,10 +650,10 @@ public class JUnitTestRunner implements TestListener { | |||
* @since Ant 1.6.2 | |||
*/ | |||
private static int launch(JUnitTest t, boolean haltError, | |||
boolean stackfilter, boolean haltFail, | |||
boolean stackfilter, boolean haltFail, | |||
boolean showOut, Properties props) { | |||
t.setProperties(props); | |||
JUnitTestRunner runner = | |||
JUnitTestRunner runner = | |||
new JUnitTestRunner(t, haltError, stackfilter, haltFail, showOut); | |||
runner.forked = true; | |||
transferFormatters(runner, t); | |||
@@ -665,7 +665,7 @@ public class JUnitTestRunner implements TestListener { | |||
/** | |||
* @since Ant 1.7 | |||
*/ | |||
private static void registerNonCrash(String noCrashFile) | |||
private static void registerNonCrash(String noCrashFile) | |||
throws IOException { | |||
if (noCrashFile != null) { | |||
FileOutputStream out = null; | |||
@@ -22,7 +22,7 @@ package org.apache.tools.ant.taskdefs.optional.junit; | |||
* withOutAndErr is requested. | |||
*/ | |||
public class OutErrSummaryJUnitResultFormatter | |||
public class OutErrSummaryJUnitResultFormatter | |||
extends SummaryJUnitResultFormatter { | |||
/** | |||
@@ -93,6 +93,6 @@ public interface XMLConstants { | |||
/** | |||
* name of host running the tests | |||
*/ | |||
*/ | |||
String HOSTNAME = "hostname"; | |||
} |
@@ -108,9 +108,9 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan | |||
//add the timestamp | |||
final String timestamp = DateUtils.format(new Date(), | |||
DateUtils.ISO8601_DATETIME_PATTERN); | |||
rootElement.setAttribute(TIMESTAMP,timestamp); | |||
rootElement.setAttribute(TIMESTAMP, timestamp); | |||
//and the hostname. | |||
rootElement.setAttribute(HOSTNAME,getHostname()); | |||
rootElement.setAttribute(HOSTNAME, getHostname()); | |||
// Output properties | |||
Element propsElement = doc.createElement(PROPERTIES); | |||
@@ -47,17 +47,17 @@ public class Xalan1Executor extends XalanExecutor { | |||
return processor.getClass().getName(); | |||
} | |||
protected String getProcVersion(String classNameImpl) | |||
protected String getProcVersion(String classNameImpl) | |||
throws BuildException { | |||
try { | |||
// xalan 1 | |||
if (classNameImpl.equals(xsltP)){ | |||
if (classNameImpl.equals(xsltP)) { | |||
return getXalanVersion(xsltP + "Version"); | |||
} | |||
throw new BuildException("Could not find a valid processor version" | |||
+ " implementation from " | |||
+ " implementation from " | |||
+ classNameImpl); | |||
} catch (ClassNotFoundException e){ | |||
} catch (ClassNotFoundException e) { | |||
throw new BuildException("Could not find processor version " | |||
+ "implementation", e); | |||
} | |||
@@ -65,7 +65,7 @@ public class Xalan1Executor extends XalanExecutor { | |||
void execute() throws Exception { | |||
// need to quote otherwise it breaks because of "extra illegal tokens" | |||
processor.setStylesheetParam("output.dir", "'" | |||
processor.setStylesheetParam("output.dir", "'" | |||
+ caller.toDir.getAbsolutePath() + "'"); | |||
XSLTInputSource xml_src = new XSLTInputSource(caller.document); | |||
String system_id = caller.getStylesheetSystemId(); | |||
@@ -44,30 +44,30 @@ public class Xalan2Executor extends XalanExecutor { | |||
return tfactory.getClass().getName(); | |||
} | |||
protected String getProcVersion(String classNameImpl) | |||
protected String getProcVersion(String classNameImpl) | |||
throws BuildException { | |||
try { | |||
// xalan 2 | |||
if (classNameImpl.equals(aPack + "processor.TransformerFactoryImpl") | |||
if (classNameImpl.equals(aPack + "processor.TransformerFactoryImpl") | |||
|| | |||
classNameImpl.equals(aPack + "xslt.XSLTProcessorFactory")) { | |||
return getXalanVersion(aPack + "processor.XSLProcessorVersion"); | |||
} | |||
// xalan xsltc | |||
if (classNameImpl.equals(aPack | |||
+ "xsltc.trax.TransformerFactoryImpl")){ | |||
return getXSLTCVersion(aPack +"xsltc.ProcessorVersion"); | |||
if (classNameImpl.equals(aPack | |||
+ "xsltc.trax.TransformerFactoryImpl")) { | |||
return getXSLTCVersion(aPack + "xsltc.ProcessorVersion"); | |||
} | |||
// jdk 1.5 xsltc | |||
if (classNameImpl | |||
.equals(sPack + "internal.xsltc.trax.TransformerFactoryImpl")){ | |||
return getXSLTCVersion(sPack | |||
.equals(sPack + "internal.xsltc.trax.TransformerFactoryImpl")) { | |||
return getXSLTCVersion(sPack | |||
+ "internal.xsltc.ProcessorVersion"); | |||
} | |||
throw new BuildException("Could not find a valid processor version" | |||
+ " implementation from " | |||
+ " implementation from " | |||
+ classNameImpl); | |||
} catch (ClassNotFoundException e){ | |||
} catch (ClassNotFoundException e) { | |||
throw new BuildException("Could not find processor version " | |||
+ "implementation", e); | |||
} | |||
@@ -36,7 +36,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||
* for Xalan2/XSLTC, then for Xalan1. | |||
*/ | |||
abstract class XalanExecutor { | |||
private static final String pack = | |||
private static final String pack = | |||
"org.apache.tools.ant.taskdefs.optional.junit."; | |||
/** the transformer caller */ | |||
@@ -69,18 +69,18 @@ abstract class XalanExecutor { | |||
* @throws BuildException thrown if it could not find a valid xalan | |||
* executor. | |||
*/ | |||
static XalanExecutor newInstance(AggregateTransformer caller) | |||
static XalanExecutor newInstance(AggregateTransformer caller) | |||
throws BuildException { | |||
XalanExecutor executor = null; | |||
try { | |||
Class clazz = Class.forName(pack + "Xalan2Executor"); | |||
executor = (XalanExecutor)clazz.newInstance(); | |||
} catch (Exception xsltcApacheMissing){ | |||
executor = (XalanExecutor) clazz.newInstance(); | |||
} catch (Exception xsltcApacheMissing) { | |||
caller.task.log(xsltcApacheMissing.toString()); | |||
try { | |||
Class clazz = Class.forName(pack + "Xalan1Executor"); | |||
executor = (XalanExecutor) clazz.newInstance(); | |||
} catch (Exception xalan1Missing){ | |||
} catch (Exception xalan1Missing) { | |||
caller.task.log(xalan1Missing.toString()); | |||
throw new BuildException("Could not find xstlc nor xalan2 nor " | |||
+ "xalan1 in the classpath. Check " | |||
@@ -112,22 +112,22 @@ abstract class XalanExecutor { | |||
* @return a string representing the implementation version. | |||
* @throws BuildException | |||
*/ | |||
protected abstract String getProcVersion(String classNameImpl) | |||
protected abstract String getProcVersion(String classNameImpl) | |||
throws BuildException; | |||
/** a bit simplistic but xsltc data are conveniently private non final */ | |||
protected final String getXSLTCVersion(String procVersionClassName) | |||
protected final String getXSLTCVersion(String procVersionClassName) | |||
throws ClassNotFoundException { | |||
// there's a convenient xsltc class version but data are | |||
// private so use package information | |||
Class procVersion = Class.forName(procVersionClassName); | |||
Package pkg = procVersion.getPackage(); | |||
return pkg.getName() + " " + pkg.getImplementationTitle() | |||
return pkg.getName() + " " + pkg.getImplementationTitle() | |||
+ " " + pkg.getImplementationVersion(); | |||
} | |||
/** pretty useful data (Xalan version information) to display. */ | |||
protected final String getXalanVersion(String procVersionClassName) | |||
protected final String getXalanVersion(String procVersionClassName) | |||
throws ClassNotFoundException { | |||
Class procVersion = Class.forName(procVersionClassName); | |||
String pkg = procVersion.getPackage().getName(); | |||
@@ -346,7 +346,7 @@ public class RExecTask extends Task { | |||
try { | |||
rexec.disconnect(); | |||
} catch (IOException e) { | |||
throw new BuildException("Error disconnecting from " | |||
throw new BuildException("Error disconnecting from " | |||
+ server); | |||
} | |||
} | |||
@@ -118,7 +118,7 @@ public class TelnetTask extends Task { | |||
try { | |||
telnet.disconnect(); | |||
} catch (IOException e) { | |||
throw new BuildException("Error disconnecting from " | |||
throw new BuildException("Error disconnecting from " | |||
+ server); | |||
} | |||
} | |||
@@ -306,8 +306,8 @@ public class TelnetTask extends Task { | |||
Calendar endTime = Calendar.getInstance(); | |||
endTime.add(Calendar.SECOND, timeout.intValue()); | |||
while (sb.toString().indexOf(s) == -1) { | |||
while (Calendar.getInstance().before(endTime) && | |||
is.available() == 0) { | |||
while (Calendar.getInstance().before(endTime) | |||
&& is.available() == 0) { | |||
Thread.sleep(250); | |||
} | |||
if (is.available() == 0) { | |||
@@ -135,11 +135,11 @@ public abstract class AbstractSshMessage { | |||
* Track progress every 10% if 100kb < filesize < 1mb. For larger | |||
* files track progress for every percent transmitted. | |||
*/ | |||
protected final int trackProgress(int filesize, int totalLength, | |||
protected final int trackProgress(int filesize, int totalLength, | |||
int percentTransmitted) { | |||
int percent = (int) Math.round(Math.floor((totalLength / | |||
(double)filesize) * 100)); | |||
int percent = (int) Math.round(Math.floor((totalLength | |||
/ (double) filesize) * 100)); | |||
if (percent > percentTransmitted) { | |||
if (filesize < 1048576) { | |||
@@ -248,7 +248,7 @@ public class Scp extends SSHBase { | |||
try { | |||
session = openSession(); | |||
ScpToMessage message = | |||
new ScpToMessage(getVerbose(), session, | |||
new ScpToMessage(getVerbose(), session, | |||
getProject().resolveFile(fromPath), file); | |||
message.setLogListener(this); | |||
message.execute(); | |||
@@ -190,8 +190,8 @@ public class ScpFromMessage extends AbstractSshMessage { | |||
} | |||
if (trackProgress) { | |||
percentTransmitted = trackProgress(initFilesize, | |||
totalLength, | |||
percentTransmitted = trackProgress(initFilesize, | |||
totalLength, | |||
percentTransmitted); | |||
} | |||
} | |||
@@ -197,8 +197,8 @@ public class ScpToMessage extends AbstractSshMessage { | |||
totalLength += len; | |||
if (trackProgress) { | |||
percentTransmitted = trackProgress(initFilesize, | |||
totalLength, | |||
percentTransmitted = trackProgress(initFilesize, | |||
totalLength, | |||
percentTransmitted); | |||
} | |||
} | |||
@@ -221,19 +221,17 @@ public class StarTeamCheckout extends TreeBasedTask { | |||
// to configure the view | |||
if (this.isUsingViewLabel()) { | |||
return new View(raw, ViewConfiguration.createFromLabel(labelID)); | |||
} | |||
// if a label has been supplied and it is a revision label, use the raw | |||
// the view as the snapshot | |||
else if (this.isUsingRevisionLabel()) { | |||
} else if (this.isUsingRevisionLabel()) { | |||
return raw; | |||
} | |||
// if a date has been supplied use a view configured to the date. | |||
View view = getViewConfiguredByDate(raw); | |||
if (view != null) { | |||
return view; | |||
} | |||
// otherwise, use this view configured as the tip. | |||
else { | |||
} else { | |||
return new View(raw, ViewConfiguration.createTip()); | |||
} | |||
} | |||
@@ -581,7 +579,7 @@ public class StarTeamCheckout extends TreeBasedTask { | |||
String[] localFiles = localFolder.list(); | |||
// PR 31965 says that it can return null | |||
if (localFiles == null){ | |||
if (localFiles == null) { | |||
return this; | |||
} | |||
for (int i = 0; i < localFiles.length; i++) { | |||
@@ -98,9 +98,8 @@ public class StarTeamList extends TreeBasedTask { | |||
View view = getViewConfiguredByDate(raw); | |||
if (view != null) { | |||
return view; | |||
} | |||
// otherwise, use this view configured as the tip. | |||
else { | |||
// otherwise, use this view configured as the tip. | |||
} else { | |||
return new View(raw, ViewConfiguration.createTip()); | |||
} | |||
} | |||
@@ -369,9 +369,7 @@ public abstract class TreeBasedTask extends StarTeamTask { | |||
fmt = new SimpleDateFormat(this.asOfDateFormat); | |||
try { | |||
asOfDate = fmt.parse(this.asOfDate); | |||
} | |||
catch (ParseException px) | |||
{ | |||
} catch (ParseException px) { | |||
throw new BuildException("AsOfDate " | |||
+ this.asOfDate | |||
+ " not parsable by supplied format " | |||
@@ -160,26 +160,26 @@ public class Symlink extends Task { | |||
while (keys.hasMoreElements()) { | |||
link = (String) keys.nextElement(); | |||
resource = listOfLinks.getProperty(link); | |||
// handle the case where the link exists | |||
// and points to a directory (bug 25181) | |||
try { | |||
FileUtils fu = FileUtils.newFileUtils(); | |||
File test = new File(link); | |||
File testRes = new File(resource); | |||
if (!fu.isSymbolicLink(test.getParentFile(), | |||
test.getName())) { | |||
doLink(resource, link); | |||
} else { | |||
if (!test.getCanonicalPath(). | |||
equals(testRes.getCanonicalPath())) { | |||
Symlink.deleteSymlink(link); | |||
doLink(resource,link); | |||
} // else the link exists, do nothing | |||
} | |||
} catch (IOException ioe) { | |||
handleError("IO exception while creating " | |||
+ "link"); | |||
} | |||
// handle the case where the link exists | |||
// and points to a directory (bug 25181) | |||
try { | |||
FileUtils fu = FileUtils.newFileUtils(); | |||
File test = new File(link); | |||
File testRes = new File(resource); | |||
if (!fu.isSymbolicLink(test.getParentFile(), | |||
test.getName())) { | |||
doLink(resource, link); | |||
} else { | |||
if (!test.getCanonicalPath(). | |||
equals(testRes.getCanonicalPath())) { | |||
Symlink.deleteSymlink(link); | |||
doLink(resource, link); | |||
} // else the link exists, do nothing | |||
} | |||
} catch (IOException ioe) { | |||
handleError("IO exception while creating " | |||
+ "link"); | |||
} | |||
} | |||
} else if (action.equals("record")) { | |||
Vector vectOfLinks; | |||
@@ -54,7 +54,7 @@ public class AssertDownloaded extends BaseLibraryPolicy { | |||
* if needed | |||
*/ | |||
public boolean beforeConnect(Libraries owner, ListIterator libraries) { | |||
if(count==null) { | |||
if (count == null) { | |||
throw new BuildException(ERROR_NO_COUNT); | |||
} | |||
return true; | |||
@@ -70,11 +70,11 @@ public class AssertDownloaded extends BaseLibraryPolicy { | |||
* | |||
*/ | |||
public void afterFetched(Libraries owner, ListIterator libraries) { | |||
int fetched=owner.calculateDownloadedCount(); | |||
if(fetched!=count.intValue()) { | |||
int fetched = owner.calculateDownloadedCount(); | |||
if (fetched != count.intValue()) { | |||
throw new BuildException(ERROR_DOWNLOAD_FAILURE | |||
+count | |||
+" but fetched "+fetched); | |||
+ count | |||
+ " but fetched " + fetched); | |||
} | |||
} | |||
@@ -25,7 +25,7 @@ public abstract class BaseLibraryPolicy implements LibraryPolicy { | |||
/** | |||
* enabled flag | |||
*/ | |||
private boolean enabled=true; | |||
private boolean enabled = true; | |||
/** | |||
* turn policy on/off | |||
@@ -220,11 +220,11 @@ public abstract class HttpRepository extends Repository { | |||
public boolean fetch(Library library, boolean useTimestamp) throws IOException { | |||
String path = getRemoteLibraryURL(library); | |||
log("Downloading "+path +" to "+ library.getAbsolutePath()); | |||
URL remoteURL=new URL(path); | |||
log("Downloading " + path + " to " + library.getAbsolutePath()); | |||
URL remoteURL = new URL(path); | |||
long start, finish; | |||
start = System.currentTimeMillis(); | |||
boolean success=get(remoteURL, library.getLibraryFile(),useTimestamp, | |||
boolean success = get(remoteURL, library.getLibraryFile(), useTimestamp, | |||
username, password); | |||
finish = System.currentTimeMillis(); | |||
long diff = finish - start; | |||
@@ -240,7 +240,7 @@ public abstract class HttpRepository extends Repository { | |||
* @param useTimestamp | |||
* @return | |||
*/ | |||
public boolean get(URL url,File destFile,boolean useTimestamp,String user,String passwd) | |||
public boolean get(URL url, File destFile, boolean useTimestamp, String user, String passwd) | |||
throws IOException { | |||
//create the destination dir | |||
destFile.getParentFile().mkdirs(); | |||
@@ -253,7 +253,7 @@ public abstract class HttpRepository extends Repository { | |||
getTask.setUseTimestamp(useTimestamp); | |||
getTask.setSrc(url); | |||
getTask.setIgnoreErrors(true); | |||
return getTask.doGet(Project.MSG_VERBOSE,null); | |||
return getTask.doGet(Project.MSG_VERBOSE, null); | |||
} | |||
/** | |||
@@ -300,6 +300,6 @@ public abstract class HttpRepository extends Repository { | |||
* @return | |||
*/ | |||
public String getRepositoryURI() { | |||
return "HttpRepository://"+getUrl(); | |||
return "HttpRepository://" + getUrl(); | |||
} | |||
} |
@@ -60,7 +60,7 @@ public final class Libraries extends Task { | |||
/** | |||
* helper list | |||
*/ | |||
private EnabledLibraryElementList policies=new EnabledLibraryElementList(); | |||
private EnabledLibraryElementList policies = new EnabledLibraryElementList(); | |||
/** | |||
* repository for retrieval | |||
@@ -366,38 +366,38 @@ public final class Libraries extends Task { | |||
Iterator policyIterator = policies.enabledIterator(); | |||
while (retrieve && policyIterator.hasNext()) { | |||
LibraryPolicy libraryPolicy = (LibraryPolicy) policyIterator.next(); | |||
retrieve=libraryPolicy.beforeConnect(this, libraryIterator()); | |||
if(retrieve) { | |||
retrieve = libraryPolicy.beforeConnect(this, libraryIterator()); | |||
if (retrieve) { | |||
//add all processed properties to the list, 'cept for anything that | |||
//broke the chain | |||
processedPolicies.add(libraryPolicy); | |||
} else { | |||
log("Policy "+libraryPolicy.getClass().getName() | |||
log("Policy " + libraryPolicy.getClass().getName() | |||
+ " disabled retrieval", | |||
Project.MSG_VERBOSE); | |||
} | |||
} | |||
//see if we need to do a download | |||
if(!retrieve) { | |||
if (!retrieve) { | |||
//if not, log it | |||
log(MSG_NO_RETRIEVE); | |||
} else { | |||
int downloads = calculateFetchCount(); | |||
if(downloads>0) { | |||
if (downloads > 0) { | |||
//get the files | |||
connectAndRetrieve(repo, useTimestamp); | |||
} else { | |||
//nothing to fetch | |||
log(MSG_NO_LIBRARIES_TO_FETCH,Project.MSG_VERBOSE); | |||
log(MSG_NO_LIBRARIES_TO_FETCH, Project.MSG_VERBOSE); | |||
} | |||
} | |||
//now reverse iterate through all processed properties. | |||
for(int i=processedPolicies.size()-1;i>=0;i--) { | |||
LibraryPolicy libraryPolicy = (LibraryPolicy)processedPolicies.get(i); | |||
for (int i = processedPolicies.size() - 1; i >= 0; i--) { | |||
LibraryPolicy libraryPolicy = (LibraryPolicy) processedPolicies.get(i); | |||
//and call their post-processor | |||
libraryPolicy.afterFetched(this,libraryIterator() ); | |||
libraryPolicy.afterFetched(this, libraryIterator()); | |||
} | |||
} | |||
@@ -425,7 +425,7 @@ public final class Libraries extends Task { | |||
Project.MSG_VERBOSE); | |||
reachable = false; | |||
} | |||
if(!reachable) { | |||
if (!reachable) { | |||
log("repository is not reachable", Project.MSG_INFO); | |||
return 0; | |||
} | |||
@@ -435,11 +435,11 @@ public final class Libraries extends Task { | |||
while (it.hasNext()) { | |||
Library library = (Library) it.next(); | |||
//check to see if it is for fetching | |||
if(library.isToFetch()) { | |||
log("Fetching "+library.getNormalFilename(), Project.MSG_VERBOSE); | |||
if (library.isToFetch()) { | |||
log("Fetching " + library.getNormalFilename(), Project.MSG_VERBOSE); | |||
try { | |||
//fetch it | |||
boolean fetched=repo.fetch(library, useTimestamp) ; | |||
boolean fetched = repo.fetch(library, useTimestamp); | |||
//record the fact in the library | |||
log("success; marking as fetched", | |||
Project.MSG_DEBUG); | |||
@@ -457,7 +457,7 @@ public final class Libraries extends Task { | |||
} | |||
} finally { | |||
log("disconnecting",Project.MSG_VERBOSE); | |||
log("disconnecting", Project.MSG_VERBOSE); | |||
repo.disconnect(); | |||
} | |||
return failures; | |||
@@ -504,11 +504,11 @@ public final class Libraries extends Task { | |||
* @return count of enabled libraries with the to fetch bit set | |||
*/ | |||
public int calculateFetchCount() { | |||
int count=0; | |||
int count = 0; | |||
Iterator it = enabledLibrariesIterator(); | |||
while (it.hasNext()) { | |||
Library library = (Library) it.next(); | |||
if(library.isToFetch()) { | |||
if (library.isToFetch()) { | |||
count++; | |||
}; | |||
} | |||
@@ -540,21 +540,21 @@ public final class Libraries extends Task { | |||
protected void verifyAllLibrariesPresent() { | |||
//iterate through the libs we have | |||
boolean missing = false; | |||
StringBuffer buffer=new StringBuffer(); | |||
StringBuffer buffer = new StringBuffer(); | |||
Iterator it = enabledLibrariesIterator(); | |||
while (it.hasNext()) { | |||
Library library = (Library) it.next(); | |||
//check for the library existing | |||
if (!library.exists()) { | |||
//and log if one is missing | |||
buffer.append(library.toString()+"; "); | |||
buffer.append(library.toString() + "; "); | |||
log("Missing: " + library.toString(), | |||
Project.MSG_ERR); | |||
missing = true; | |||
} | |||
} | |||
if (missing) { | |||
throw new BuildException(ERROR_INCOMPLETE_RETRIEVAL+buffer); | |||
throw new BuildException(ERROR_INCOMPLETE_RETRIEVAL + buffer); | |||
} | |||
} | |||
@@ -78,9 +78,9 @@ public class Library implements EnabledLibraryElement { | |||
* we fetch every library by default; note the enabled/disabled | |||
* flag has precedence, and this flag is not visible in the XML | |||
*/ | |||
private boolean toFetch=true; | |||
private boolean toFetch = true; | |||
private boolean fetched=false; | |||
private boolean fetched = false; | |||
public static final String ERROR_NO_ARCHIVE = "No archive defined"; | |||
public static final String ERROR_NO_PROJECT = "No project defined"; | |||
@@ -239,15 +239,15 @@ public class Library implements EnabledLibraryElement { | |||
*/ | |||
public void bind(File baseDir) { | |||
validate(); | |||
FileUtils fileUtils=FileUtils.newFileUtils(); | |||
FileUtils fileUtils = FileUtils.newFileUtils(); | |||
if (destinationName == null) { | |||
destinationName = getMavenPath('/'); | |||
} | |||
libraryFile = fileUtils.resolveFile(baseDir, destinationName); | |||
if(libraryFile.isDirectory()) { | |||
if (libraryFile.isDirectory()) { | |||
throw new BuildException(ERROR_FILE_IS_A_DIR | |||
+libraryFile); | |||
+ libraryFile); | |||
} | |||
} | |||
@@ -22,7 +22,7 @@ import java.util.ListIterator; | |||
/** | |||
* An interface that things can support to change the library behaviour. | |||
* Example uses could be: extra validation (signatures, etc), filename remapping | |||
* | |||
* | |||
* | |||
* Here is the use | |||
* <ol> | |||
@@ -45,7 +45,7 @@ public interface LibraryPolicy extends EnabledLibraryElement { | |||
/** | |||
* Method called before we connect. Caller can manipulate the list, | |||
* | |||
* | |||
* | |||
* @param owner | |||
* | |||
@@ -63,7 +63,7 @@ public interface LibraryPolicy extends EnabledLibraryElement { | |||
* @param libraries | |||
* @throws org.apache.tools.ant.BuildException | |||
*/ | |||
public void afterFetched(Libraries owner,ListIterator libraries); | |||
public void afterFetched(Libraries owner, ListIterator libraries); | |||
} |
@@ -111,33 +111,33 @@ public class MavenRepository extends HttpRepository { | |||
* | |||
*/ | |||
public boolean fetch(Library library, boolean useTimestamp) throws IOException { | |||
boolean fetched=super.fetch(library, useTimestamp); | |||
if(fetched && checkMD5) { | |||
boolean fetched = super.fetch(library, useTimestamp); | |||
if (fetched && checkMD5) { | |||
//we got here if there was a fetch. so we now get the MD5 info from the file, | |||
boolean successful=false; | |||
boolean successful = false; | |||
String md5path = getRemoteLibraryURL(library) + ".md5"; | |||
File md5file = File.createTempFile(library.getArchive(),".md5"); | |||
File md5file = File.createTempFile(library.getArchive(), ".md5"); | |||
Reader in = null; | |||
try { | |||
URL md5url=new URL(md5path); | |||
logVerbose("getting md5 file from " + md5path +" to "+md5file.getAbsolutePath()); | |||
get(md5url,md5file, false,getUsername(), getPassword()); | |||
in = new InputStreamReader(new FileInputStream(md5file),MAVEN_MD5_FILE_TYPE); | |||
char md5data[] =new char[32]; | |||
URL md5url = new URL(md5path); | |||
logVerbose("getting md5 file from " + md5path + " to " + md5file.getAbsolutePath()); | |||
get(md5url, md5file, false, getUsername(), getPassword()); | |||
in = new InputStreamReader(new FileInputStream(md5file), MAVEN_MD5_FILE_TYPE); | |||
char md5data[] = new char[32]; | |||
in.read(md5data); | |||
logDebug("md5 data "+md5data); | |||
logDebug("md5 data " + md5data); | |||
//TODO: verify this against a <checksum> generated signature. | |||
successful=true; | |||
successful = true; | |||
} catch (IOException e) { | |||
logVerbose("IO failure on MD5 fetch "+e.getMessage()); | |||
logVerbose("IO failure on MD5 fetch " + e.getMessage()); | |||
throw e; | |||
} finally { | |||
FileUtils.close(in); | |||
if(md5file.exists()) { | |||
if (md5file.exists()) { | |||
md5file.delete(); | |||
} | |||
if(!successful) { | |||
if (!successful) { | |||
//if security checks failed for any reason, | |||
//delete the library file | |||
//brute force paranoia | |||
@@ -53,7 +53,7 @@ public abstract class Repository extends DataType { | |||
if (getRefid() == null) { | |||
return this; | |||
} else { | |||
Repository repository = (Repository) getCheckedRef(Repository.class, | |||
Repository repository = (Repository) getCheckedRef(Repository.class, | |||
"Repository"); | |||
return repository; | |||
} | |||
@@ -109,7 +109,7 @@ public abstract class Repository extends DataType { | |||
/** | |||
* this is a string that uniquely describes the repository | |||
* and can be used for equality tests <i>across</i> instances. | |||
* and can be used for equality tests <i>across</i> instances. | |||
* @return | |||
*/ | |||
public abstract String getRepositoryURI(); | |||
@@ -29,7 +29,7 @@ import java.io.IOException; | |||
* @since Ant1.7 | |||
*/ | |||
public final class RepositoryRef extends Repository { | |||
/** this constant name is only funny to COM developers | |||
/** this constant name is only funny to COM developers | |||
*/ | |||
public static final String E_NOTIMPL = "Not Implemented"; | |||
@@ -84,6 +84,6 @@ public final class RepositoryRef extends Repository { | |||
* @return | |||
*/ | |||
public String getRepositoryURI() { | |||
return "ref://"+getRefid(); | |||
return "ref://" + getRefid(); | |||
} | |||
} |
@@ -45,8 +45,8 @@ import java.util.Properties; | |||
*/ | |||
public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
private File markerFile; | |||
private int hours=17; | |||
private int days=0; | |||
private int hours = 17; | |||
private int days = 0; | |||
/** | |||
* if not null, this means that we have a marker file to save | |||
@@ -100,7 +100,7 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
* @return | |||
*/ | |||
public long getInterval() { | |||
return ((days*24)+hours)*60*60000; | |||
return ((days * 24) + hours) * 60 * 60000; | |||
} | |||
@@ -117,19 +117,19 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
*/ | |||
public boolean beforeConnect(Libraries owner, ListIterator libraries) { | |||
Repository repository=owner.getRepository(); | |||
if(markerFile==null) { | |||
Repository repository = owner.getRepository(); | |||
if (markerFile == null) { | |||
throw new BuildException(ERROR_NO_MARKER_FILE); | |||
} | |||
Properties now = makeProperties(owner.enabledLibrariesIterator(), repository); | |||
try { | |||
if(markerFile.exists()) { | |||
long timestamp=markerFile.lastModified(); | |||
Properties then=loadMarkerFile(); | |||
long currentTime=System.currentTimeMillis(); | |||
long diff=currentTime-timestamp; | |||
if(now.equals(then)) { | |||
if(diff<getInterval()) { | |||
if (markerFile.exists()) { | |||
long timestamp = markerFile.lastModified(); | |||
Properties then = loadMarkerFile(); | |||
long currentTime = System.currentTimeMillis(); | |||
long diff = currentTime - timestamp; | |||
if (now.equals(then)) { | |||
if (diff < getInterval()) { | |||
owner.log(INTERVAL_SHORT_NO_UPDATE, | |||
Project.MSG_VERBOSE); | |||
return false; | |||
@@ -148,7 +148,7 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
markerFileToSave = now; | |||
return true; | |||
} catch (IOException e) { | |||
throw new BuildException("Marker file "+markerFile.getAbsolutePath()+" access failed",e); | |||
throw new BuildException("Marker file " + markerFile.getAbsolutePath() + " access failed", e); | |||
} | |||
} | |||
@@ -160,13 +160,13 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
*/ | |||
public void afterFetched(Libraries owner, ListIterator libraries) { | |||
if(markerFileToSave!=null) { | |||
if (markerFileToSave != null) { | |||
//if we get here, we need to save the file | |||
try { | |||
saveMarkerFile(markerFileToSave); | |||
} catch (IOException e) { | |||
throw new BuildException("Failed to save marker file " | |||
+markerFile, | |||
+ markerFile, | |||
e); | |||
} | |||
} else { | |||
@@ -182,14 +182,14 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
* @return a new properties file | |||
*/ | |||
protected Properties makeProperties(Iterator libraries, Repository repository) { | |||
Properties props=new Properties(); | |||
int counter=1; | |||
Properties props = new Properties(); | |||
int counter = 1; | |||
while (libraries.hasNext()) { | |||
Library library = (Library) libraries.next(); | |||
String name=makeEntry(library); | |||
props.put(Integer.toString(counter),name); | |||
String name = makeEntry(library); | |||
props.put(Integer.toString(counter), name); | |||
} | |||
props.put("repository",repository.getRepositoryURI()); | |||
props.put("repository", repository.getRepositoryURI()); | |||
return props; | |||
} | |||
@@ -201,9 +201,9 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
protected void saveMarkerFile(Properties props) | |||
throws IOException { | |||
markerFile.getParentFile().mkdirs(); | |||
OutputStream out= new BufferedOutputStream(new FileOutputStream(markerFile)); | |||
OutputStream out = new BufferedOutputStream(new FileOutputStream(markerFile)); | |||
try { | |||
props.store(out,null); | |||
props.store(out, null); | |||
} finally { | |||
FileUtils.close(out); | |||
} | |||
@@ -215,8 +215,8 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
* @throws IOException | |||
*/ | |||
protected Properties loadMarkerFile() throws IOException { | |||
Properties props=new Properties(); | |||
InputStream in=new BufferedInputStream(new FileInputStream(markerFile)); | |||
Properties props = new Properties(); | |||
InputStream in = new BufferedInputStream(new FileInputStream(markerFile)); | |||
try { | |||
props.load(in); | |||
return props; | |||
@@ -234,6 +234,6 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy { | |||
* @return | |||
*/ | |||
protected String makeEntry(Library lib) { | |||
return lib.getMavenPath('/')+"//"+lib.getNormalFilename(); | |||
return lib.getMavenPath('/') + "//" + lib.getNormalFilename(); | |||
} | |||
} |
@@ -45,21 +45,21 @@ public class ForkingSunRmic extends DefaultRmicAdapter { | |||
* the name of this adapter for users to select | |||
*/ | |||
public static final String COMPILER_NAME = "forking"; | |||
/** | |||
* exec by creating a new command | |||
* @return | |||
* @throws BuildException | |||
*/ | |||
public boolean execute() throws BuildException { | |||
Rmic owner=getRmic(); | |||
Rmic owner = getRmic(); | |||
Commandline cmd = setupRmicCommand(); | |||
Project project=owner.getProject(); | |||
Project project = owner.getProject(); | |||
//rely on RMIC being on the path | |||
cmd.setExecutable(JavaEnvUtils.getJdkExecutable(SunRmic.RMIC_EXECUTABLE)); | |||
//set up the args | |||
String[] args=cmd.getCommandline(); | |||
String[] args = cmd.getCommandline(); | |||
try { | |||
Execute exe = new Execute(new LogStreamHandler(owner, | |||
@@ -70,11 +70,10 @@ public class ForkingSunRmic extends DefaultRmicAdapter { | |||
exe.setCommandline(args); | |||
exe.execute(); | |||
return exe.getExitValue()==0; | |||
return exe.getExitValue() == 0; | |||
} catch (IOException exception) { | |||
throw new BuildException("Error running "+ SunRmic.RMIC_EXECUTABLE | |||
+" -maybe it is not on the path" , | |||
exception); | |||
throw new BuildException("Error running " + SunRmic.RMIC_EXECUTABLE | |||
+ " -maybe it is not on the path", exception); | |||
} | |||
} | |||
} |
@@ -46,7 +46,7 @@ public class KaffeRmic extends DefaultRmicAdapter { | |||
Constructor cons = c.getConstructor(new Class[] {String[].class}); | |||
Object rmic = cons.newInstance(new Object[] {cmd.getArguments()}); | |||
Method doRmic = c.getMethod("run", (Class[]) null); | |||
Boolean ok = (Boolean) doRmic.invoke(rmic, (Object[])null); | |||
Boolean ok = (Boolean) doRmic.invoke(rmic, (Object[]) null); | |||
return ok.booleanValue(); | |||
} catch (ClassNotFoundException ex) { | |||
@@ -58,11 +58,11 @@ public class RmicAdapterFactory { | |||
throws BuildException { | |||
//handle default specially. | |||
if(DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length()==0) { | |||
String adapter = KaffeRmic.isAvailable() ? | |||
KaffeRmic.COMPILER_NAME | |||
:SunRmic.COMPILER_NAME; | |||
return getRmic(adapter,task); | |||
if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) { | |||
String adapter = KaffeRmic.isAvailable() | |||
? KaffeRmic.COMPILER_NAME | |||
: SunRmic.COMPILER_NAME; | |||
return getRmic(adapter, task); | |||
} | |||
if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) { | |||
@@ -92,10 +92,10 @@ public class RmicAdapterFactory { | |||
Object o = c.newInstance(); | |||
return (RmicAdapter) o; | |||
} catch (ClassNotFoundException cnfe) { | |||
throw new BuildException(ERROR_UNKNOWN_COMPILER+className, | |||
throw new BuildException(ERROR_UNKNOWN_COMPILER + className, | |||
cnfe); | |||
} catch (ClassCastException cce) { | |||
throw new BuildException(ERROR_NOT_RMIC_ADAPTER+className, | |||
throw new BuildException(ERROR_NOT_RMIC_ADAPTER + className, | |||
cce); | |||
} catch (Throwable t) { | |||
// for all other possibilities | |||
@@ -42,7 +42,7 @@ public class SunRmic extends DefaultRmicAdapter { | |||
* the name of this adapter for users to select | |||
*/ | |||
public static final String COMPILER_NAME = "sun"; | |||
/** | |||
* name of the executable | |||
*/ | |||
@@ -160,7 +160,7 @@ public class Assertions extends DataType implements Cloneable { | |||
* @param commandList | |||
*/ | |||
public void applyAssertions(List commandList) { | |||
getProject().log("Applying assertions",Project.MSG_DEBUG); | |||
getProject().log("Applying assertions", Project.MSG_DEBUG); | |||
Assertions clause = getFinalReference(); | |||
//do the system assertions | |||
if (Boolean.TRUE.equals(clause.enableSystemAssertions)) { | |||
@@ -176,7 +176,7 @@ public class Assertions extends DataType implements Cloneable { | |||
while (it.hasNext()) { | |||
BaseAssertion assertion = (BaseAssertion) it.next(); | |||
String arg = assertion.toCommand(); | |||
getProject().log("adding assertion "+arg, Project.MSG_DEBUG); | |||
getProject().log("adding assertion " + arg, Project.MSG_DEBUG); | |||
commandList.add(arg); | |||
} | |||
} | |||
@@ -225,7 +225,7 @@ public class Assertions extends DataType implements Cloneable { | |||
while (it.hasNext()) { | |||
BaseAssertion assertion = (BaseAssertion) it.next(); | |||
String arg = assertion.toCommand(); | |||
getProject().log("adding assertion "+arg, Project.MSG_DEBUG); | |||
getProject().log("adding assertion " + arg, Project.MSG_DEBUG); | |||
commandIterator.add(arg); | |||
} | |||
} | |||
@@ -389,8 +389,8 @@ public class CommandlineJava implements Cloneable { | |||
if (haveBootclasspath(true)) { | |||
listIterator.add("-Xbootclasspath:" + bootclasspath.toString()); | |||
} else if (cloneBootclasspath()) { | |||
listIterator.add("-Xbootclasspath:" + | |||
Path.systemBootClasspath.toString()); | |||
listIterator.add("-Xbootclasspath:" | |||
+ Path.systemBootClasspath.toString()); | |||
} | |||
//main classpath | |||
@@ -152,7 +152,7 @@ public abstract class DataType extends ProjectComponent { | |||
Object o = ref.getReferencedObject(getProject()); | |||
if (!(requiredClass.isAssignableFrom(o.getClass()))) { | |||
log("Class "+o.getClass()+" is not a subclass of "+requiredClass, | |||
log("Class " + o.getClass() + " is not a subclass of " + requiredClass, | |||
Project.MSG_VERBOSE); | |||
String msg = ref.getRefId() + " doesn\'t denote a " + dataTypeName; | |||
throw new BuildException(msg); | |||
@@ -73,7 +73,7 @@ public class Mapper extends DataType implements Cloneable { | |||
} else { | |||
FileNameMapper m = getImplementation(); | |||
if (m instanceof ContainerMapper) { | |||
container = (ContainerMapper)m; | |||
container = (ContainerMapper) m; | |||
} else { | |||
throw new BuildException(String.valueOf(m) | |||
+ " mapper implementation does not support nested mappers!"); | |||
@@ -197,7 +197,7 @@ public class Mapper extends DataType implements Cloneable { | |||
try { | |||
FileNameMapper m | |||
= (FileNameMapper)(getImplementationClass().newInstance()); | |||
= (FileNameMapper) (getImplementationClass().newInstance()); | |||
final Project p = getProject(); | |||
if (p != null) { | |||
p.setProjectReference(m); | |||
@@ -87,7 +87,7 @@ public class Permissions { | |||
* prevent your part from starting, as for instance changing classloaders may be prohibited. | |||
* The classloader for the new situation is supposed to be present. | |||
*/ | |||
public void setSecurityManager() throws BuildException{ | |||
public void setSecurityManager() throws BuildException { | |||
origSm = System.getSecurityManager(); | |||
init(); | |||
System.setSecurityManager(new MySM()); | |||
@@ -110,7 +110,7 @@ public class Permissions { | |||
if (p.getClassName() == null) { | |||
throw new BuildException("Granted permission " + p + " does not contain a class."); | |||
} else { | |||
java.security.Permission perm = new UnresolvedPermission(p.getClassName(),p.getName(),p.getActions(),null); | |||
java.security.Permission perm = new UnresolvedPermission(p.getClassName(), p.getName(), p.getActions(), null); | |||
granted.add(perm); | |||
} | |||
} | |||
@@ -160,7 +160,7 @@ public class Permissions { | |||
* @param status The exit status requested. | |||
*/ | |||
public void checkExit(int status) { | |||
java.security.Permission perm = new java.lang.RuntimePermission("exitVM",null); | |||
java.security.Permission perm = new java.lang.RuntimePermission("exitVM", null); | |||
try { | |||
checkPermission(perm); | |||
} catch (SecurityException e) { | |||
@@ -203,7 +203,7 @@ public class Permissions { | |||
*/ | |||
private void checkRevoked(java.security.Permission perm) { | |||
for (Iterator i = revokedPermissions.listIterator(); i.hasNext();) { | |||
if (((Permissions.Permission)i.next()).matches(perm)) { | |||
if (((Permissions.Permission) i.next()).matches(perm)) { | |||
throw new SecurityException("Permission " + perm + " was revoked."); | |||
} | |||
} | |||
@@ -108,7 +108,7 @@ public class RedirectorElement extends DataType { | |||
} | |||
if (this.inputMapper != null) { | |||
if (usingInput) { | |||
throw new BuildException("attribute \"input\"" | |||
throw new BuildException("attribute \"input\"" | |||
+ " cannot coexist with a nested <inputmapper>"); | |||
} else { | |||
throw new BuildException("Cannot have > 1 <inputmapper>"); | |||
@@ -146,7 +146,7 @@ public class RedirectorElement extends DataType { | |||
} | |||
if (this.errorMapper != null) { | |||
if (usingError) { | |||
throw new BuildException("attribute \"error\"" | |||
throw new BuildException("attribute \"error\"" | |||
+ " cannot coexist with a nested <errormapper>"); | |||
} else { | |||
throw new BuildException("Cannot have > 1 <errormapper>"); | |||
@@ -530,7 +530,7 @@ public class RedirectorElement extends DataType { | |||
list.add(getProject().resolveFile(name[i])); | |||
} | |||
} | |||
return (File[])(list.toArray(new File[list.size()])); | |||
return (File[]) (list.toArray(new File[list.size()])); | |||
} | |||
} |
@@ -91,7 +91,9 @@ public class DependScanner extends DirectoryScanner { | |||
//inherit doc | |||
public int getIncludedFilesCount() { | |||
if (included == null) throw new IllegalStateException(); | |||
if (included == null) { | |||
throw new IllegalStateException(); | |||
} | |||
return included.size(); | |||
} | |||
@@ -494,7 +494,7 @@ public class ModifiedSelector extends BaseExtendSelector implements BuildListene | |||
} else { | |||
clazz = Class.forName(classname); | |||
} | |||
Object rv = clazz.newInstance(); | |||
if (!type.isInstance(rv)) { | |||
@@ -39,14 +39,14 @@ public class ChainedMapper extends ContainerMapper { | |||
FileNameMapper mapper = null; | |||
for (Iterator mIter = getMappers().iterator(); mIter.hasNext();) { | |||
mapper = (FileNameMapper)(mIter.next()); | |||
mapper = (FileNameMapper) (mIter.next()); | |||
if (mapper != null) { | |||
inputs.clear(); | |||
inputs.addAll(results); | |||
results.clear(); | |||
for (Iterator it = inputs.iterator(); it.hasNext();) { | |||
String[] mapped = mapper.mapFileName((String)(it.next())); | |||
String[] mapped = mapper.mapFileName((String) (it.next())); | |||
if (mapped != null) { | |||
results.addAll(Arrays.asList(mapped)); | |||
} | |||
@@ -32,7 +32,7 @@ public class CompositeMapper extends ContainerMapper { | |||
FileNameMapper mapper = null; | |||
for (Iterator mIter = getMappers().iterator(); mIter.hasNext();) { | |||
mapper = (FileNameMapper)(mIter.next()); | |||
mapper = (FileNameMapper) (mIter.next()); | |||
if (mapper != null) { | |||
String[] mapped = mapper.mapFileName(sourceFileName); | |||
if (mapped != null) { | |||
@@ -43,7 +43,7 @@ public class ConcatFileInputStream extends InputStream { | |||
* Construct a new <CODE>ConcatFileInputStream</CODE> | |||
* with the specified <CODE>File[]</CODE>. | |||
* @param file <CODE>File[]</CODE>. | |||
* @throws <CODE>IOException</CODE> if I/O errors occur. | |||
* @throws IOException if I/O errors occur. | |||
*/ | |||
public ConcatFileInputStream(File[] file) throws IOException { | |||
this.file = file; | |||
@@ -43,7 +43,7 @@ public abstract class ContainerMapper implements FileNameMapper { | |||
/** | |||
* Add a <code>FileNameMapper</code>. | |||
* @param fileNameMapper a <CODE>FileNameMapper</CODE>. | |||
* @throws <CODE>IllegalArgumentException</CODE> if attempting to add this | |||
* @throws IllegalArgumentException if attempting to add this | |||
* <CODE>ContainerMapper</CODE> to itself, or if the specified | |||
* <CODE>FileNameMapper</CODE> is itself a <CODE>ContainerMapper</CODE> | |||
* that contains this <CODE>ContainerMapper</CODE>. | |||
@@ -51,7 +51,7 @@ public abstract class ContainerMapper implements FileNameMapper { | |||
public synchronized void add(FileNameMapper fileNameMapper) { | |||
if (this == fileNameMapper | |||
|| (fileNameMapper instanceof ContainerMapper | |||
&& ((ContainerMapper)fileNameMapper).contains(this))) { | |||
&& ((ContainerMapper) fileNameMapper).contains(this))) { | |||
throw new IllegalArgumentException( | |||
"Circular mapper containment condition detected"); | |||
} else { | |||
@@ -68,10 +68,10 @@ public abstract class ContainerMapper implements FileNameMapper { | |||
protected synchronized boolean contains(FileNameMapper fileNameMapper) { | |||
boolean foundit = false; | |||
for (Iterator iter = mappers.iterator(); iter.hasNext() && !foundit;) { | |||
FileNameMapper next = (FileNameMapper)(iter.next()); | |||
foundit|= (next == fileNameMapper | |||
FileNameMapper next = (FileNameMapper) (iter.next()); | |||
foundit |= (next == fileNameMapper | |||
|| (next instanceof ContainerMapper | |||
&& ((ContainerMapper)next).contains(fileNameMapper))); | |||
&& ((ContainerMapper) next).contains(fileNameMapper))); | |||
} | |||
return foundit; | |||
} | |||
@@ -62,7 +62,7 @@ import org.apache.tools.ant.launch.Locator; | |||
public class FileUtils { | |||
//get some non-crypto-grade randomness from various places. | |||
private static Random rand = new Random(System.currentTimeMillis() | |||
+Runtime.getRuntime().freeMemory()); | |||
+ Runtime.getRuntime().freeMemory()); | |||
private boolean onNetWare = Os.isFamily("netware"); | |||
@@ -670,7 +670,7 @@ public class FileUtils { | |||
public void setFileLastModified(File file, long time) | |||
throws BuildException { | |||
if (time < 0) { | |||
time=System.currentTimeMillis(); | |||
time = System.currentTimeMillis(); | |||
} | |||
file.setLastModified(time); | |||
} | |||
@@ -882,8 +882,8 @@ public class FileUtils { | |||
String name = f.getName(); | |||
boolean isAbsolute = path.charAt(0) == File.separatorChar; | |||
// treat directories specified using .DIR syntax as files | |||
boolean isDirectory = f.isDirectory() && | |||
!name.regionMatches(true, name.length() - 4, ".DIR", 0, 4); | |||
boolean isDirectory = f.isDirectory() | |||
&& !name.regionMatches(true, name.length() - 4, ".DIR", 0, 4); | |||
String device = null; | |||
StringBuffer directory = null; | |||
@@ -919,9 +919,9 @@ public class FileUtils { | |||
if (!isAbsolute && directory != null) { | |||
directory.insert(0, '.'); | |||
} | |||
osPath = ((device != null) ? device + ":" : "") + | |||
((directory != null) ? "[" + directory + "]" : "") + | |||
((file != null) ? file : ""); | |||
osPath = ((device != null) ? device + ":" : "") | |||
+ ((directory != null) ? "[" + directory + "]" : "") | |||
+ ((file != null) ? file : ""); | |||
return osPath; | |||
} | |||
@@ -1314,7 +1314,7 @@ public class FileUtils { | |||
* by filesystem. We do not have an easy way to probe for file systems, | |||
* however. | |||
* @return the difference, in milliseconds, which two file timestamps must have | |||
* in order for the two files to be given a creation order. | |||
* in order for the two files to be given a creation order. | |||
*/ | |||
public long getFileTimestampGranularity() { | |||
if (Os.isFamily("dos")) { | |||
@@ -1335,14 +1335,14 @@ public class FileUtils { | |||
* granularity into account | |||
* @since Ant1.7 | |||
*/ | |||
public boolean isUpToDate(File source,File dest,long granularity) { | |||
public boolean isUpToDate(File source, File dest, long granularity) { | |||
//do a check for the destination file existing | |||
if(!dest.exists()) { | |||
if (!dest.exists()) { | |||
//if it does not, then the file is not up to date. | |||
return false; | |||
} | |||
long sourceTime=source.lastModified(); | |||
long destTime=dest.lastModified(); | |||
long sourceTime = source.lastModified(); | |||
long destTime = dest.lastModified(); | |||
return isUpToDate(sourceTime, destTime, granularity); | |||
} | |||
@@ -1366,8 +1366,8 @@ public class FileUtils { | |||
* @param granularity os/filesys granularity | |||
* @return true if the dest file is considered up to date | |||
*/ | |||
public boolean isUpToDate(long sourceTime,long destTime, long granularity) { | |||
if(destTime==-1) { | |||
public boolean isUpToDate(long sourceTime, long destTime, long granularity) { | |||
if (destTime == -1) { | |||
return false; | |||
} | |||
return destTime >= sourceTime + granularity; | |||
@@ -1382,7 +1382,7 @@ public class FileUtils { | |||
* @return true if the dest file is considered up to date | |||
*/ | |||
public boolean isUpToDate(long sourceTime, long destTime) { | |||
return isUpToDate(sourceTime, destTime,getFileTimestampGranularity()); | |||
return isUpToDate(sourceTime, destTime, getFileTimestampGranularity()); | |||
} | |||
@@ -1408,7 +1408,7 @@ public class FileUtils { | |||
* @param device stream, can be null | |||
*/ | |||
public static void close(Reader device) { | |||
if ( device != null ) { | |||
if (device != null) { | |||
try { | |||
device.close(); | |||
} catch (IOException ioex) { | |||
@@ -1424,7 +1424,7 @@ public class FileUtils { | |||
* @param device stream, can be null | |||
*/ | |||
public static void close(OutputStream device) { | |||
if ( device != null ) { | |||
if (device != null) { | |||
try { | |||
device.close(); | |||
} catch (IOException ioex) { | |||
@@ -1440,7 +1440,7 @@ public class FileUtils { | |||
* @param device stream, can be null | |||
*/ | |||
public static void close(InputStream device) { | |||
if ( device != null ) { | |||
if (device != null) { | |||
try { | |||
device.close(); | |||
} catch (IOException ioex) { | |||
@@ -1455,7 +1455,7 @@ public class FileUtils { | |||
* @param file file to delete | |||
*/ | |||
public static void delete(File file) { | |||
if(file!=null) { | |||
if (file != null) { | |||
file.delete(); | |||
} | |||
} | |||