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