git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274851 13f79535-47bb-0310-9956-ffa450edef68master
@@ -259,7 +259,7 @@ public class DemuxOutputStream extends OutputStream { | |||||
if (blockLength > 0) { | if (blockLength > 0) { | ||||
bufferInfo.buffer.write(b, blockStartOffset, blockLength); | bufferInfo.buffer.write(b, blockStartOffset, blockLength); | ||||
} | } | ||||
while(remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) { | |||||
while (remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) { | |||||
write(b[offset]); | write(b[offset]); | ||||
offset++; | offset++; | ||||
remaining--; | remaining--; | ||||
@@ -417,8 +417,7 @@ public class IntrospectionHelper implements BuildListener { | |||||
* | * | ||||
* @return a helper for the specified class | * @return a helper for the specified class | ||||
*/ | */ | ||||
public static synchronized IntrospectionHelper getHelper(Project p, Class c) | |||||
{ | |||||
public static synchronized IntrospectionHelper getHelper(Project p, Class c) { | |||||
IntrospectionHelper ih = (IntrospectionHelper) helpers.get(c); | IntrospectionHelper ih = (IntrospectionHelper) helpers.get(c); | ||||
if (ih == null) { | if (ih == null) { | ||||
ih = new IntrospectionHelper(c); | ih = new IntrospectionHelper(c); | ||||
@@ -309,7 +309,7 @@ public class Main implements AntMain { | |||||
} else if (arg.equals("-version")) { | } else if (arg.equals("-version")) { | ||||
printVersion(); | printVersion(); | ||||
return; | return; | ||||
} else if (arg.equals("-diagnostics")){ | |||||
} else if (arg.equals("-diagnostics")) { | |||||
Diagnostics.doReport(System.out); | Diagnostics.doReport(System.out); | ||||
return; | return; | ||||
} else if (arg.equals("-quiet") || arg.equals("-q")) { | } else if (arg.equals("-quiet") || arg.equals("-q")) { | ||||
@@ -482,7 +482,7 @@ public class Main implements AntMain { | |||||
if (fis != null) { | if (fis != null) { | ||||
try { | try { | ||||
fis.close(); | fis.close(); | ||||
} catch (IOException e){ | |||||
} catch (IOException e) { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -606,7 +606,7 @@ public class Main implements AntMain { | |||||
// only in JDK > 1.1 | // only in JDK > 1.1 | ||||
SecurityManager oldsm = null; | SecurityManager oldsm = null; | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0) && | if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0) && | ||||
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)){ | |||||
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
oldsm = System.getSecurityManager(); | oldsm = System.getSecurityManager(); | ||||
//SecurityManager can not be installed here for backwards | //SecurityManager can not be installed here for backwards | ||||
@@ -660,7 +660,7 @@ public class Main implements AntMain { | |||||
} finally { | } finally { | ||||
// put back the original security manager | // put back the original security manager | ||||
//The following will never eval to true. (PD) | //The following will never eval to true. (PD) | ||||
if (oldsm != null){ | |||||
if (oldsm != null) { | |||||
System.setSecurityManager(oldsm); | System.setSecurityManager(oldsm); | ||||
} | } | ||||
@@ -252,8 +252,7 @@ public final class TailFilter | |||||
if (lineList.size() > skip) { | if (lineList.size() > skip) { | ||||
return (String) lineList.removeFirst(); | return (String) lineList.removeFirst(); | ||||
} | } | ||||
} | |||||
else { | |||||
} else { | |||||
long linesToKeep = lines + (skip > 0 ? skip : 0); | long linesToKeep = lines + (skip > 0 ? skip : 0); | ||||
if (linesToKeep < lineList.size()) { | if (linesToKeep < lineList.size()) { | ||||
lineList.removeFirst(); | lineList.removeFirst(); | ||||
@@ -194,7 +194,7 @@ public final class ChainReaderHelper { | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if ( !consPresent ) { | |||||
if ( !consPresent) { | |||||
throw new BuildException( className + | throw new BuildException( className + | ||||
" does not define a public constructor" + | " does not define a public constructor" + | ||||
" that takes in a Reader as its single argument."); | " that takes in a Reader as its single argument."); | ||||
@@ -145,9 +145,9 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
if (source instanceof File) { | if (source instanceof File) { | ||||
buildFile = (File) source; | buildFile = (File) source; | ||||
// } else if (source instanceof InputStream ) { | |||||
// } else if (source instanceof URL ) { | |||||
// } else if (source instanceof InputSource ) { | |||||
// } else if (source instanceof InputStream) { | |||||
// } else if (source instanceof URL) { | |||||
// } else if (source instanceof InputSource) { | |||||
} else { | } else { | ||||
throw new BuildException("Source " + source.getClass().getName() + | throw new BuildException("Source " + source.getClass().getName() + | ||||
" not supported by this plugin"); | " not supported by this plugin"); | ||||
@@ -432,7 +432,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
if (qname.equals("project")) { | if (qname.equals("project")) { | ||||
return ProjectHelper2.projectHandler; | return ProjectHelper2.projectHandler; | ||||
} else { | } else { | ||||
// if (context.importlevel > 0 ) { | |||||
// if (context.importlevel > 0) { | |||||
// // we are in an imported file. Allow top-level <target>. | // // we are in an imported file. Allow top-level <target>. | ||||
// if (qname.equals( "target" ) ) | // if (qname.equals( "target" ) ) | ||||
// return ProjectHelper2.targetHandler; | // return ProjectHelper2.targetHandler; | ||||
@@ -166,8 +166,7 @@ public class MailLogger extends DefaultLogger { | |||||
(success) ? "Build Success" : "Build Failure"); | (success) ? "Build Success" : "Build Failure"); | ||||
if (user.equals("") && password.equals("") && !ssl) { | if (user.equals("") && password.equals("") && !ssl) { | ||||
sendMail(mailhost, port, from, replytoList, toList, subject, buffer.substring(0)); | sendMail(mailhost, port, from, replytoList, toList, subject, buffer.substring(0)); | ||||
} | |||||
else { | |||||
} else { | |||||
sendMimeMail(event.getProject(), mailhost, port, user, password, ssl, from, replytoList, toList, subject, buffer.substring(0)); | sendMimeMail(event.getProject(), mailhost, port, user, password, ssl, from, replytoList, toList, subject, buffer.substring(0)); | ||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -283,7 +283,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
System.getProperty("user.home")) | System.getProperty("user.home")) | ||||
+ File.separatorChar + ".cvspass"); | + File.separatorChar + ".cvspass"); | ||||
if(defaultPassFile.exists()) { | |||||
if (defaultPassFile.exists()) { | |||||
this.setPassfile(defaultPassFile); | this.setPassfile(defaultPassFile); | ||||
} | } | ||||
} | } | ||||
@@ -411,7 +411,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
} | } | ||||
} | } | ||||
private String executeToString(Execute execute){ | |||||
private String executeToString(Execute execute) { | |||||
StringBuffer stringBuffer = | StringBuffer stringBuffer = | ||||
new StringBuffer(Commandline.describeCommand(execute | new StringBuffer(Commandline.describeCommand(execute | ||||
@@ -425,7 +425,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
stringBuffer.append(newLine); | stringBuffer.append(newLine); | ||||
stringBuffer.append("environment:"); | stringBuffer.append("environment:"); | ||||
stringBuffer.append(newLine); | stringBuffer.append(newLine); | ||||
for (int z = 0; z < variableArray.length; z++){ | |||||
for (int z = 0; z < variableArray.length; z++) { | |||||
stringBuffer.append(newLine); | stringBuffer.append(newLine); | ||||
stringBuffer.append("\t"); | stringBuffer.append("\t"); | ||||
stringBuffer.append(variableArray[z]); | stringBuffer.append(variableArray[z]); | ||||
@@ -452,7 +452,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
this.cvsRoot = root; | this.cvsRoot = root; | ||||
} | } | ||||
public String getCvsRoot(){ | |||||
public String getCvsRoot() { | |||||
return this.cvsRoot; | return this.cvsRoot; | ||||
} | } | ||||
@@ -473,7 +473,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
this.cvsRsh = rsh; | this.cvsRsh = rsh; | ||||
} | } | ||||
public String getCvsRsh(){ | |||||
public String getCvsRsh() { | |||||
return this.cvsRsh; | return this.cvsRsh; | ||||
} | } | ||||
@@ -483,11 +483,11 @@ public abstract class AbstractCvsTask extends Task { | |||||
* | * | ||||
* @param port | * @param port | ||||
*/ | */ | ||||
public void setPort(int port){ | |||||
public void setPort(int port) { | |||||
this.port = port; | this.port = port; | ||||
} | } | ||||
public int getPort(){ | |||||
public int getPort() { | |||||
return this.port; | return this.port; | ||||
} | } | ||||
@@ -497,11 +497,11 @@ public abstract class AbstractCvsTask extends Task { | |||||
* | * | ||||
* @param passFile | * @param passFile | ||||
*/ | */ | ||||
public void setPassfile(File passFile){ | |||||
public void setPassfile(File passFile) { | |||||
this.passFile = passFile; | this.passFile = passFile; | ||||
} | } | ||||
public File getPassFile(){ | |||||
public File getPassFile() { | |||||
return this.passFile; | return this.passFile; | ||||
} | } | ||||
@@ -515,7 +515,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
this.dest = dest; | this.dest = dest; | ||||
} | } | ||||
public File getDest(){ | |||||
public File getDest() { | |||||
return this.dest; | return this.dest; | ||||
} | } | ||||
@@ -529,7 +529,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
this.cvsPackage = p; | this.cvsPackage = p; | ||||
} | } | ||||
public String getPackage(){ | |||||
public String getPackage() { | |||||
return this.cvsPackage; | return this.cvsPackage; | ||||
} | } | ||||
@@ -550,11 +550,11 @@ public abstract class AbstractCvsTask extends Task { | |||||
* This needs to be public to allow configuration | * This needs to be public to allow configuration | ||||
* of commands externally. | * of commands externally. | ||||
*/ | */ | ||||
public void addCommandArgument(String arg){ | |||||
public void addCommandArgument(String arg) { | |||||
this.addCommandArgument(cmd, arg); | this.addCommandArgument(cmd, arg); | ||||
} | } | ||||
public void addCommandArgument(Commandline c, String arg){ | |||||
public void addCommandArgument(Commandline c, String arg) { | |||||
c.createArgument().setValue(arg); | c.createArgument().setValue(arg); | ||||
} | } | ||||
@@ -619,7 +619,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
* Whether to append output/error when redirecting to a file. | * Whether to append output/error when redirecting to a file. | ||||
* @param value | * @param value | ||||
*/ | */ | ||||
public void setAppend(boolean value){ | |||||
public void setAppend(boolean value) { | |||||
this.append = value; | this.append = value; | ||||
} | } | ||||
@@ -542,7 +542,7 @@ public class Ant extends Task { | |||||
String value = props.get(key).toString(); | String value = props.get(key).toString(); | ||||
// don't re-set user properties, avoid the warning message | // don't re-set user properties, avoid the warning message | ||||
if (newProject.getProperty(key) == null){ | |||||
if (newProject.getProperty(key) == null) { | |||||
// no user property | // no user property | ||||
newProject.setNewProperty(key, value); | newProject.setNewProperty(key, value); | ||||
} | } | ||||
@@ -106,7 +106,7 @@ public class Exec extends Task { | |||||
// test if os match | // test if os match | ||||
String myos = System.getProperty("os.name"); | String myos = System.getProperty("os.name"); | ||||
log("Myos = " + myos, Project.MSG_VERBOSE); | log("Myos = " + myos, Project.MSG_VERBOSE); | ||||
if ((os != null) && (os.indexOf(myos) < 0)){ | |||||
if ((os != null) && (os.indexOf(myos) < 0)) { | |||||
// this command will be executed only on the specified OS | // this command will be executed only on the specified OS | ||||
log("Not found in " + os, Project.MSG_VERBOSE); | log("Not found in " + os, Project.MSG_VERBOSE); | ||||
return 0; | return 0; | ||||
@@ -359,7 +359,7 @@ public class ExecTask extends Task { | |||||
// test if os match | // test if os match | ||||
String myos = System.getProperty("os.name"); | String myos = System.getProperty("os.name"); | ||||
log("Current OS is " + myos, Project.MSG_VERBOSE); | log("Current OS is " + myos, Project.MSG_VERBOSE); | ||||
if ((os != null) && (os.indexOf(myos) < 0)){ | |||||
if ((os != null) && (os.indexOf(myos) < 0)) { | |||||
// this command will be executed only on the specified OS | // this command will be executed only on the specified OS | ||||
log("This OS, " + myos | log("This OS, " + myos | ||||
+ " was not found in the specified list of valid OSes: " + os, | + " was not found in the specified list of valid OSes: " + os, | ||||
@@ -66,7 +66,7 @@ import org.apache.tools.ant.util.Watchdog; | |||||
* Execute exec = new Execute(myloghandler, watchdog); | * Execute exec = new Execute(myloghandler, watchdog); | ||||
* exec.setCommandLine(mycmdline); | * exec.setCommandLine(mycmdline); | ||||
* int exitvalue = exec.execute(); | * int exitvalue = exec.execute(); | ||||
* if (exitvalue != SUCCESS && watchdog.killedProcess()){ | |||||
* if (exitvalue != SUCCESS && watchdog.killedProcess()) { | |||||
* // it was killed on purpose by the watchdog | * // it was killed on purpose by the watchdog | ||||
* } | * } | ||||
* </pre> | * </pre> | ||||
@@ -156,7 +156,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||||
} catch (IllegalThreadStateException itse) { | } catch (IllegalThreadStateException itse) { | ||||
// the process is not terminated, if this is really | // the process is not terminated, if this is really | ||||
// a timeout and not a manual stop then kill it. | // a timeout and not a manual stop then kill it. | ||||
if (watch){ | |||||
if (watch) { | |||||
killedProcess = true; | killedProcess = true; | ||||
process.destroy(); | process.destroy(); | ||||
} | } | ||||
@@ -196,7 +196,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||||
* @return <tt>true</tt> if the process is still running, otherwise | * @return <tt>true</tt> if the process is still running, otherwise | ||||
* <tt>false</tt>. | * <tt>false</tt>. | ||||
*/ | */ | ||||
public boolean isWatching(){ | |||||
public boolean isWatching() { | |||||
return watch; | return watch; | ||||
} | } | ||||
@@ -205,7 +205,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||||
* @return <tt>true</tt> if the process was killed otherwise | * @return <tt>true</tt> if the process was killed otherwise | ||||
* <tt>false</tt>. | * <tt>false</tt>. | ||||
*/ | */ | ||||
public boolean killedProcess(){ | |||||
public boolean killedProcess() { | |||||
return killedProcess; | return killedProcess; | ||||
} | } | ||||
} | } | ||||
@@ -247,7 +247,7 @@ public class Expand extends Task { | |||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
// create intermediary directories - sometimes zip don't add them | // create intermediary directories - sometimes zip don't add them | ||||
File dirF = fileUtils.getParentFile(f); | File dirF = fileUtils.getParentFile(f); | ||||
if ( dirF != null ) { | |||||
if ( dirF != null) { | |||||
dirF.mkdirs(); | dirF.mkdirs(); | ||||
} | } | ||||
@@ -528,7 +528,7 @@ public class FixCRLF extends MatchingTask { | |||||
// Handle CTRLZ | // Handle CTRLZ | ||||
if (ctrlz == ASIS) { | if (ctrlz == ASIS) { | ||||
outWriter.write(lines.getEofStr()); | outWriter.write(lines.getEofStr()); | ||||
} else if (ctrlz == ADD){ | |||||
} else if (ctrlz == ADD) { | |||||
outWriter.write(CTRLZ); | outWriter.write(CTRLZ); | ||||
} | } | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
@@ -179,7 +179,7 @@ public class Get extends Task { | |||||
if (httpConnection.getResponseCode() | if (httpConnection.getResponseCode() | ||||
== HttpURLConnection.HTTP_UNAUTHORIZED) { | == HttpURLConnection.HTTP_UNAUTHORIZED) { | ||||
String message="HTTP Authorization failure"; | String message="HTTP Authorization failure"; | ||||
if(ignoreErrors) { | |||||
if (ignoreErrors) { | |||||
log(message,Project.MSG_WARN); | log(message,Project.MSG_WARN); | ||||
return; | return; | ||||
} else { | } else { | ||||
@@ -90,7 +90,7 @@ public class SQLExampleTask extends JDBCTask { | |||||
Connection conn = getConnection(); | Connection conn = getConnection(); | ||||
Statement stmt=null; | Statement stmt=null; | ||||
try { | try { | ||||
if (tableName == null ) { | |||||
if (tableName == null) { | |||||
throw new BuildException("TableName must be specified",location); | throw new BuildException("TableName must be specified",location); | ||||
} | } | ||||
String sql = "SELECT * FROM "+tableName; | String sql = "SELECT * FROM "+tableName; | ||||
@@ -103,10 +103,10 @@ public class SQLExampleTask extends JDBCTask { | |||||
} finally { | } finally { | ||||
if (stmt != null) { | if (stmt != null) { | ||||
try {stmt.close();}catch (SQLException ingore){} | |||||
try {stmt.close();}catch (SQLException ingore) {} | |||||
} | } | ||||
if (conn != null) { | if (conn != null) { | ||||
try {conn.close();}catch (SQLException ingore){} | |||||
try {conn.close();}catch (SQLException ingore) {} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -184,7 +184,7 @@ public class Jar extends Zip { | |||||
* Set whether or not to create an index list for classes. | * Set whether or not to create an index list for classes. | ||||
* This may speed up classloading in some cases. | * This may speed up classloading in some cases. | ||||
*/ | */ | ||||
public void setIndex(boolean flag){ | |||||
public void setIndex(boolean flag) { | |||||
index = flag; | index = flag; | ||||
} | } | ||||
@@ -456,7 +456,7 @@ public class Jar extends Zip { | |||||
// @fixme do we need to check for directories starting by ./ ? | // @fixme do we need to check for directories starting by ./ ? | ||||
dir = dir.replace('\\', '/'); | dir = dir.replace('\\', '/'); | ||||
int pos = dir.lastIndexOf('/'); | int pos = dir.lastIndexOf('/'); | ||||
if (pos != -1){ | |||||
if (pos != -1) { | |||||
dir = dir.substring(0, pos); | dir = dir.substring(0, pos); | ||||
} | } | ||||
@@ -127,7 +127,7 @@ public class Java extends Task { | |||||
throw new BuildException("Classname must not be null."); | throw new BuildException("Classname must not be null."); | ||||
} | } | ||||
if (!fork && cmdl.getJar() != null){ | |||||
if (!fork && cmdl.getJar() != null) { | |||||
throw new BuildException("Cannot execute a jar in non-forked mode." | throw new BuildException("Cannot execute a jar in non-forked mode." | ||||
+ " Please set fork='true'. "); | + " Please set fork='true'. "); | ||||
} | } | ||||
@@ -221,7 +221,7 @@ public class Java extends Task { | |||||
* The location of the JAR file to execute. | * The location of the JAR file to execute. | ||||
*/ | */ | ||||
public void setJar(File jarfile) throws BuildException { | public void setJar(File jarfile) throws BuildException { | ||||
if (cmdl.getClassname() != null){ | |||||
if (cmdl.getClassname() != null) { | |||||
throw new BuildException("Cannot use 'jar' and 'classname' " | throw new BuildException("Cannot use 'jar' and 'classname' " | ||||
+ "attributes in same command."); | + "attributes in same command."); | ||||
} | } | ||||
@@ -232,7 +232,7 @@ public class Java extends Task { | |||||
* Sets the Java class to execute. | * Sets the Java class to execute. | ||||
*/ | */ | ||||
public void setClassname(String s) throws BuildException { | public void setClassname(String s) throws BuildException { | ||||
if (cmdl.getJar() != null){ | |||||
if (cmdl.getJar() != null) { | |||||
throw new BuildException("Cannot use 'jar' and 'classname' " | throw new BuildException("Cannot use 'jar' and 'classname' " | ||||
+ "attributes in same command"); | + "attributes in same command"); | ||||
} | } | ||||
@@ -403,7 +403,7 @@ public class Java extends Task { | |||||
/** | /** | ||||
* Corresponds to -mx or -Xmx depending on VM version. | * Corresponds to -mx or -Xmx depending on VM version. | ||||
*/ | */ | ||||
public void setMaxmemory(String max){ | |||||
public void setMaxmemory(String max) { | |||||
cmdl.setMaxmemory(max); | cmdl.setMaxmemory(max); | ||||
} | } | ||||
@@ -512,7 +512,7 @@ public class Javadoc extends Task { | |||||
* @param max a string indicating the maximum memory according to the | * @param max a string indicating the maximum memory according to the | ||||
* JVM conventions (e.g. 128m is 128 Megabytes) | * JVM conventions (e.g. 128m is 128 Megabytes) | ||||
*/ | */ | ||||
public void setMaxmemory(String max){ | |||||
public void setMaxmemory(String max) { | |||||
if (javadoc1) { | if (javadoc1) { | ||||
cmd.createArgument().setValue("-J-mx" + max); | cmd.createArgument().setValue("-J-mx" + max); | ||||
} else { | } else { | ||||
@@ -525,7 +525,7 @@ public class Javadoc extends Task { | |||||
* | * | ||||
* @param add the additional command line parameter for the javadoc task. | * @param add the additional command line parameter for the javadoc task. | ||||
*/ | */ | ||||
public void setAdditionalparam(String add){ | |||||
public void setAdditionalparam(String add) { | |||||
cmd.createArgument().setLine(add); | cmd.createArgument().setLine(add); | ||||
} | } | ||||
@@ -168,7 +168,7 @@ public final class LoadProperties extends Task { | |||||
} | } | ||||
ByteArrayInputStream tis = null; | ByteArrayInputStream tis = null; | ||||
if ( encoding == null ) { | |||||
if ( encoding == null) { | |||||
tis = new ByteArrayInputStream(text.getBytes()); | tis = new ByteArrayInputStream(text.getBytes()); | ||||
} else { | } else { | ||||
tis = new ByteArrayInputStream(text.getBytes(encoding)); | tis = new ByteArrayInputStream(text.getBytes(encoding)); | ||||
@@ -177,7 +177,7 @@ public class LogOutputStream extends OutputStream { | |||||
if (blockLength > 0) { | if (blockLength > 0) { | ||||
buffer.write(b, blockStartOffset, blockLength); | buffer.write(b, blockStartOffset, blockLength); | ||||
} | } | ||||
while(remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) { | |||||
while (remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d)) { | |||||
write(b[offset]); | write(b[offset]); | ||||
offset++; | offset++; | ||||
remaining--; | remaining--; | ||||
@@ -419,12 +419,12 @@ public class PathConvert extends Task { | |||||
// Place the result into the specified property, | // Place the result into the specified property, | ||||
// unless setonempty == false | // unless setonempty == false | ||||
String value = rslt.toString(); | String value = rslt.toString(); | ||||
if(setonempty) { | |||||
if (setonempty) { | |||||
log("Set property " + property + " = " + value, | log("Set property " + property + " = " + value, | ||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
getProject().setNewProperty(property, value); | getProject().setNewProperty(property, value); | ||||
} else { | } else { | ||||
if(rslt.length() > 0) { | |||||
if (rslt.length() > 0) { | |||||
log("Set property " + property + " = " + value, | log("Set property " + property + " = " + value, | ||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
getProject().setNewProperty(property, value); | getProject().setNewProperty(property, value); | ||||
@@ -263,7 +263,7 @@ public class Replace extends MatchingTask { | |||||
if (replaceFilterFile != null) { | if (replaceFilterFile != null) { | ||||
Properties props = getProperties(replaceFilterFile); | Properties props = getProperties(replaceFilterFile); | ||||
Enumeration enum = props.keys(); | Enumeration enum = props.keys(); | ||||
while (enum.hasMoreElements()){ | |||||
while (enum.hasMoreElements()) { | |||||
String token = enum.nextElement().toString(); | String token = enum.nextElement().toString(); | ||||
Replacefilter replaceFilter = createReplacefilter(); | Replacefilter replaceFilter = createReplacefilter(); | ||||
replaceFilter.setToken(token); | replaceFilter.setToken(token); | ||||
@@ -420,14 +420,14 @@ public class SQLExec extends JDBCTask { | |||||
out.close(); | out.close(); | ||||
} | } | ||||
} | } | ||||
} catch (IOException e){ | |||||
} catch (IOException e) { | |||||
if (!isAutocommit() && conn != null && onError.equals("abort")) { | if (!isAutocommit() && conn != null && onError.equals("abort")) { | ||||
try { | try { | ||||
conn.rollback(); | conn.rollback(); | ||||
} catch (SQLException ex) {} | } catch (SQLException ex) {} | ||||
} | } | ||||
throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
} catch (SQLException e){ | |||||
} catch (SQLException e) { | |||||
if (!isAutocommit() && conn != null && onError.equals("abort")) { | if (!isAutocommit() && conn != null && onError.equals("abort")) { | ||||
try { | try { | ||||
conn.rollback(); | conn.rollback(); | ||||
@@ -463,7 +463,7 @@ public class SQLExec extends JDBCTask { | |||||
BufferedReader in = new BufferedReader(reader); | BufferedReader in = new BufferedReader(reader); | ||||
while ((line = in.readLine()) != null){ | |||||
while ((line = in.readLine()) != null) { | |||||
if (!keepformat) { | if (!keepformat) { | ||||
line = line.trim(); | line = line.trim(); | ||||
} | } | ||||
@@ -509,7 +509,7 @@ public class SQLExec extends JDBCTask { | |||||
} | } | ||||
} | } | ||||
// Catch any statements not followed by ; | // Catch any statements not followed by ; | ||||
if (!sql.equals("")){ | |||||
if (!sql.equals("")) { | |||||
execSQL(sql.toString(), out); | execSQL(sql.toString(), out); | ||||
} | } | ||||
} | } | ||||
@@ -535,19 +535,13 @@ public class SQLExec extends JDBCTask { | |||||
ret = statement.execute(sql); | ret = statement.execute(sql); | ||||
updateCount = statement.getUpdateCount(); | updateCount = statement.getUpdateCount(); | ||||
resultSet = statement.getResultSet(); | resultSet = statement.getResultSet(); | ||||
do | |||||
{ | |||||
if (!ret) | |||||
{ | |||||
if (updateCount != -1) | |||||
{ | |||||
do { | |||||
if (!ret) { | |||||
if (updateCount != -1) { | |||||
updateCountTotal += updateCount; | updateCountTotal += updateCount; | ||||
} | } | ||||
} | |||||
else | |||||
{ | |||||
if (print) | |||||
{ | |||||
} else { | |||||
if (print) { | |||||
printResults(out); | printResults(out); | ||||
} | } | ||||
} | } | ||||
@@ -559,15 +553,14 @@ public class SQLExec extends JDBCTask { | |||||
log(updateCountTotal + " rows affected", | log(updateCountTotal + " rows affected", | ||||
Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
if (print) | |||||
{ | |||||
if (print) { | |||||
StringBuffer line = new StringBuffer(); | StringBuffer line = new StringBuffer(); | ||||
line.append(updateCountTotal + " rows affected"); | line.append(updateCountTotal + " rows affected"); | ||||
out.println(line); | out.println(line); | ||||
} | } | ||||
SQLWarning warning = conn.getWarnings(); | SQLWarning warning = conn.getWarnings(); | ||||
while (warning != null){ | |||||
while (warning != null) { | |||||
log(warning + " sql warning", Project.MSG_VERBOSE); | log(warning + " sql warning", Project.MSG_VERBOSE); | ||||
warning = warning.getNextWarning(); | warning = warning.getNextWarning(); | ||||
} | } | ||||
@@ -64,8 +64,7 @@ import org.apache.tools.ant.TaskContainer; | |||||
/** | /** | ||||
* Sequential is a container task - it can contain other Ant tasks. The nested | * Sequential is a container task - it can contain other Ant tasks. The nested | ||||
* tasks are simply executed in sequence. Sequential's primary use is to support | * tasks are simply executed in sequence. Sequential's primary use is to support | ||||
* the sequential execution of a subset of tasks within the | |||||
{@link Parallel Parallel Task} | |||||
* the sequential execution of a subset of tasks within the {@link Parallel Parallel Task} | |||||
* <p> | * <p> | ||||
* The sequential task has no attributes and does not support any nested | * The sequential task has no attributes and does not support any nested | ||||
@@ -227,7 +227,7 @@ public class Tstamp extends Task { | |||||
* @param id | * @param id | ||||
* @see java.util.TimeZone | * @see java.util.TimeZone | ||||
*/ | */ | ||||
public void setTimezone(String id){ | |||||
public void setTimezone(String id) { | |||||
timeZone = TimeZone.getTimeZone(id); | timeZone = TimeZone.getTimeZone(id); | ||||
} | } | ||||
@@ -308,7 +308,7 @@ public class Tstamp extends Task { | |||||
calendar.add(field, offset); | calendar.add(field, offset); | ||||
date = calendar.getTime(); | date = calendar.getTime(); | ||||
} | } | ||||
if (timeZone != null){ | |||||
if (timeZone != null) { | |||||
sdf.setTimeZone(timeZone); | sdf.setTimeZone(timeZone); | ||||
} | } | ||||
Tstamp.this.setProperty(propertyName, sdf.format(date)); | Tstamp.this.setProperty(propertyName, sdf.format(date)); | ||||
@@ -121,15 +121,15 @@ public class WhichResource extends Task { | |||||
*/ | */ | ||||
private void validate() { | private void validate() { | ||||
int setcount=0; | int setcount=0; | ||||
if(classname != null) { | |||||
if (classname != null) { | |||||
setcount++; | setcount++; | ||||
} | } | ||||
if(resource!=null) { | |||||
if (resource!=null) { | |||||
setcount++; | setcount++; | ||||
} | } | ||||
if(setcount == 0) { | |||||
if (setcount == 0) { | |||||
throw new BuildException( | throw new BuildException( | ||||
"One of classname or resource must be specified"); | "One of classname or resource must be specified"); | ||||
} | } | ||||
@@ -137,7 +137,7 @@ public class WhichResource extends Task { | |||||
throw new BuildException( | throw new BuildException( | ||||
"Only one of classname or resource can be specified"); | "Only one of classname or resource can be specified"); | ||||
} | } | ||||
if(property==null) { | |||||
if (property==null) { | |||||
throw new BuildException("No property defined"); | throw new BuildException("No property defined"); | ||||
} | } | ||||
} | } | ||||
@@ -162,19 +162,19 @@ public class WhichResource extends Task { | |||||
getProject(), | getProject(), | ||||
classpath, false); | classpath, false); | ||||
String location=null; | String location=null; | ||||
if(classname!=null) { | |||||
if (classname!=null) { | |||||
//convert a class name into a resource | //convert a class name into a resource | ||||
classname= classname.replace('.', '/'); | classname= classname.replace('.', '/'); | ||||
resource="/"+ classname +".class"; | resource="/"+ classname +".class"; | ||||
} else { | } else { | ||||
if(!resource.startsWith("/")) { | |||||
if (!resource.startsWith("/")) { | |||||
resource="/"+resource; | resource="/"+resource; | ||||
} | } | ||||
} | } | ||||
log("Searching for "+resource,Project.MSG_VERBOSE); | log("Searching for "+resource,Project.MSG_VERBOSE); | ||||
URL url; | URL url; | ||||
url=loader.getResource(resource); | url=loader.getResource(resource); | ||||
if(url!=null) { | |||||
if (url!=null) { | |||||
//set the property | //set the property | ||||
location = url.toExternalForm(); | location = url.toExternalForm(); | ||||
getProject().setNewProperty(property,location); | getProject().setNewProperty(property,location); | ||||
@@ -266,7 +266,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
if (performDirectoryScan) { | if (performDirectoryScan) { | ||||
// Process all the directories marked for styling | // Process all the directories marked for styling | ||||
dirs = scanner.getIncludedDirectories(); | dirs = scanner.getIncludedDirectories(); | ||||
for (int j = 0; j < dirs.length; ++j){ | |||||
for (int j = 0; j < dirs.length; ++j) { | |||||
list = new File(baseDir, dirs[j]).list(); | list = new File(baseDir, dirs[j]).list(); | ||||
for (int i = 0; i < list.length; ++i) { | for (int i = 0; i < list.length; ++i) { | ||||
process(baseDir, list[i], destDir, stylesheet); | process(baseDir, list[i], destDir, stylesheet); | ||||
@@ -432,7 +432,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* | * | ||||
* @param outFile the output File instance. | * @param outFile the output File instance. | ||||
*/ | */ | ||||
public void setOut(File outFile){ | |||||
public void setOut(File outFile) { | |||||
this.outFile = outFile; | this.outFile = outFile; | ||||
} | } | ||||
@@ -442,7 +442,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* | * | ||||
* @param inFile the input file | * @param inFile the input file | ||||
*/ | */ | ||||
public void setIn(File inFile){ | |||||
public void setIn(File inFile) { | |||||
this.inFile = inFile; | this.inFile = inFile; | ||||
} | } | ||||
@@ -618,7 +618,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* | * | ||||
* @param name the name of the parameter. | * @param name the name of the parameter. | ||||
*/ | */ | ||||
public void setName(String name){ | |||||
public void setName(String name) { | |||||
this.name = name; | this.name = name; | ||||
} | } | ||||
@@ -628,7 +628,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* @param expression the XSL expression representing the | * @param expression the XSL expression representing the | ||||
* parameter's value. | * parameter's value. | ||||
*/ | */ | ||||
public void setExpression(String expression){ | |||||
public void setExpression(String expression) { | |||||
this.expression = expression; | this.expression = expression; | ||||
} | } | ||||
@@ -759,7 +759,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
* like the exact copy of JAXP interface.. | * like the exact copy of JAXP interface.. | ||||
* @param liaison the TRaXLiaison to configure. | * @param liaison the TRaXLiaison to configure. | ||||
*/ | */ | ||||
protected void configureTraXLiaison(TraXLiaison liaison){ | |||||
protected void configureTraXLiaison(TraXLiaison liaison) { | |||||
if (factory != null) { | if (factory != null) { | ||||
liaison.setFactory(factory.getName()); | liaison.setFactory(factory.getName()); | ||||
@@ -887,7 +887,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
// a value must be of a given type | // a value must be of a given type | ||||
// say boolean|integer|string that are mostly used. | // say boolean|integer|string that are mostly used. | ||||
if ("true".equalsIgnoreCase(value) | if ("true".equalsIgnoreCase(value) | ||||
|| "false".equalsIgnoreCase(value) ){ | |||||
|| "false".equalsIgnoreCase(value) ) { | |||||
this.value = new Boolean(value); | this.value = new Boolean(value); | ||||
} else { | } else { | ||||
try { | try { | ||||
@@ -262,11 +262,11 @@ class ChangeLogParser { | |||||
return null; | return null; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* reset all internal attributes except status. | * reset all internal attributes except status. | ||||
*/ | */ | ||||
private void reset(){ | |||||
private void reset() { | |||||
m_file = null; | m_file = null; | ||||
m_date = null; | m_date = null; | ||||
m_author = null; | m_author = null; | ||||
@@ -103,8 +103,7 @@ public class EmailTask | |||||
* @return a list of valid entries | * @return a list of valid entries | ||||
*/ | */ | ||||
public String[] getValues() { | public String[] getValues() { | ||||
return new String[] | |||||
{AUTO, MIME, UU, PLAIN}; | |||||
return new String[] {AUTO, MIME, UU, PLAIN}; | |||||
} | } | ||||
} | } | ||||
@@ -605,7 +604,7 @@ public class EmailTask | |||||
throw e; | throw e; | ||||
} | } | ||||
} | } | ||||
catch(Exception e){ | |||||
catch (Exception e) { | |||||
log("Failed to send email", Project.MSG_WARN); | log("Failed to send email", Project.MSG_WARN); | ||||
if (failOnError) { | if (failOnError) { | ||||
throw new BuildException(e); | throw new BuildException(e); | ||||
@@ -273,7 +273,7 @@ public class EchoProperties extends Task { | |||||
Properties props = new Properties(); | Properties props = new Properties(); | ||||
props.load(in); | props.load(in); | ||||
CollectionUtils.putAll(allProps, props); | CollectionUtils.putAll(allProps, props); | ||||
} catch(FileNotFoundException fnfe) { | |||||
} catch (FileNotFoundException fnfe) { | |||||
String message = | String message = | ||||
"Could not find file " + inFile.getAbsolutePath(); | "Could not find file " + inFile.getAbsolutePath(); | ||||
if (failonerror) { | if (failonerror) { | ||||
@@ -282,7 +282,7 @@ public class EchoProperties extends Task { | |||||
log(message, Project.MSG_WARN); | log(message, Project.MSG_WARN); | ||||
} | } | ||||
return; | return; | ||||
} catch(IOException ioe) { | |||||
} catch (IOException ioe) { | |||||
String message = | String message = | ||||
"Could not read file " + inFile.getAbsolutePath(); | "Could not read file " + inFile.getAbsolutePath(); | ||||
if (failonerror) { | if (failonerror) { | ||||
@@ -293,10 +293,10 @@ public class EchoProperties extends Task { | |||||
return; | return; | ||||
} finally { | } finally { | ||||
try { | try { | ||||
if(null != in) { | |||||
if (null != in) { | |||||
in.close(); | in.close(); | ||||
} | } | ||||
} catch(IOException ioe) {} | |||||
} catch (IOException ioe) {} | |||||
} | } | ||||
} | } | ||||
@@ -389,7 +389,7 @@ public class EchoProperties extends Task { | |||||
// output properties | // output properties | ||||
String name; | String name; | ||||
Enumeration e = props.propertyNames(); | Enumeration e = props.propertyNames(); | ||||
while(e.hasMoreElements()) { | |||||
while (e.hasMoreElements()) { | |||||
name = (String)e.nextElement(); | name = (String)e.nextElement(); | ||||
Element propElement = doc.createElement(PROPERTY); | Element propElement = doc.createElement(PROPERTY); | ||||
propElement.setAttribute(ATTR_NAME, name); | propElement.setAttribute(ATTR_NAME, name); | ||||
@@ -403,10 +403,10 @@ public class EchoProperties extends Task { | |||||
wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); | wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); | ||||
(new DOMElementWriter()).write(rootElement, wri, 0, "\t"); | (new DOMElementWriter()).write(rootElement, wri, 0, "\t"); | ||||
wri.flush(); | wri.flush(); | ||||
} catch(IOException ioe) { | |||||
} catch (IOException ioe) { | |||||
throw new BuildException("Unable to write XML file", ioe); | throw new BuildException("Unable to write XML file", ioe); | ||||
} finally { | } finally { | ||||
if(wri != null) { | |||||
if (wri != null) { | |||||
wri.close(); | wri.close(); | ||||
} | } | ||||
} | } | ||||
@@ -476,7 +476,7 @@ public class EchoProperties extends Task { | |||||
private static DocumentBuilder getDocumentBuilder() { | private static DocumentBuilder getDocumentBuilder() { | ||||
try { | try { | ||||
return DocumentBuilderFactory.newInstance().newDocumentBuilder(); | return DocumentBuilderFactory.newInstance().newDocumentBuilder(); | ||||
} catch(Exception e) { | |||||
} catch (Exception e) { | |||||
throw new ExceptionInInitializerError(e); | throw new ExceptionInInitializerError(e); | ||||
} | } | ||||
} | } | ||||
@@ -344,7 +344,7 @@ public class Javah extends Task { | |||||
try { | try { | ||||
// first search for the "old" javah class in 1.4.2 tools.jar | // first search for the "old" javah class in 1.4.2 tools.jar | ||||
javahMainClass = Class.forName("com.sun.tools.javah.oldjavah.Main"); | javahMainClass = Class.forName("com.sun.tools.javah.oldjavah.Main"); | ||||
} catch(ClassNotFoundException cnfe) { | |||||
} catch (ClassNotFoundException cnfe) { | |||||
// assume older than 1.4.2 tools.jar | // assume older than 1.4.2 tools.jar | ||||
javahMainClass = Class.forName("com.sun.tools.javah.Main"); | javahMainClass = Class.forName("com.sun.tools.javah.Main"); | ||||
} | } | ||||
@@ -371,8 +371,7 @@ public class ReplaceRegExp extends Task { | |||||
// first CR in this line | // first CR in this line | ||||
hasCR = true; | hasCR = true; | ||||
} | } | ||||
} | |||||
else if (c == '\n') { | |||||
} else if (c == '\n') { | |||||
// LF -> EOL | // LF -> EOL | ||||
line = linebuf.toString(); | line = linebuf.toString(); | ||||
res = doReplace(regex, subs, line, options); | res = doReplace(regex, subs, line, options); | ||||
@@ -74,7 +74,7 @@ public class CCMCheck extends Continuus { | |||||
private File file = null; | private File file = null; | ||||
private String comment = null; | private String comment = null; | ||||
private String task = null; | private String task = null; | ||||
protected Vector filesets = new Vector(); | protected Vector filesets = new Vector(); | ||||
public CCMCheck() { | public CCMCheck() { | ||||
@@ -158,16 +158,16 @@ public class CCMCheck extends Continuus { | |||||
if (file != null && file.exists() && file.isDirectory()) { | if (file != null && file.exists() && file.isDirectory()) { | ||||
throw new BuildException("CCMCheck cannot be generated for directories"); | throw new BuildException("CCMCheck cannot be generated for directories"); | ||||
} | } | ||||
if (file != null && filesets.size() > 0) { | if (file != null && filesets.size() > 0) { | ||||
throw new BuildException("Choose between file and fileset !"); | throw new BuildException("Choose between file and fileset !"); | ||||
} | } | ||||
if ( getFile() !=null ) { | |||||
if ( getFile() !=null) { | |||||
doit(); | doit(); | ||||
return ; | return ; | ||||
} | } | ||||
int sizeofFileSet = filesets.size(); | int sizeofFileSet = filesets.size(); | ||||
for (int i = 0; i < sizeofFileSet; i++) { | for (int i = 0; i < sizeofFileSet; i++) { | ||||
FileSet fs = (FileSet) filesets.elementAt(i); | FileSet fs = (FileSet) filesets.elementAt(i); | ||||
@@ -180,12 +180,11 @@ public class CCMCheck extends Continuus { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* check the file given by getFile(). | * check the file given by getFile(). | ||||
*/ | */ | ||||
private void doit() | |||||
{ | |||||
private void doit() { | |||||
Commandline commandLine = new Commandline(); | Commandline commandLine = new Commandline(); | ||||
// build the command line from what we got the format is | // build the command line from what we got the format is | ||||
@@ -194,9 +193,9 @@ public class CCMCheck extends Continuus { | |||||
commandLine.setExecutable(getCcmCommand()); | commandLine.setExecutable(getCcmCommand()); | ||||
commandLine.createArgument().setValue(getCcmAction()); | commandLine.createArgument().setValue(getCcmAction()); | ||||
checkOptions(commandLine); | checkOptions(commandLine); | ||||
int result = run(commandLine); | int result = run(commandLine); | ||||
if (result != 0) { | if (result != 0) { | ||||
String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
@@ -217,11 +216,11 @@ public class CCMCheck extends Continuus { | |||||
if (getTask() != null) { | if (getTask() != null) { | ||||
cmd.createArgument().setValue(FLAG_TASK); | cmd.createArgument().setValue(FLAG_TASK); | ||||
cmd.createArgument().setValue(getTask()); | cmd.createArgument().setValue(getTask()); | ||||
} | |||||
} | |||||
if (getFile() != null) { | if (getFile() != null) { | ||||
cmd.createArgument().setValue(file.getAbsolutePath()); | cmd.createArgument().setValue(file.getAbsolutePath()); | ||||
} | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -150,7 +150,7 @@ public class CCMklabel extends ClearCase { | |||||
checkOptions(commandLine); | checkOptions(commandLine); | ||||
result = run(commandLine); | result = run(commandLine); | ||||
if ( result != 0 ) { | |||||
if ( result != 0) { | |||||
String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
} | } | ||||
@@ -152,7 +152,7 @@ public class CCMklbtype extends ClearCase { | |||||
checkOptions(commandLine); | checkOptions(commandLine); | ||||
result = run(commandLine); | result = run(commandLine); | ||||
if ( result != 0 ) { | |||||
if ( result != 0) { | |||||
String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
} | } | ||||
@@ -150,7 +150,7 @@ public class CCRmtype extends ClearCase { | |||||
checkOptions(commandLine); | checkOptions(commandLine); | ||||
result = run(commandLine); | result = run(commandLine); | ||||
if ( result != 0 ) { | |||||
if ( result != 0) { | |||||
String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
} | } | ||||
@@ -392,7 +392,7 @@ public class CSharp extends DotnetCompile { | |||||
protected String getDefinitionsParameter() { | protected String getDefinitionsParameter() { | ||||
String predecessors=super.getDefinitionsParameter(); | String predecessors=super.getDefinitionsParameter(); | ||||
if (notEmpty(definitions)) { | if (notEmpty(definitions)) { | ||||
if(predecessors==null) { | |||||
if (predecessors==null) { | |||||
predecessors= "/define:"; | predecessors= "/define:"; | ||||
} | } | ||||
return predecessors+ definitions; | return predecessors+ definitions; | ||||
@@ -134,7 +134,7 @@ public class DotnetBaseMatchingTask extends MatchingTask { | |||||
protected int buildFileList(NetCommand command, Hashtable filesToBuild, long outputTimestamp) { | protected int buildFileList(NetCommand command, Hashtable filesToBuild, long outputTimestamp) { | ||||
int filesOutOfDate=0; | int filesOutOfDate=0; | ||||
boolean scanImplicitFileset=getSrcDir()!=null || filesets.size()==0; | boolean scanImplicitFileset=getSrcDir()!=null || filesets.size()==0; | ||||
if(scanImplicitFileset) { | |||||
if (scanImplicitFileset) { | |||||
//scan for an implicit fileset if there was a srcdir set | //scan for an implicit fileset if there was a srcdir set | ||||
//or there was no srcDir set but the @ | //or there was no srcDir set but the @ | ||||
if (getSrcDir() == null) { | if (getSrcDir() == null) { | ||||
@@ -168,8 +168,7 @@ public abstract class DotnetCompile | |||||
* need to reference mscorlib.dll, cos it is always there | * need to reference mscorlib.dll, cos it is always there | ||||
*/ | */ | ||||
protected static final String[] DEFAULT_REFERENCE_LIST_DOTNET_10 = | |||||
{"Accessibility.dll", | |||||
protected static final String[] DEFAULT_REFERENCE_LIST_DOTNET_10 = {"Accessibility.dll", | |||||
"cscompmgd.dll", | "cscompmgd.dll", | ||||
"CustomMarshalers.dll", | "CustomMarshalers.dll", | ||||
"Mscorcfg.dll", | "Mscorcfg.dll", | ||||
@@ -712,13 +711,13 @@ public abstract class DotnetCompile | |||||
while (defEnum.hasMoreElements()) { | while (defEnum.hasMoreElements()) { | ||||
//loop through all definitions | //loop through all definitions | ||||
DotnetDefine define = (DotnetDefine) defEnum.nextElement(); | DotnetDefine define = (DotnetDefine) defEnum.nextElement(); | ||||
if(define.isSet(this)) { | |||||
if (define.isSet(this)) { | |||||
//add those that are set, and a delimiter | //add those that are set, and a delimiter | ||||
defines.append(define.getValue(this)); | defines.append(define.getValue(this)); | ||||
defines.append(getDefinitionsDelimiter()); | defines.append(getDefinitionsDelimiter()); | ||||
} | } | ||||
} | } | ||||
if(defines.length()==0) { | |||||
if (defines.length()==0) { | |||||
return null; | return null; | ||||
} else { | } else { | ||||
return "/D:"+defines; | return "/D:"+defines; | ||||
@@ -937,7 +936,7 @@ public abstract class DotnetCompile | |||||
outputTimestamp); | outputTimestamp); | ||||
} | } | ||||
//bail out early if there were no files | //bail out early if there were no files | ||||
if(filesToBuild.size()==0) { | |||||
if (filesToBuild.size()==0) { | |||||
return 0; | return 0; | ||||
} | } | ||||
StringBuffer referenceList= new StringBuffer(REFERENCE_OPTION); | StringBuffer referenceList= new StringBuffer(REFERENCE_OPTION); | ||||
@@ -945,7 +944,7 @@ public abstract class DotnetCompile | |||||
Enumeration files = filesToBuild.elements(); | Enumeration files = filesToBuild.elements(); | ||||
while (files.hasMoreElements()) { | while (files.hasMoreElements()) { | ||||
File file = (File) files.nextElement(); | File file = (File) files.nextElement(); | ||||
if(isFileManagedBinary(file)) { | |||||
if (isFileManagedBinary(file)) { | |||||
referenceList.append(file.toString()); | referenceList.append(file.toString()); | ||||
referenceList.append(getReferenceDelimiter()); | referenceList.append(getReferenceDelimiter()); | ||||
} else { | } else { | ||||
@@ -106,11 +106,11 @@ public class DotnetDefine { | |||||
* @throws BuildException | * @throws BuildException | ||||
*/ | */ | ||||
public String getValue(Task owner) throws BuildException { | public String getValue(Task owner) throws BuildException { | ||||
if(name==null) { | |||||
if (name==null) { | |||||
throw new BuildException("No name provided for the define element", | throw new BuildException("No name provided for the define element", | ||||
owner.getLocation()); | owner.getLocation()); | ||||
} | } | ||||
if(!isSet(owner)) { | |||||
if (!isSet(owner)) { | |||||
return null; | return null; | ||||
} | } | ||||
return name; | return name; | ||||
@@ -170,7 +170,7 @@ public class ImportTypelib extends Task { | |||||
throw new BuildException( | throw new BuildException( | ||||
"source file is a directory"); | "source file is a directory"); | ||||
} | } | ||||
if(namespace==null) { | |||||
if (namespace==null) { | |||||
throw new BuildException("No namespace"); | throw new BuildException("No namespace"); | ||||
} | } | ||||
} | } | ||||
@@ -364,7 +364,7 @@ public class VisualBasicCompile extends DotnetCompile { | |||||
protected void validate() | protected void validate() | ||||
throws BuildException { | throws BuildException { | ||||
super.validate(); | super.validate(); | ||||
if(getDestFile()==null) { | |||||
if (getDestFile()==null) { | |||||
throw new BuildException("DestFile was not specified"); | throw new BuildException("DestFile was not specified"); | ||||
} | } | ||||
} | } | ||||
@@ -239,7 +239,7 @@ public class WsdlToDotnet extends Task { | |||||
//set source and rebuild options | //set source and rebuild options | ||||
boolean rebuild = true; | boolean rebuild = true; | ||||
if(srcFile!=null) { | |||||
if (srcFile!=null) { | |||||
command.addArgument(srcFile.toString()); | command.addArgument(srcFile.toString()); | ||||
//rebuild unless the dest file is newer than the source file | //rebuild unless the dest file is newer than the source file | ||||
if (srcFile.exists() && destFile.exists() && | if (srcFile.exists() && destFile.exists() && | ||||
@@ -106,8 +106,7 @@ import org.apache.tools.ant.types.Path; | |||||
* @author <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a> | * @author <a href="mailto:benoit.moussaud@criltelecom.com">Benoit Moussaud</a> | ||||
* | * | ||||
*/ | */ | ||||
public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler | |||||
{ | |||||
public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler { | |||||
public static final String PUBLICID_BORLAND_EJB | public static final String PUBLICID_BORLAND_EJB | ||||
= "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; | = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; | ||||
@@ -295,7 +294,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
verifyBorlandJarV4(sourceJar); | verifyBorlandJarV4(sourceJar); | ||||
return ; | return ; | ||||
} | } | ||||
if ( version == BES ) { | |||||
if ( version == BES) { | |||||
verifyBorlandJarV5(sourceJar); | verifyBorlandJarV5(sourceJar); | ||||
return; | return; | ||||
} | } | ||||
@@ -246,7 +246,7 @@ public class BorlandGenerateClient extends Task { | |||||
if ( version == BorlandDeploymentTool.BAS) { | if ( version == BorlandDeploymentTool.BAS) { | ||||
executeForkV4(); | executeForkV4(); | ||||
} | } | ||||
if ( version == BorlandDeploymentTool.BES ) { | |||||
if ( version == BorlandDeploymentTool.BES) { | |||||
executeForkV5(); | executeForkV5(); | ||||
} | } | ||||
} | } | ||||
@@ -505,7 +505,7 @@ public class EjbJar extends MatchingTask { | |||||
* Initially, only the JBoss implementation does something specific for CMP 2.0.<br/> | * Initially, only the JBoss implementation does something specific for CMP 2.0.<br/> | ||||
* @since ant 1.6 | * @since ant 1.6 | ||||
*/ | */ | ||||
public void setCmpversion( CMPVersion version ) { | |||||
public void setCmpversion( CMPVersion version) { | |||||
this.cmpVersion = version.getValue(); | this.cmpVersion = version.getValue(); | ||||
} | } | ||||
@@ -97,7 +97,7 @@ public class JbossDeploymentTool extends GenericDeploymentTool { | |||||
return; | return; | ||||
} | } | ||||
String descriptorFileName = JBOSS_CMP10D; | String descriptorFileName = JBOSS_CMP10D; | ||||
if ( EjbJar.CMPVersion.CMP2_0.equals( getParent().getCmpversion() ) ) { | |||||
if ( EjbJar.CMPVersion.CMP2_0.equals( getParent().getCmpversion() )) { | |||||
descriptorFileName = JBOSS_CMP20D; | descriptorFileName = JBOSS_CMP20D; | ||||
} | } | ||||
File jbossCMPD = new File(getConfig().descriptorDir, ddPrefix + descriptorFileName); | File jbossCMPD = new File(getConfig().descriptorDir, ddPrefix + descriptorFileName); | ||||
@@ -69,50 +69,42 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class AntResolver | public class AntResolver | ||||
implements ExtensionResolver | |||||
{ | |||||
implements ExtensionResolver { | |||||
private File m_antfile; | private File m_antfile; | ||||
private File m_destfile; | private File m_destfile; | ||||
private String m_target; | private String m_target; | ||||
public void setAntfile( File antfile ) | |||||
{ | |||||
public void setAntfile( File antfile) { | |||||
m_antfile = antfile; | m_antfile = antfile; | ||||
} | } | ||||
public void setDestfile( File destfile ) | |||||
{ | |||||
public void setDestfile( File destfile) { | |||||
m_destfile = destfile; | m_destfile = destfile; | ||||
} | } | ||||
public void setTarget( final String target ) | |||||
{ | |||||
public void setTarget( final String target) { | |||||
m_target = target; | m_target = target; | ||||
} | } | ||||
public File resolve( final Extension extension, | public File resolve( final Extension extension, | ||||
final Project project ) | final Project project ) | ||||
throws BuildException | |||||
{ | |||||
throws BuildException { | |||||
validate(); | validate(); | ||||
final Ant ant = (Ant)project.createTask( "ant" ); | final Ant ant = (Ant)project.createTask( "ant" ); | ||||
ant.setInheritAll( false ); | ant.setInheritAll( false ); | ||||
ant.setAntfile( m_antfile.getName() ); | ant.setAntfile( m_antfile.getName() ); | ||||
try | |||||
{ | |||||
try { | |||||
final File dir = | final File dir = | ||||
m_antfile.getParentFile().getCanonicalFile(); | m_antfile.getParentFile().getCanonicalFile(); | ||||
ant.setDir( dir ); | ant.setDir( dir ); | ||||
} | } | ||||
catch( final IOException ioe ) | |||||
{ | |||||
catch ( final IOException ioe) { | |||||
throw new BuildException( ioe.getMessage(), ioe ); | throw new BuildException( ioe.getMessage(), ioe ); | ||||
} | } | ||||
if( null != m_target ) | |||||
{ | |||||
if (null != m_target) { | |||||
ant.setTarget( m_target ); | ant.setTarget( m_target ); | ||||
} | } | ||||
@@ -121,23 +113,19 @@ public class AntResolver | |||||
return m_destfile; | return m_destfile; | ||||
} | } | ||||
private void validate() | |||||
{ | |||||
if( null == m_antfile ) | |||||
{ | |||||
private void validate() { | |||||
if (null == m_antfile) { | |||||
final String message = "Must specify Buildfile"; | final String message = "Must specify Buildfile"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | } | ||||
if( null == m_destfile ) | |||||
{ | |||||
if (null == m_destfile) { | |||||
final String message = "Must specify destination file"; | final String message = "Must specify destination file"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | } | ||||
} | } | ||||
public String toString() | |||||
{ | |||||
public String toString() { | |||||
return "Ant[" + m_antfile + "==>" + m_destfile + "]"; | return "Ant[" + m_antfile + "==>" + m_destfile + "]"; | ||||
} | } | ||||
} | } |
@@ -67,21 +67,17 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class LocationResolver | public class LocationResolver | ||||
implements ExtensionResolver | |||||
{ | |||||
implements ExtensionResolver { | |||||
private String m_location; | private String m_location; | ||||
public void setLocation( final String location ) | |||||
{ | |||||
public void setLocation( final String location) { | |||||
m_location = location; | m_location = location; | ||||
} | } | ||||
public File resolve( final Extension extension, | public File resolve( final Extension extension, | ||||
final Project project ) | final Project project ) | ||||
throws BuildException | |||||
{ | |||||
if( null == m_location ) | |||||
{ | |||||
throws BuildException { | |||||
if (null == m_location) { | |||||
final String message = "No location specified for resolver"; | final String message = "No location specified for resolver"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | } | ||||
@@ -89,8 +85,7 @@ public class LocationResolver | |||||
return project.resolveFile( m_location ); | return project.resolveFile( m_location ); | ||||
} | } | ||||
public String toString() | |||||
{ | |||||
public String toString() { | |||||
return "Location[" + m_location + "]"; | return "Location[" + m_location + "]"; | ||||
} | } | ||||
} | } |
@@ -69,31 +69,26 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class URLResolver | public class URLResolver | ||||
implements ExtensionResolver | |||||
{ | |||||
implements ExtensionResolver { | |||||
private File m_destfile; | private File m_destfile; | ||||
private File m_destdir; | private File m_destdir; | ||||
private URL m_url; | private URL m_url; | ||||
public void setUrl( final URL url ) | |||||
{ | |||||
public void setUrl( final URL url) { | |||||
m_url = url; | m_url = url; | ||||
} | } | ||||
public void setDestfile( final File destfile ) | |||||
{ | |||||
public void setDestfile( final File destfile) { | |||||
m_destfile = destfile; | m_destfile = destfile; | ||||
} | } | ||||
public void setDestdir( final File destdir ) | |||||
{ | |||||
public void setDestdir( final File destdir) { | |||||
m_destdir = destdir; | m_destdir = destdir; | ||||
} | } | ||||
public File resolve( final Extension extension, | public File resolve( final Extension extension, | ||||
final Project project ) | final Project project ) | ||||
throws BuildException | |||||
{ | |||||
throws BuildException { | |||||
validate(); | validate(); | ||||
final File file = getDest(); | final File file = getDest(); | ||||
@@ -106,25 +101,17 @@ public class URLResolver | |||||
return file; | return file; | ||||
} | } | ||||
private File getDest() | |||||
{ | |||||
if( null != m_destfile ) | |||||
{ | |||||
private File getDest() { | |||||
if (null != m_destfile) { | |||||
return m_destfile; | return m_destfile; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
final String file = m_url.getFile(); | final String file = m_url.getFile(); | ||||
String filename = null; | String filename = null; | ||||
if( null == file || file.length() <= 1 ) | |||||
{ | |||||
if (null == file || file.length() <= 1) { | |||||
filename = "default.file"; | filename = "default.file"; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
int index = file.lastIndexOf( '/' ); | int index = file.lastIndexOf( '/' ); | ||||
if( -1 == index ) | |||||
{ | |||||
if (-1 == index) { | |||||
index = 0; | index = 0; | ||||
} | } | ||||
filename = file.substring( index ); | filename = file.substring( index ); | ||||
@@ -134,28 +121,22 @@ public class URLResolver | |||||
} | } | ||||
} | } | ||||
private void validate() | |||||
{ | |||||
if( null == m_url ) | |||||
{ | |||||
private void validate() { | |||||
if (null == m_url) { | |||||
final String message = "Must specify URL"; | final String message = "Must specify URL"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | } | ||||
if( null == m_destdir && null == m_destfile ) | |||||
{ | |||||
if (null == m_destdir && null == m_destfile) { | |||||
final String message = "Must specify destination file or directory"; | final String message = "Must specify destination file or directory"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | |||||
else if( null != m_destdir && null != m_destfile ) | |||||
{ | |||||
} else if (null != m_destdir && null != m_destfile) { | |||||
final String message = "Must not specify both destination file or directory"; | final String message = "Must not specify both destination file or directory"; | ||||
throw new BuildException( message ); | throw new BuildException( message ); | ||||
} | } | ||||
} | } | ||||
public String toString() | |||||
{ | |||||
public String toString() { | |||||
return "URL[" + m_url + "]"; | return "URL[" + m_url + "]"; | ||||
} | } | ||||
} | } |
@@ -548,8 +548,7 @@ public class Translate extends MatchingTask { | |||||
// If there is a white space or = or :, then | // If there is a white space or = or :, then | ||||
// it isn't to be treated as a valid key. | // it isn't to be treated as a valid key. | ||||
boolean validToken = true; | boolean validToken = true; | ||||
for (int k = 0; k < token.length() && validToken; k++) | |||||
{ | |||||
for (int k = 0; k < token.length() && validToken; k++) { | |||||
char c = token.charAt(k); | char c = token.charAt(k); | ||||
if (c == ':' || c == '=' | if (c == ':' || c == '=' | ||||
|| Character.isSpaceChar(c)) { | || Character.isSpaceChar(c)) { | ||||
@@ -88,8 +88,7 @@ import org.apache.tools.ant.DirectoryScanner; | |||||
class VAJWorkspaceScanner extends DirectoryScanner { | class VAJWorkspaceScanner extends DirectoryScanner { | ||||
// Patterns that should be excluded by default. | // Patterns that should be excluded by default. | ||||
private static final String[] DEFAULTEXCLUDES = | |||||
{ | |||||
private static final String[] DEFAULTEXCLUDES = { | |||||
"IBM*/**", | "IBM*/**", | ||||
"Java class libraries/**", | "Java class libraries/**", | ||||
"Sun class libraries*/**", | "Sun class libraries*/**", | ||||
@@ -89,8 +89,7 @@ public class JonasHotDeploymentTool extends GenericHotDeploymentTool implements | |||||
/** | /** | ||||
* All the valid actions that weblogic.deploy permits * | * All the valid actions that weblogic.deploy permits * | ||||
*/ | */ | ||||
private static final String[] VALID_ACTIONS = | |||||
{ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||||
private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||||
/** | /** | ||||
* Description of the Field | * Description of the Field | ||||
@@ -72,14 +72,12 @@ import org.apache.tools.ant.taskdefs.Java; | |||||
* @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool | ||||
* @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy | ||||
*/ | */ | ||||
public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool | |||||
{ | |||||
public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool { | |||||
/** The classname of the tool to run **/ | /** The classname of the tool to run **/ | ||||
private static final String WEBLOGIC_DEPLOY_CLASS_NAME = "weblogic.deploy"; | private static final String WEBLOGIC_DEPLOY_CLASS_NAME = "weblogic.deploy"; | ||||
/** All the valid actions that weblogic.deploy permits **/ | /** All the valid actions that weblogic.deploy permits **/ | ||||
private static final String[] VALID_ACTIONS = | |||||
{ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||||
private static final String[] VALID_ACTIONS = {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; | |||||
/** Represents the "-debug" flag from weblogic.deploy **/ | /** Represents the "-debug" flag from weblogic.deploy **/ | ||||
private boolean debug; | private boolean debug; | ||||
@@ -126,21 +124,21 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme | |||||
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); | ||||
} | } | ||||
@@ -221,7 +219,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme | |||||
if (component != null) { | if (component != null) { | ||||
args = "-component " + component + " " + args; | args = "-component " + component + " " + args; | ||||
} | } | ||||
return args; | return args; | ||||
} | } | ||||
@@ -268,7 +266,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool impleme | |||||
* It is in the form <code><component>:<target1>,<target2>...</code> | * It is in the form <code><component>:<target1>,<target2>...</code> | ||||
* Where component is the archive name (minus the .jar, .ear, .war | * Where component is the archive name (minus the .jar, .ear, .war | ||||
* extension). Targets are the servers where the components will be deployed | * extension). Targets are the servers where the components will be deployed | ||||
* @param component A String representing the value of the "-component" | * @param component A String representing the value of the "-component" | ||||
* argument of the weblogic.deploy command line argument. | * argument of the weblogic.deploy command line argument. | ||||
*/ | */ | ||||
@@ -421,7 +421,7 @@ public class JspC extends MatchingTask { | |||||
getProject().createClassLoader(compilerClasspath)); | getProject().createClassLoader(compilerClasspath)); | ||||
//if we are a webapp, hand off to the compiler, which had better handle it | //if we are a webapp, hand off to the compiler, which had better handle it | ||||
if(webApp!=null) { | |||||
if (webApp!=null) { | |||||
doCompilation(compiler); | doCompilation(compiler); | ||||
return; | return; | ||||
} | } | ||||
@@ -537,7 +537,7 @@ public class JspC extends MatchingTask { | |||||
String filename = files[i]; | String filename = files[i]; | ||||
File srcFile = new File(srcDir, filename); | File srcFile = new File(srcDir, filename); | ||||
File javaFile = mapToJavaFile(mangler, srcFile, srcDir, dest); | File javaFile = mapToJavaFile(mangler, srcFile, srcDir, dest); | ||||
if(javaFile==null) { | |||||
if (javaFile==null) { | |||||
continue; | continue; | ||||
} | } | ||||
@@ -182,8 +182,7 @@ public class FormatterElement { | |||||
* used if the property has been set, otherwise it won't. | * used if the property has been set, otherwise it won't. | ||||
* @param ifProperty name of property | * @param ifProperty name of property | ||||
*/ | */ | ||||
public void setIf(String ifProperty) | |||||
{ | |||||
public void setIf(String ifProperty) { | |||||
this.ifProperty = ifProperty; | this.ifProperty = ifProperty; | ||||
} | } | ||||
@@ -193,8 +192,7 @@ public class FormatterElement { | |||||
* will be used. | * will be used. | ||||
* @param unlessProperty name of property | * @param unlessProperty name of property | ||||
*/ | */ | ||||
public void setUnless(String unlessProperty) | |||||
{ | |||||
public void setUnless(String unlessProperty) { | |||||
this.unlessProperty = unlessProperty; | this.unlessProperty = unlessProperty; | ||||
} | } | ||||
@@ -664,7 +664,7 @@ public class JUnitTask extends Task { | |||||
final FormatterElement[] feArray = mergeFormatters(test); | final FormatterElement[] feArray = mergeFormatters(test); | ||||
for (int i = 0; i < feArray.length; i++) { | for (int i = 0; i < feArray.length; i++) { | ||||
FormatterElement fe = feArray[i]; | FormatterElement fe = feArray[i]; | ||||
if(fe.shouldUse(this)) { | |||||
if (fe.shouldUse(this)) { | |||||
formatterArg.append("formatter="); | formatterArg.append("formatter="); | ||||
formatterArg.append(fe.getClassname()); | formatterArg.append(fe.getClassname()); | ||||
File outFile = getOutput(fe, test); | File outFile = getOutput(fe, test); | ||||
@@ -881,7 +881,7 @@ public class JUnitTask extends Task { | |||||
final FormatterElement[] feArray = mergeFormatters(test); | final FormatterElement[] feArray = mergeFormatters(test); | ||||
for (int i = 0; i < feArray.length; i++) { | for (int i = 0; i < feArray.length; i++) { | ||||
FormatterElement fe = feArray[i]; | FormatterElement fe = feArray[i]; | ||||
if(fe.shouldUse(this)) { | |||||
if (fe.shouldUse(this)) { | |||||
File outFile = getOutput(fe, test); | File outFile = getOutput(fe, test); | ||||
if (outFile != null) { | if (outFile != null) { | ||||
fe.setOutfile(outFile); | fe.setOutfile(outFile); | ||||
@@ -229,7 +229,7 @@ public class SetProxy extends Task { | |||||
sysprops.put("https.nonProxyHosts", nonProxyHosts); | sysprops.put("https.nonProxyHosts", nonProxyHosts); | ||||
sysprops.put("ftp.nonProxyHosts", nonProxyHosts); | sysprops.put("ftp.nonProxyHosts", nonProxyHosts); | ||||
} | } | ||||
if(proxyUser!=null) { | |||||
if (proxyUser!=null) { | |||||
sysprops.put("http.proxyUser", proxyUser); | sysprops.put("http.proxyUser", proxyUser); | ||||
sysprops.put("http.proxyPassword", proxyPassword); | sysprops.put("http.proxyPassword", proxyPassword); | ||||
} | } | ||||
@@ -258,8 +258,7 @@ public class Pvcs extends org.apache.tools.ant.Task { | |||||
commandLine.clearArgs(); | commandLine.clearArgs(); | ||||
commandLine.setExecutable(getExecutable(GET_EXE)); | commandLine.setExecutable(getExecutable(GET_EXE)); | ||||
if(getConfig() != null && getConfig().length()>0) | |||||
{ | |||||
if (getConfig() != null && getConfig().length()>0) { | |||||
commandLine.createArgument().setValue("-c" + getConfig()); | commandLine.createArgument().setValue("-c" + getConfig()); | ||||
} | } | ||||
@@ -250,7 +250,7 @@ public class Symlink extends Task { | |||||
// fill up a Properties object with link and resource | // fill up a Properties object with link and resource | ||||
// names | // names | ||||
while(eachlink.hasMoreElements()) { | |||||
while (eachlink.hasMoreElements()) { | |||||
File alink = (File) eachlink.nextElement(); | File alink = (File) eachlink.nextElement(); | ||||
try { | try { | ||||
linksToStore.put(alink.getName(), | linksToStore.put(alink.getName(), | ||||
@@ -269,8 +269,7 @@ public class Symlink extends Task { | |||||
writePropertyFile(linksToStore, writeTo, | writePropertyFile(linksToStore, writeTo, | ||||
"Symlinks from " + writeTo.getParent()); | "Symlinks from " + writeTo.getParent()); | ||||
} | } | ||||
} | |||||
else { | |||||
} else { | |||||
handleError("Invalid action specified in symlink"); | handleError("Invalid action specified in symlink"); | ||||
} | } | ||||
} finally { | } finally { | ||||
@@ -77,19 +77,18 @@ public class SunRmic extends DefaultRmicAdapter { | |||||
// Create an instance of the rmic, redirecting output to | // Create an instance of the rmic, redirecting output to | ||||
// the project log | // the project log | ||||
LogOutputStream logstr = new LogOutputStream(getRmic(), | |||||
LogOutputStream logstr = new LogOutputStream(getRmic(), | |||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
try { | try { | ||||
Class c = Class.forName("sun.rmi.rmic.Main"); | Class c = Class.forName("sun.rmi.rmic.Main"); | ||||
Constructor cons = c.getConstructor(new Class[] | |||||
{ OutputStream.class, String.class }); | |||||
Constructor cons = c.getConstructor(new Class[] { OutputStream.class, String.class }); | |||||
Object rmic = cons.newInstance(new Object[] { logstr, "rmic" }); | Object rmic = cons.newInstance(new Object[] { logstr, "rmic" }); | ||||
Method doRmic = c.getMethod("compile", | |||||
Method doRmic = c.getMethod("compile", | |||||
new Class [] { String[].class }); | new Class [] { String[].class }); | ||||
Boolean ok = | |||||
(Boolean) doRmic.invoke(rmic, | |||||
Boolean ok = | |||||
(Boolean) doRmic.invoke(rmic, | |||||
(new Object[] {cmd.getArguments()})); | (new Object[] {cmd.getArguments()})); | ||||
return ok.booleanValue(); | return ok.booleanValue(); | ||||
} catch (ClassNotFoundException ex) { | } catch (ClassNotFoundException ex) { | ||||
@@ -102,7 +101,7 @@ public class SunRmic extends DefaultRmicAdapter { | |||||
if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
throw (BuildException) ex; | throw (BuildException) ex; | ||||
} else { | } else { | ||||
throw new BuildException("Error starting SUN rmic: ", | |||||
throw new BuildException("Error starting SUN rmic: ", | |||||
ex, getRmic().getLocation()); | ex, getRmic().getLocation()); | ||||
} | } | ||||
} finally { | } finally { | ||||
@@ -150,7 +150,7 @@ public class Assertions extends DataType { | |||||
* <code>super.setRefid</code>.</p> | * <code>super.setRefid</code>.</p> | ||||
*/ | */ | ||||
public void setRefid(Reference ref) { | public void setRefid(Reference ref) { | ||||
if(assertionList.size()>0 || enableSystemAssertions!=null) { | |||||
if (assertionList.size()>0 || enableSystemAssertions!=null) { | |||||
throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
} | } | ||||
super.setRefid(ref); | super.setRefid(ref); | ||||
@@ -161,11 +161,11 @@ public class Assertions extends DataType { | |||||
* @return the object that contains the assertion info | * @return the object that contains the assertion info | ||||
*/ | */ | ||||
private Assertions getFinalReference() { | private Assertions getFinalReference() { | ||||
if(getRefid()==null) { | |||||
if (getRefid()==null) { | |||||
return this; | return this; | ||||
} else { | } else { | ||||
Object o = getRefid().getReferencedObject(getProject()); | Object o = getRefid().getReferencedObject(getProject()); | ||||
if(!(o instanceof Assertions)) { | |||||
if (!(o instanceof Assertions)) { | |||||
throw new BuildException("reference is of wrong type"); | throw new BuildException("reference is of wrong type"); | ||||
} | } | ||||
return (Assertions)o; | return (Assertions)o; | ||||
@@ -179,7 +179,7 @@ public class Assertions extends DataType { | |||||
public void applyAssertions(CommandlineJava command) { | public void applyAssertions(CommandlineJava command) { | ||||
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)) { | |||||
addVmArgument(command,"-enablesystemassertions"); | addVmArgument(command,"-enablesystemassertions"); | ||||
} else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) { | } else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) { | ||||
addVmArgument(command, "-disablesystemassertions"); | addVmArgument(command, "-disablesystemassertions"); | ||||
@@ -260,20 +260,20 @@ public class Assertions extends DataType { | |||||
*/ | */ | ||||
public String toCommand() { | public String toCommand() { | ||||
//catch invalidness | //catch invalidness | ||||
if(getPackageName()!=null && getClassName()!=null) { | |||||
if (getPackageName()!=null && getClassName()!=null) { | |||||
throw new BuildException("Both package and class have been set"); | throw new BuildException("Both package and class have been set"); | ||||
} | } | ||||
StringBuffer command=new StringBuffer(getCommandPrefix()); | StringBuffer command=new StringBuffer(getCommandPrefix()); | ||||
//see if it is a package or a class | //see if it is a package or a class | ||||
if(getPackageName() != null) { | |||||
if (getPackageName() != null) { | |||||
//packages get a ... prefix | //packages get a ... prefix | ||||
command.append(':'); | command.append(':'); | ||||
command.append(getPackageName()); | command.append(getPackageName()); | ||||
if(!command.toString().endsWith("...")) { | |||||
if (!command.toString().endsWith("...")) { | |||||
//append the ... suffix if not there already | //append the ... suffix if not there already | ||||
command.append("..."); | command.append("..."); | ||||
} | } | ||||
} else if(getClassName()!=null) { | |||||
} else if (getClassName()!=null) { | |||||
//classes just get the classname | //classes just get the classname | ||||
command.append(':'); | command.append(':'); | ||||
command.append(getClassName()); | command.append(getClassName()); | ||||
@@ -63,8 +63,8 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||||
/** | /** | ||||
* A representation of a Java command line that is nothing more | * A representation of a Java command line that is nothing more | ||||
* than a composite of 2 <tt>Commandline</tt>. One is used for the | |||||
* vm/options and one for the classname/arguments. It provides | |||||
* than a composite of 2 <tt>Commandline</tt>. One is used for the | |||||
* vm/options and one for the classname/arguments. It provides | |||||
* specific methods for a java command line. | * specific methods for a java command line. | ||||
* | * | ||||
* @author thomas.haas@softwired-inc.com | * @author thomas.haas@softwired-inc.com | ||||
@@ -105,7 +105,7 @@ public class CommandlineJava implements Cloneable { | |||||
public String[] getVariables() throws BuildException { | public String[] getVariables() throws BuildException { | ||||
String[] props = super.getVariables(); | String[] props = super.getVariables(); | ||||
Properties p = mergePropertySets(); | Properties p = mergePropertySets(); | ||||
if (props == null) { | if (props == null) { | ||||
if (p.size() == 0) { | if (p.size() == 0) { | ||||
return null; | return null; | ||||
@@ -124,7 +124,7 @@ public class CommandlineJava implements Cloneable { | |||||
String value = p.getProperty(key); | String value = p.getProperty(key); | ||||
result[i++] = "-D" + key + "=" + value; | result[i++] = "-D" + key + "=" + value; | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
@@ -182,7 +182,7 @@ public class CommandlineJava implements Cloneable { | |||||
private Properties mergePropertySets() { | private Properties mergePropertySets() { | ||||
Properties p = new Properties(); | Properties p = new Properties(); | ||||
for (Enumeration e = propertySets.elements(); | |||||
for (Enumeration e = propertySets.elements(); | |||||
e.hasMoreElements();) { | e.hasMoreElements();) { | ||||
PropertySet ps = (PropertySet) e.nextElement(); | PropertySet ps = (PropertySet) e.nextElement(); | ||||
p.putAll(ps.getProperties()); | p.putAll(ps.getProperties()); | ||||
@@ -227,7 +227,7 @@ public class CommandlineJava implements Cloneable { | |||||
* set a jar file to execute via the -jar option. | * set a jar file to execute via the -jar option. | ||||
* @param jarpathname the pathname of the jar to execute | * @param jarpathname the pathname of the jar to execute | ||||
*/ | */ | ||||
public void setJar(String jarpathname){ | |||||
public void setJar(String jarpathname) { | |||||
javaCommand.setExecutable(jarpathname); | javaCommand.setExecutable(jarpathname); | ||||
executeJar = true; | executeJar = true; | ||||
} | } | ||||
@@ -237,8 +237,8 @@ public class CommandlineJava implements Cloneable { | |||||
* or <tt>null</tt> if there is no jar to run. | * or <tt>null</tt> if there is no jar to run. | ||||
* @see #getClassname() | * @see #getClassname() | ||||
*/ | */ | ||||
public String getJar(){ | |||||
if (executeJar){ | |||||
public String getJar() { | |||||
if (executeJar) { | |||||
return javaCommand.getExecutable(); | return javaCommand.getExecutable(); | ||||
} | } | ||||
return null; | return null; | ||||
@@ -309,7 +309,7 @@ public class CommandlineJava implements Cloneable { | |||||
if (haveClasspath()) { | if (haveClasspath()) { | ||||
result[pos++] = "-classpath"; | result[pos++] = "-classpath"; | ||||
result[pos++] = | |||||
result[pos++] = | |||||
classpath.concatSystemClasspath("ignore").toString(); | classpath.concatSystemClasspath("ignore").toString(); | ||||
} | } | ||||
@@ -317,13 +317,13 @@ public class CommandlineJava implements Cloneable { | |||||
// a bug in JDK < 1.4 that forces the jvm type to be specified as the first | // a bug in JDK < 1.4 that forces the jvm type to be specified as the first | ||||
// option, it is appended here as specified in the docs even though there is | // option, it is appended here as specified in the docs even though there is | ||||
// in fact no order. | // in fact no order. | ||||
if (executeJar){ | |||||
if (executeJar) { | |||||
result[pos++] = "-jar"; | result[pos++] = "-jar"; | ||||
} | } | ||||
// this is the classname to run as well as its arguments. | // this is the classname to run as well as its arguments. | ||||
// in case of 'executeJar', the executable is a jar file. | // in case of 'executeJar', the executable is a jar file. | ||||
System.arraycopy(javaCommand.getCommandline(), 0, | |||||
System.arraycopy(javaCommand.getCommandline(), 0, | |||||
result, pos, javaCommand.size()); | result, pos, javaCommand.size()); | ||||
return result; | return result; | ||||
@@ -333,7 +333,7 @@ public class CommandlineJava implements Cloneable { | |||||
* Specify max memory of the JVM | * Specify max memory of the JVM | ||||
* -mx or -Xmx depending on VM version | * -mx or -Xmx depending on VM version | ||||
*/ | */ | ||||
public void setMaxmemory(String max){ | |||||
public void setMaxmemory(String max) { | |||||
this.maxMemory = max; | this.maxMemory = max; | ||||
} | } | ||||
@@ -379,7 +379,7 @@ public class CommandlineJava implements Cloneable { | |||||
} | } | ||||
} | } | ||||
return actualVMCommand; | return actualVMCommand; | ||||
} | |||||
} | |||||
/** | /** | ||||
* The size of the java command line. | * The size of the java command line. | ||||
@@ -397,7 +397,7 @@ public class CommandlineJava implements Cloneable { | |||||
size++; | size++; | ||||
} | } | ||||
// jar execution requires an additional -jar option | // jar execution requires an additional -jar option | ||||
if (executeJar){ | |||||
if (executeJar) { | |||||
size++ ; | size++ ; | ||||
} | } | ||||
return size; | return size; | ||||
@@ -467,9 +467,9 @@ public class CommandlineJava implements Cloneable { | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
private boolean haveClasspath() { | private boolean haveClasspath() { | ||||
Path fullClasspath = classpath != null | |||||
Path fullClasspath = classpath != null | |||||
? classpath.concatSystemClasspath("ignore") : null; | ? classpath.concatSystemClasspath("ignore") : null; | ||||
return fullClasspath != null | |||||
return fullClasspath != null | |||||
&& fullClasspath.toString().trim().length() > 0; | && fullClasspath.toString().trim().length() > 0; | ||||
} | } | ||||
@@ -484,7 +484,7 @@ public class CommandlineJava implements Cloneable { | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
private boolean haveBootclasspath(boolean log) { | private boolean haveBootclasspath(boolean log) { | ||||
if (bootclasspath != null | |||||
if (bootclasspath != null | |||||
&& bootclasspath.toString().trim().length() > 0) { | && bootclasspath.toString().trim().length() > 0) { | ||||
/* | /* | ||||
@@ -62,7 +62,7 @@ import org.apache.tools.ant.ProjectComponent; | |||||
/** | /** | ||||
* Base class for those classes that can appear inside the build file | * Base class for those classes that can appear inside the build file | ||||
* as stand alone data types. | |||||
* as stand alone data types. | |||||
* | * | ||||
* <p>This class handles the common description attribute and provides | * <p>This class handles the common description attribute and provides | ||||
* a default implementation for reference handling and checking for | * a default implementation for reference handling and checking for | ||||
@@ -70,7 +70,7 @@ import org.apache.tools.ant.ProjectComponent; | |||||
* nested inside elements of the same type (i.e. <patternset> | * nested inside elements of the same type (i.e. <patternset> | ||||
* but not <path>).</p> | * but not <path>).</p> | ||||
* | * | ||||
* @author Stefan Bodewig | |||||
* @author Stefan Bodewig | |||||
*/ | */ | ||||
public abstract class DataType extends ProjectComponent { | public abstract class DataType extends ProjectComponent { | ||||
/** | /** | ||||
@@ -103,12 +103,12 @@ public abstract class DataType extends ProjectComponent { | |||||
* {@link #isChecked} instead. | * {@link #isChecked} instead. | ||||
*/ | */ | ||||
protected boolean checked = true; | protected boolean checked = true; | ||||
/** | |||||
/** | |||||
* Sets a description of the current data type. It will be useful | * Sets a description of the current data type. It will be useful | ||||
* in commenting what we are doing. | |||||
* in commenting what we are doing. | |||||
*/ | */ | ||||
public void setDescription( final String desc ) { | |||||
public void setDescription( final String desc) { | |||||
description = desc; | description = desc; | ||||
} | } | ||||
@@ -132,9 +132,9 @@ public abstract class DataType extends ProjectComponent { | |||||
* <p>Subclasses may need to check whether any other attributes | * <p>Subclasses may need to check whether any other attributes | ||||
* have been set as well or child elements have been created and | * have been set as well or child elements have been created and | ||||
* thus override this method. if they do the must call | * thus override this method. if they do the must call | ||||
* <code>super.setRefid</code>.</p> | |||||
* <code>super.setRefid</code>.</p> | |||||
*/ | */ | ||||
public void setRefid( final Reference ref ) { | |||||
public void setRefid( final Reference ref) { | |||||
this.ref = ref; | this.ref = ref; | ||||
checked = false; | checked = false; | ||||
} | } | ||||
@@ -149,11 +149,11 @@ public abstract class DataType extends ProjectComponent { | |||||
* #circularReference circularReference}.</p> | * #circularReference circularReference}.</p> | ||||
* | * | ||||
* <p>This implementation is appropriate only for a DataType that | * <p>This implementation is appropriate only for a DataType that | ||||
* cannot hold other DataTypes as children.</p> | |||||
* cannot hold other DataTypes as children.</p> | |||||
* | * | ||||
* <p>The general contract of this method is that it shouldn't do | * <p>The general contract of this method is that it shouldn't do | ||||
* anything if {@link #checked <code>checked</code>} is true and | * anything if {@link #checked <code>checked</code>} is true and | ||||
* set it to true on exit.</p> | |||||
* set it to true on exit.</p> | |||||
*/ | */ | ||||
protected void dieOnCircularReference( final Stack stack, | protected void dieOnCircularReference( final Stack stack, | ||||
final Project project ) | final Project project ) | ||||
@@ -163,7 +163,7 @@ public abstract class DataType extends ProjectComponent { | |||||
return; | return; | ||||
} | } | ||||
Object o = ref.getReferencedObject(project); | Object o = ref.getReferencedObject(project); | ||||
if (o instanceof DataType) { | if (o instanceof DataType) { | ||||
if (stack.contains(o)) { | if (stack.contains(o)) { | ||||
throw circularReference(); | throw circularReference(); | ||||
@@ -178,16 +178,16 @@ public abstract class DataType extends ProjectComponent { | |||||
/** | /** | ||||
* Performs the check for circular references and returns the | * Performs the check for circular references and returns the | ||||
* referenced object. | |||||
* referenced object. | |||||
*/ | */ | ||||
protected Object getCheckedRef( final Class requiredClass, | protected Object getCheckedRef( final Class requiredClass, | ||||
final String dataTypeName ) { | |||||
final String dataTypeName) { | |||||
if (!checked) { | if (!checked) { | ||||
Stack stk = new Stack(); | Stack stk = new Stack(); | ||||
stk.push(this); | stk.push(this); | ||||
dieOnCircularReference(stk, getProject()); | dieOnCircularReference(stk, getProject()); | ||||
} | } | ||||
Object o = ref.getReferencedObject(getProject()); | Object o = ref.getReferencedObject(getProject()); | ||||
if (!(requiredClass.isAssignableFrom(o.getClass()))) { | if (!(requiredClass.isAssignableFrom(o.getClass()))) { | ||||
String msg = ref.getRefId() + " doesn\'t denote a " + dataTypeName; | String msg = ref.getRefId() + " doesn\'t denote a " + dataTypeName; | ||||
@@ -199,28 +199,28 @@ public abstract class DataType extends ProjectComponent { | |||||
/** | /** | ||||
* Creates an exception that indicates that refid has to be the | * Creates an exception that indicates that refid has to be the | ||||
* only attribute if it is set. | |||||
* only attribute if it is set. | |||||
*/ | */ | ||||
protected BuildException tooManyAttributes() { | protected BuildException tooManyAttributes() { | ||||
return new BuildException("You must not specify more than one " | |||||
return new BuildException("You must not specify more than one " | |||||
+ "attribute when using refid"); | + "attribute when using refid"); | ||||
} | } | ||||
/** | /** | ||||
* Creates an exception that indicates that this XML element must | * Creates an exception that indicates that this XML element must | ||||
* not have child elements if the refid attribute is set. | |||||
* not have child elements if the refid attribute is set. | |||||
*/ | */ | ||||
protected BuildException noChildrenAllowed() { | protected BuildException noChildrenAllowed() { | ||||
return new BuildException("You must not specify nested elements " | |||||
return new BuildException("You must not specify nested elements " | |||||
+ "when using refid"); | + "when using refid"); | ||||
} | } | ||||
/** | /** | ||||
* Creates an exception that indicates the user has generated a | * Creates an exception that indicates the user has generated a | ||||
* loop of data types referencing each other. | |||||
* loop of data types referencing each other. | |||||
*/ | */ | ||||
protected BuildException circularReference() { | protected BuildException circularReference() { | ||||
return new BuildException("This data type contains a circular " | |||||
return new BuildException("This data type contains a circular " | |||||
+ "reference."); | + "reference."); | ||||
} | } | ||||
@@ -228,7 +228,7 @@ public abstract class DataType extends ProjectComponent { | |||||
return checked; | return checked; | ||||
} | } | ||||
protected void setChecked( final boolean checked ) { | |||||
protected void setChecked( final boolean checked) { | |||||
this.checked = checked; | this.checked = checked; | ||||
} | } | ||||
@@ -236,8 +236,7 @@ public abstract class DataType extends ProjectComponent { | |||||
* get the reference set on this object | * get the reference set on this object | ||||
* @return the reference or null | * @return the reference or null | ||||
*/ | */ | ||||
protected Reference getRefid() | |||||
{ | |||||
protected Reference getRefid() { | |||||
return ref; | return ref; | ||||
} | } | ||||
@@ -63,7 +63,7 @@ import org.apache.tools.ant.BuildException; | |||||
* <p>See {@link org.apache.tools.ant.taskdefs.FixCRLF FixCRLF} for an | * <p>See {@link org.apache.tools.ant.taskdefs.FixCRLF FixCRLF} for an | ||||
* example. | * example. | ||||
* | * | ||||
* @author Stefan Bodewig | |||||
* @author Stefan Bodewig | |||||
*/ | */ | ||||
public abstract class EnumeratedAttribute { | public abstract class EnumeratedAttribute { | ||||
@@ -87,7 +87,7 @@ public abstract class EnumeratedAttribute { | |||||
public abstract String[] getValues(); | public abstract String[] getValues(); | ||||
/** bean constructor */ | /** bean constructor */ | ||||
protected EnumeratedAttribute(){ | |||||
protected EnumeratedAttribute() { | |||||
} | } | ||||
/** | /** | ||||
@@ -116,13 +116,13 @@ public abstract class EnumeratedAttribute { | |||||
* or -1 if it cannot be found. | * or -1 if it cannot be found. | ||||
* @see #getValues() | * @see #getValues() | ||||
*/ | */ | ||||
public final int indexOfValue(String value){ | |||||
public final int indexOfValue(String value) { | |||||
String[] values = getValues(); | String[] values = getValues(); | ||||
if (values == null || value == null) { | if (values == null || value == null) { | ||||
return -1; | return -1; | ||||
} | } | ||||
for (int i = 0; i < values.length; i++){ | |||||
if (value.equals(values[i])){ | |||||
for (int i = 0; i < values.length; i++) { | |||||
if (value.equals(values[i])) { | |||||
return i; | return i; | ||||
} | } | ||||
} | } | ||||
@@ -149,7 +149,7 @@ public abstract class EnumeratedAttribute { | |||||
* Convert the value to its string form. | * Convert the value to its string form. | ||||
* | * | ||||
* @return the string form of the value. | * @return the string form of the value. | ||||
*/ | |||||
*/ | |||||
public String toString() { | public String toString() { | ||||
return getValue(); | return getValue(); | ||||
} | } | ||||
@@ -79,8 +79,7 @@ import org.apache.tools.ant.filters.TokenFilter; | |||||
* @author Magesh Umasankar | * @author Magesh Umasankar | ||||
*/ | */ | ||||
public final class FilterChain extends DataType | public final class FilterChain extends DataType | ||||
implements Cloneable | |||||
{ | |||||
implements Cloneable { | |||||
private Vector filterReaders = new Vector(); | private Vector filterReaders = new Vector(); | ||||
@@ -170,8 +169,7 @@ public final class FilterChain extends DataType | |||||
* containsregex | * containsregex | ||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public void addContainsRegex(TokenFilter.ContainsRegex filter) | |||||
{ | |||||
public void addContainsRegex(TokenFilter.ContainsRegex filter) { | |||||
filterReaders.addElement(filter); | filterReaders.addElement(filter); | ||||
} | } | ||||
@@ -179,8 +177,7 @@ public final class FilterChain extends DataType | |||||
* replaceregex | * replaceregex | ||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public void addReplaceRegex(TokenFilter.ReplaceRegex filter) | |||||
{ | |||||
public void addReplaceRegex(TokenFilter.ReplaceRegex filter) { | |||||
filterReaders.addElement(filter); | filterReaders.addElement(filter); | ||||
} | } | ||||
@@ -188,8 +185,7 @@ public final class FilterChain extends DataType | |||||
* trim | * trim | ||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public void addTrim(TokenFilter.Trim filter) | |||||
{ | |||||
public void addTrim(TokenFilter.Trim filter) { | |||||
filterReaders.addElement(filter); | filterReaders.addElement(filter); | ||||
} | } | ||||
@@ -198,8 +194,7 @@ public final class FilterChain extends DataType | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public void addReplaceString( | public void addReplaceString( | ||||
TokenFilter.ReplaceString filter) | |||||
{ | |||||
TokenFilter.ReplaceString filter) { | |||||
filterReaders.addElement(filter); | filterReaders.addElement(filter); | ||||
} | } | ||||
@@ -208,8 +203,7 @@ public final class FilterChain extends DataType | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public void addIgnoreBlank( | public void addIgnoreBlank( | ||||
TokenFilter.IgnoreBlank filter) | |||||
{ | |||||
TokenFilter.IgnoreBlank filter) { | |||||
filterReaders.addElement(filter); | filterReaders.addElement(filter); | ||||
} | } | ||||
@@ -204,7 +204,7 @@ public class Mapper extends DataType implements Cloneable { | |||||
FileNameMapper m = (FileNameMapper) c.newInstance(); | FileNameMapper m = (FileNameMapper) c.newInstance(); | ||||
final Project project = getProject(); | final Project project = getProject(); | ||||
if ( project != null ) { | |||||
if ( project != null) { | |||||
project.setProjectReference( m ); | project.setProjectReference( m ); | ||||
} | } | ||||
m.setFrom(from); | m.setFrom(from); | ||||
@@ -654,8 +654,7 @@ public class Path extends DataType implements Cloneable { | |||||
// IBM's 1.4 has rt.jar split into 4 smaller jars and a combined | // IBM's 1.4 has rt.jar split into 4 smaller jars and a combined | ||||
// JCE/JSSE in security.jar. | // JCE/JSSE in security.jar. | ||||
String[] ibmJars = | |||||
{ "core", "graphics", "security", "server", "xml" }; | |||||
String[] ibmJars = { "core", "graphics", "security", "server", "xml" }; | |||||
for (int i = 0; i < ibmJars.length; i++) { | for (int i = 0; i < ibmJars.length; i++) { | ||||
addExisting(new Path(null, | addExisting(new Path(null, | ||||
System.getProperty("java.home") | System.getProperty("java.home") | ||||
@@ -206,8 +206,7 @@ public class PropertySet extends DataType { | |||||
if (!getDynamic()) { | if (!getDynamic()) { | ||||
cachedNames = names; | cachedNames = names; | ||||
} | } | ||||
} | |||||
else { | |||||
} else { | |||||
names = cachedNames; | names = cachedNames; | ||||
} | } | ||||
@@ -247,16 +246,14 @@ public class PropertySet extends DataType { | |||||
if (prj.getProperty(ref.name) != null) { | if (prj.getProperty(ref.name) != null) { | ||||
names.addElement(ref.name); | names.addElement(ref.name); | ||||
} | } | ||||
} | |||||
else if (ref.prefix != null) { | |||||
} else if (ref.prefix != null) { | |||||
for (Enumeration p = properties.keys(); p.hasMoreElements();) { | for (Enumeration p = properties.keys(); p.hasMoreElements();) { | ||||
String name = (String) p.nextElement(); | String name = (String) p.nextElement(); | ||||
if (name.startsWith(ref.prefix)) { | if (name.startsWith(ref.prefix)) { | ||||
names.addElement(name); | names.addElement(name); | ||||
} | } | ||||
} | } | ||||
} | |||||
else if (ref.regex != null) { | |||||
} else if (ref.regex != null) { | |||||
RegexpMatcherFactory matchMaker = new RegexpMatcherFactory(); | RegexpMatcherFactory matchMaker = new RegexpMatcherFactory(); | ||||
RegexpMatcher matcher = matchMaker.newRegexpMatcher(); | RegexpMatcher matcher = matchMaker.newRegexpMatcher(); | ||||
matcher.setPattern(ref.regex); | matcher.setPattern(ref.regex); | ||||
@@ -927,23 +927,19 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
setXMLCatalog = | setXMLCatalog = | ||||
resolverImplClass.getMethod("setXMLCatalog", | resolverImplClass.getMethod("setXMLCatalog", | ||||
new Class[] | |||||
{XMLCatalog.class}); | |||||
new Class[] {XMLCatalog.class}); | |||||
parseCatalog = | parseCatalog = | ||||
resolverImplClass.getMethod("parseCatalog", | resolverImplClass.getMethod("parseCatalog", | ||||
new Class[] | |||||
{String.class}); | |||||
new Class[] {String.class}); | |||||
resolveEntity = | resolveEntity = | ||||
resolverImplClass.getMethod("resolveEntity", | resolverImplClass.getMethod("resolveEntity", | ||||
new Class[] | |||||
{String.class, String.class}); | |||||
new Class[] {String.class, String.class}); | |||||
resolve = | resolve = | ||||
resolverImplClass.getMethod("resolve", | resolverImplClass.getMethod("resolve", | ||||
new Class[] | |||||
{String.class, String.class}); | |||||
new Class[] {String.class, String.class}); | |||||
} catch (NoSuchMethodException ex) { | } catch (NoSuchMethodException ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -977,8 +973,7 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
result = | result = | ||||
(InputSource) resolveEntity.invoke(resolverImpl, | (InputSource) resolveEntity.invoke(resolverImpl, | ||||
new Object[] | |||||
{publicId, systemId}); | |||||
new Object[] {publicId, systemId}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -995,8 +990,7 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
result = | result = | ||||
(InputSource) resolveEntity.invoke(resolverImpl, | (InputSource) resolveEntity.invoke(resolverImpl, | ||||
new Object[] | |||||
{publicId, systemId}); | |||||
new Object[] {publicId, systemId}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -1059,8 +1053,7 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
result = | result = | ||||
(SAXSource) resolve.invoke(resolverImpl, | (SAXSource) resolve.invoke(resolverImpl, | ||||
new Object[] | |||||
{href, base}); | |||||
new Object[] {href, base}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -1077,8 +1070,7 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
result = | result = | ||||
(SAXSource) resolve.invoke(resolverImpl, | (SAXSource) resolve.invoke(resolverImpl, | ||||
new Object[] | |||||
{href, base}); | |||||
new Object[] {href, base}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -1099,8 +1091,7 @@ public class XMLCatalog extends DataType | |||||
try { | try { | ||||
setXMLCatalog.invoke(resolverImpl, | setXMLCatalog.invoke(resolverImpl, | ||||
new Object[] | |||||
{XMLCatalog.this}); | |||||
new Object[] {XMLCatalog.this}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -1117,8 +1108,7 @@ public class XMLCatalog extends DataType | |||||
log("Parsing " + catFile, Project.MSG_DEBUG); | log("Parsing " + catFile, Project.MSG_DEBUG); | ||||
try { | try { | ||||
parseCatalog.invoke(resolverImpl, | parseCatalog.invoke(resolverImpl, | ||||
new Object[] | |||||
{catFile.getPath()}); | |||||
new Object[] {catFile.getPath()}); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
@@ -62,58 +62,46 @@ import java.awt.image.BufferedImage; | |||||
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | * @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | ||||
* @see org.apache.tools.ant.tasks.optional.image.Image | * @see org.apache.tools.ant.tasks.optional.image.Image | ||||
*/ | */ | ||||
public class Draw extends TransformOperation | |||||
{ | |||||
public class Draw extends TransformOperation { | |||||
protected int xloc = 0; | protected int xloc = 0; | ||||
protected int yloc = 0; | protected int yloc = 0; | ||||
public void setXloc(int x) | |||||
{ | |||||
public void setXloc(int x) { | |||||
xloc = x; | xloc = x; | ||||
} | } | ||||
public void setYloc(int y) | |||||
{ | |||||
public void setYloc(int y) { | |||||
yloc = y; | yloc = y; | ||||
} | } | ||||
public void addRectangle(Rectangle rect) | |||||
{ | |||||
public void addRectangle(Rectangle rect) { | |||||
instructions.add(rect); | instructions.add(rect); | ||||
} | } | ||||
public void addText(Text text) | |||||
{ | |||||
public void addText(Text text) { | |||||
instructions.add(text); | instructions.add(text); | ||||
} | } | ||||
public void addEllipse(Ellipse elip) | |||||
{ | |||||
public void addEllipse(Ellipse elip) { | |||||
instructions.add(elip); | instructions.add(elip); | ||||
} | } | ||||
public void addArc(Arc arc) | |||||
{ | |||||
public void addArc(Arc arc) { | |||||
instructions.add(arc); | instructions.add(arc); | ||||
} | } | ||||
public PlanarImage executeTransformOperation(PlanarImage image) | |||||
{ | |||||
public PlanarImage executeTransformOperation(PlanarImage image) { | |||||
BufferedImage bi = image.getAsBufferedImage(); | BufferedImage bi = image.getAsBufferedImage(); | ||||
Graphics2D graphics = (Graphics2D)bi.getGraphics(); | Graphics2D graphics = (Graphics2D)bi.getGraphics(); | ||||
for (int i=0; i<instructions.size(); i++) | |||||
{ | |||||
for (int i=0; i<instructions.size(); i++) { | |||||
ImageOperation instr = ((ImageOperation)instructions.elementAt(i)); | ImageOperation instr = ((ImageOperation)instructions.elementAt(i)); | ||||
if (instr instanceof DrawOperation) | |||||
{ | |||||
if (instr instanceof DrawOperation) { | |||||
PlanarImage op = ((DrawOperation)instr).executeDrawOperation(); | PlanarImage op = ((DrawOperation)instr).executeDrawOperation(); | ||||
log("\tDrawing to x=" + xloc + " y=" + yloc); | log("\tDrawing to x=" + xloc + " y=" + yloc); | ||||
graphics.drawImage(op.getAsBufferedImage(),null,xloc,yloc); | graphics.drawImage(op.getAsBufferedImage(),null,xloc,yloc); | ||||
} | |||||
else if (instr instanceof TransformOperation) | |||||
{ | |||||
} else if (instr instanceof TransformOperation) { | |||||
PlanarImage op = ((TransformOperation)instr).executeTransformOperation(null); | PlanarImage op = ((TransformOperation)instr).executeTransformOperation(null); | ||||
BufferedImage child = op.getAsBufferedImage(); | BufferedImage child = op.getAsBufferedImage(); | ||||
log("\tDrawing to x=" + xloc + " y=" + yloc); | log("\tDrawing to x=" + xloc + " y=" + yloc); | ||||
@@ -61,32 +61,26 @@ import java.util.Vector; | |||||
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | * @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | ||||
* @see org.apache.tools.ant.tasks.optional.image.Image | * @see org.apache.tools.ant.tasks.optional.image.Image | ||||
*/ | */ | ||||
public abstract class ImageOperation extends DataType | |||||
{ | |||||
public abstract class ImageOperation extends DataType { | |||||
protected Vector instructions = new Vector(); | protected Vector instructions = new Vector(); | ||||
public void addRotate(Rotate instr) | |||||
{ | |||||
public void addRotate(Rotate instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
public void addDraw(Draw instr) | |||||
{ | |||||
public void addDraw(Draw instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
public void addRectangle(Rectangle instr) | |||||
{ | |||||
public void addRectangle(Rectangle instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
public void addText(Text instr) | |||||
{ | |||||
public void addText(Text instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
public void addScale(Scale instr) | |||||
{ | |||||
public void addScale(Scale instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
} | } |
@@ -66,22 +66,19 @@ import java.awt.*; | |||||
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | * @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | ||||
* @see org.apache.tools.ant.tasks.optional.image.Image | * @see org.apache.tools.ant.tasks.optional.image.Image | ||||
*/ | */ | ||||
public class Rotate extends TransformOperation implements DrawOperation | |||||
{ | |||||
public class Rotate extends TransformOperation implements DrawOperation { | |||||
protected float angle = 0.0F; | protected float angle = 0.0F; | ||||
/** | /** | ||||
* Sets the angle of rotation in degrees. | * Sets the angle of rotation in degrees. | ||||
* @param ang The angle at which to rotate the image | * @param ang The angle at which to rotate the image | ||||
*/ | */ | ||||
public void setAngle(String ang) | |||||
{ | |||||
public void setAngle(String ang) { | |||||
angle = Float.parseFloat(ang); | angle = Float.parseFloat(ang); | ||||
} | } | ||||
public PlanarImage performRotate(PlanarImage image) | |||||
{ | |||||
public PlanarImage performRotate(PlanarImage image) { | |||||
float t_angle = (float) (angle * (Math.PI / 180.0F)); | float t_angle = (float) (angle * (Math.PI / 180.0F)); | ||||
ParameterBlock pb = new ParameterBlock(); | ParameterBlock pb = new ParameterBlock(); | ||||
pb.addSource(image); | pb.addSource(image); | ||||
@@ -97,24 +94,19 @@ public class Rotate extends TransformOperation implements DrawOperation | |||||
* Performs the image rotation when being handled as a TransformOperation. | * Performs the image rotation when being handled as a TransformOperation. | ||||
* @param image The image to perform the transformation on. | * @param image The image to perform the transformation on. | ||||
*/ | */ | ||||
public PlanarImage executeTransformOperation(PlanarImage image) | |||||
{ | |||||
public PlanarImage executeTransformOperation(PlanarImage image) { | |||||
BufferedImage bi = null; | BufferedImage bi = null; | ||||
Graphics2D graphics = null; | Graphics2D graphics = null; | ||||
for (int i = 0; i < instructions.size(); i++) | |||||
{ | |||||
for (int i = 0; i < instructions.size(); i++) { | |||||
ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ||||
if (instr instanceof DrawOperation) | |||||
{ | |||||
if (instr instanceof DrawOperation) { | |||||
// If this TransformOperation has DrawOperation children | // If this TransformOperation has DrawOperation children | ||||
// then Rotate the first child and return. | // then Rotate the first child and return. | ||||
System.out.println("Execing Draws"); | System.out.println("Execing Draws"); | ||||
PlanarImage op = ((DrawOperation) instr).executeDrawOperation(); | PlanarImage op = ((DrawOperation) instr).executeDrawOperation(); | ||||
image = performRotate(op); | image = performRotate(op); | ||||
return image; | return image; | ||||
} | |||||
else if (instr instanceof TransformOperation) | |||||
{ | |||||
} else if (instr instanceof TransformOperation) { | |||||
bi = image.getAsBufferedImage(); | bi = image.getAsBufferedImage(); | ||||
graphics = (Graphics2D) bi.getGraphics(); | graphics = (Graphics2D) bi.getGraphics(); | ||||
System.out.println("Execing Transforms"); | System.out.println("Execing Transforms"); | ||||
@@ -135,13 +127,10 @@ public class Rotate extends TransformOperation implements DrawOperation | |||||
* ONE image. | * ONE image. | ||||
* @param image The image to perform the transformation on. | * @param image The image to perform the transformation on. | ||||
*/ | */ | ||||
public PlanarImage executeDrawOperation() | |||||
{ | |||||
for (int i = 0; i < instructions.size(); i++) | |||||
{ | |||||
public PlanarImage executeDrawOperation() { | |||||
for (int i = 0; i < instructions.size(); i++) { | |||||
ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ||||
if (instr instanceof DrawOperation) | |||||
{ | |||||
if (instr instanceof DrawOperation) { | |||||
// If this TransformOperation has DrawOperation children | // If this TransformOperation has DrawOperation children | ||||
// then Rotate the first child and return. | // then Rotate the first child and return. | ||||
PlanarImage op = ((DrawOperation) instr).executeDrawOperation(); | PlanarImage op = ((DrawOperation) instr).executeDrawOperation(); | ||||
@@ -59,12 +59,10 @@ import javax.media.jai.PlanarImage; | |||||
* @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | * @author <a href="mailto:kzgrey@ntplx.net">Kevin Z Grey</a> | ||||
* @see org.apache.tools.ant.tasks.optional.image.Image | * @see org.apache.tools.ant.tasks.optional.image.Image | ||||
*/ | */ | ||||
public abstract class TransformOperation extends ImageOperation | |||||
{ | |||||
public abstract class TransformOperation extends ImageOperation { | |||||
public abstract PlanarImage executeTransformOperation(PlanarImage img); | public abstract PlanarImage executeTransformOperation(PlanarImage img); | ||||
public void addRectangle(Rectangle instr) | |||||
{ | |||||
public void addRectangle(Rectangle instr) { | |||||
instructions.add(instr); | instructions.add(instr); | ||||
} | } | ||||
@@ -96,12 +96,12 @@ public class ApacheCatalog extends Catalog { | |||||
cat.setResolver(resolver); | cat.setResolver(resolver); | ||||
return cat; | return cat; | ||||
} | } | ||||
/** Set the resolver object to callback. */ | /** Set the resolver object to callback. */ | ||||
public void setResolver(ApacheCatalogResolver resolver) { | public void setResolver(ApacheCatalogResolver resolver) { | ||||
this.resolver = resolver; | this.resolver = resolver; | ||||
} | } | ||||
/** | /** | ||||
* <p>This method overrides the superclass method of the same name | * <p>This method overrides the superclass method of the same name | ||||
* in order to add catalog entries back to the controlling | * in order to add catalog entries back to the controlling | ||||
@@ -131,26 +131,24 @@ public class ApacheCatalog extends Catalog { | |||||
if (resolver == null) { | if (resolver == null) { | ||||
catalogManager.debug | catalogManager.debug | ||||
.message(1, "Internal Error: null ApacheCatalogResolver"); | .message(1, "Internal Error: null ApacheCatalogResolver"); | ||||
} | |||||
else { | |||||
} else { | |||||
resolver.addPublicEntry(publicid, systemid, base); | resolver.addPublicEntry(publicid, systemid, base); | ||||
} | } | ||||
} else if (type == URI) { | } else if (type == URI) { | ||||
String uri = normalizeURI(entry.getEntryArg(0)); | String uri = normalizeURI(entry.getEntryArg(0)); | ||||
String altURI = normalizeURI(entry.getEntryArg(1)); | String altURI = normalizeURI(entry.getEntryArg(1)); | ||||
if (resolver == null) { | if (resolver == null) { | ||||
catalogManager.debug | catalogManager.debug | ||||
.message(1, "Internal Error: null ApacheCatalogResolver"); | .message(1, "Internal Error: null ApacheCatalogResolver"); | ||||
} | |||||
else { | |||||
} else { | |||||
resolver.addURIEntry(uri, altURI, base); | resolver.addURIEntry(uri, altURI, base); | ||||
} | } | ||||
} | } | ||||
super.addEntry(entry); | super.addEntry(entry); | ||||
} | } | ||||
@@ -75,7 +75,7 @@ import org.apache.xml.resolver.tools.CatalogResolver; | |||||
* class. XMLCatalog calls methods in this class using Reflection in | * class. XMLCatalog calls methods in this class using Reflection in | ||||
* order to avoid requiring the xml-commons resolver library in the | * order to avoid requiring the xml-commons resolver library in the | ||||
* path.</p> | * path.</p> | ||||
* | |||||
* | |||||
* <p>The {@link org.apache.tools.ant.types.resolver.ApacheCatalog | * <p>The {@link org.apache.tools.ant.types.resolver.ApacheCatalog | ||||
* ApacheCatalog} class is used to parse external catalog files, which | * ApacheCatalog} class is used to parse external catalog files, which | ||||
* can be in either <a | * can be in either <a | ||||
@@ -83,7 +83,7 @@ import org.apache.xml.resolver.tools.CatalogResolver; | |||||
* plain text format</a> or <a | * plain text format</a> or <a | ||||
* href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html"> | * href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html"> | ||||
* XML format</a>.</p> | * XML format</a>.</p> | ||||
* | |||||
* | |||||
* <p>For each entry found in an external catalog file, if any, an | * <p>For each entry found in an external catalog file, if any, an | ||||
* instance of {@link org.apache.tools.ant.types.ResourceLocation | * instance of {@link org.apache.tools.ant.types.ResourceLocation | ||||
* ResourceLocation} is created and added to the controlling | * ResourceLocation} is created and added to the controlling | ||||
@@ -102,9 +102,8 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
/** The XMLCatalog object to callback. */ | /** The XMLCatalog object to callback. */ | ||||
private XMLCatalog xmlCatalog = null; | private XMLCatalog xmlCatalog = null; | ||||
static | |||||
{ | |||||
static { | |||||
// | // | ||||
// If you don't do this, you get all sorts of annoying | // If you don't do this, you get all sorts of annoying | ||||
// warnings about a missing properties file. However, it | // warnings about a missing properties file. However, it | ||||
@@ -133,7 +132,7 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
this.xmlCatalog = xmlCatalog; | this.xmlCatalog = xmlCatalog; | ||||
} | } | ||||
/** | |||||
/** | |||||
* XMLCatalog calls this to add an external catalog file for each | * XMLCatalog calls this to add an external catalog file for each | ||||
* file within a <code><catalogfiles></code> fileset. | * file within a <code><catalogfiles></code> fileset. | ||||
*/ | */ | ||||
@@ -147,10 +146,10 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
try { | try { | ||||
catalog.parseCatalog(file); | catalog.parseCatalog(file); | ||||
} | } | ||||
catch(MalformedURLException ex) { | |||||
catch (MalformedURLException ex) { | |||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
catch(IOException ex) { | |||||
catch (IOException ex) { | |||||
throw new BuildException(ex); | throw new BuildException(ex); | ||||
} | } | ||||
} | } | ||||
@@ -166,9 +165,9 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
* specifies a relative URL/pathname, it is resolved using the | * specifies a relative URL/pathname, it is resolved using the | ||||
* base. The default base for an external catalog file is the | * base. The default base for an external catalog file is the | ||||
* directory in which the catalog is located. | * directory in which the catalog is located. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public void addPublicEntry(String publicid, | |||||
public void addPublicEntry(String publicid, | |||||
String systemid, | String systemid, | ||||
URL base) { | URL base) { | ||||
@@ -176,7 +175,7 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
dtd.setBase(base); | dtd.setBase(base); | ||||
dtd.setPublicId(publicid); | dtd.setPublicId(publicid); | ||||
dtd.setLocation(systemid); | dtd.setLocation(systemid); | ||||
xmlCatalog.addDTD(dtd); | xmlCatalog.addDTD(dtd); | ||||
} | } | ||||
@@ -192,9 +191,9 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
* specifies a relative URL/pathname, it is resolved using the | * specifies a relative URL/pathname, it is resolved using the | ||||
* base. The default base for an external catalog file is the | * base. The default base for an external catalog file is the | ||||
* directory in which the catalog is located. | * directory in which the catalog is located. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public void addURIEntry(String uri, | |||||
public void addURIEntry(String uri, | |||||
String altURI, | String altURI, | ||||
URL base) { | URL base) { | ||||
@@ -202,7 +201,7 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
entity.setBase(base); | entity.setBase(base); | ||||
entity.setPublicId(uri); | entity.setPublicId(uri); | ||||
entity.setLocation(altURI); | entity.setLocation(altURI); | ||||
xmlCatalog.addEntity(entity); | xmlCatalog.addEntity(entity); | ||||
} | } | ||||
@@ -73,7 +73,7 @@ import org.apache.tools.ant.types.Reference; | |||||
* <pre><code> | * <pre><code> | ||||
* ClasspathUtils.Delegate cpDelegate; | * ClasspathUtils.Delegate cpDelegate; | ||||
* | * | ||||
* public void init(){ | |||||
* public void init() { | |||||
* this.cpDelegate = ClasspathUtils.getDelegate(this); | * this.cpDelegate = ClasspathUtils.getDelegate(this); | ||||
* super.init(); | * super.init(); | ||||
* } | * } | ||||
@@ -77,7 +77,7 @@ public class CollectionUtils { | |||||
if (v1 == v2) { | if (v1 == v2) { | ||||
return true; | return true; | ||||
} | } | ||||
if (v1 == null || v2 == null) { | if (v1 == null || v2 == null) { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -93,7 +93,7 @@ public class CollectionUtils { | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
// don't need to check e2.hasMoreElements as the Vectors have | // don't need to check e2.hasMoreElements as the Vectors have | ||||
// same size. | // same size. | ||||
@@ -111,7 +111,7 @@ public class CollectionUtils { | |||||
if (d1 == d2) { | if (d1 == d2) { | ||||
return true; | return true; | ||||
} | } | ||||
if (d1 == null || d2 == null) { | if (d1 == null || d2 == null) { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -129,7 +129,7 @@ public class CollectionUtils { | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
// don't need the opposite check as the Dictionaries have the | // don't need the opposite check as the Dictionaries have the | ||||
// same size, so we've also covered all keys of d2 already. | // same size, so we've also covered all keys of d2 already. | ||||
@@ -142,7 +142,7 @@ public class CollectionUtils { | |||||
* @since Ant 1.6 | * @since Ant 1.6 | ||||
*/ | */ | ||||
public static void putAll(Dictionary m1, Dictionary m2) { | public static void putAll(Dictionary m1, Dictionary m2) { | ||||
for(Enumeration it = m2.keys(); it.hasMoreElements();) { | |||||
for (Enumeration it = m2.keys(); it.hasMoreElements();) { | |||||
Object key = it.nextElement(); | Object key = it.nextElement(); | ||||
m1.put(key, m2.get(key)); | m1.put(key, m2.get(key)); | ||||
} | } | ||||
@@ -71,7 +71,7 @@ import java.util.TimeZone; | |||||
* @author Stefan Bodewig | * @author Stefan Bodewig | ||||
* | * | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
* | |||||
* | |||||
* @version $Revision$ | * @version $Revision$ | ||||
*/ | */ | ||||
public final class DateUtils { | public final class DateUtils { | ||||
@@ -108,11 +108,9 @@ public final class DateUtils { | |||||
private static final double[] LIMITS = {0, 1, 2}; | private static final double[] LIMITS = {0, 1, 2}; | ||||
private static final String[] MINUTES_PART = | |||||
{"", "1 minute ", "{0,number} minutes "}; | |||||
private static final String[] MINUTES_PART = {"", "1 minute ", "{0,number} minutes "}; | |||||
private static final String[] SECONDS_PART = | |||||
{"0 seconds", "1 second", "{1,number} seconds"}; | |||||
private static final String[] SECONDS_PART = {"0 seconds", "1 second", "{1,number} seconds"}; | |||||
private static final ChoiceFormat MINUTES_FORMAT = | private static final ChoiceFormat MINUTES_FORMAT = | ||||
new ChoiceFormat(LIMITS, MINUTES_PART); | new ChoiceFormat(LIMITS, MINUTES_PART); | ||||
@@ -236,7 +234,7 @@ public final class DateUtils { | |||||
public static String getDateForHeader() { | public static String getDateForHeader() { | ||||
Calendar cal = Calendar.getInstance(); | Calendar cal = Calendar.getInstance(); | ||||
TimeZone tz = cal.getTimeZone(); | TimeZone tz = cal.getTimeZone(); | ||||
int offset = tz.getOffset(cal.get(Calendar.ERA), | |||||
int offset = tz.getOffset(cal.get(Calendar.ERA), | |||||
cal.get(Calendar.YEAR), | cal.get(Calendar.YEAR), | ||||
cal.get(Calendar.MONTH), | cal.get(Calendar.MONTH), | ||||
cal.get(Calendar.DAY_OF_MONTH), | cal.get(Calendar.DAY_OF_MONTH), | ||||
@@ -205,7 +205,7 @@ public class JAXPUtils { | |||||
* @return the systemid corresponding to the given file. | * @return the systemid corresponding to the given file. | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public static String getSystemId(File file){ | |||||
public static String getSystemId(File file) { | |||||
return fu.toURI(file.getAbsolutePath()); | return fu.toURI(file.getAbsolutePath()); | ||||
} | } | ||||
@@ -358,7 +358,7 @@ public class JavaEnvUtils { | |||||
* @return list of packages | * @return list of packages | ||||
*/ | */ | ||||
public static Vector getJrePackages() { | public static Vector getJrePackages() { | ||||
if(jrePackages==null) { | |||||
if (jrePackages==null) { | |||||
buildJrePackages(); | buildJrePackages(); | ||||
} | } | ||||
return jrePackages; | return jrePackages; | ||||
@@ -64,7 +64,7 @@ import java.io.OutputStream; | |||||
* <p> | * <p> | ||||
* In code-language it means that it is not necessary to do: | * In code-language it means that it is not necessary to do: | ||||
* <pre> | * <pre> | ||||
* if (out != System.out && out!= System.err){ | |||||
* if (out != System.out && out!= System.err) { | |||||
* out.close(); | * out.close(); | ||||
* } | * } | ||||
* </pre> | * </pre> | ||||
@@ -75,8 +75,8 @@ public class LazyHashtable extends Hashtable { | |||||
* we delay it until we do need _all_ tasks. Otherwise we | * we delay it until we do need _all_ tasks. Otherwise we | ||||
* just get the tasks that we need, and avoid costly init. | * just get the tasks that we need, and avoid costly init. | ||||
*/ | */ | ||||
protected void initAll( ) { | |||||
if( initAllDone ) return; | |||||
protected void initAll() { | |||||
if (initAllDone ) return; | |||||
initAllDone=true; | initAllDone=true; | ||||
} | } | ||||
@@ -96,7 +96,7 @@ public class LazyHashtable extends Hashtable { | |||||
return super.size(); | return super.size(); | ||||
} | } | ||||
public boolean contains( Object value ) { | |||||
public boolean contains( Object value) { | |||||
initAll(); | initAll(); | ||||
return super.contains(value); | return super.contains(value); | ||||
} | } | ||||
@@ -109,7 +109,7 @@ public class LazyHashtable extends Hashtable { | |||||
/** | /** | ||||
* Delegates to {@link #contains contains}. | * Delegates to {@link #contains contains}. | ||||
*/ | */ | ||||
public boolean containsValue( Object value ) { | |||||
public boolean containsValue( Object value) { | |||||
return contains(value); | return contains(value); | ||||
} | } | ||||
@@ -73,7 +73,7 @@ public final class StringUtils { | |||||
* @param data the string to split up into lines. | * @param data the string to split up into lines. | ||||
* @return the list of lines available in the string. | * @return the list of lines available in the string. | ||||
*/ | */ | ||||
public static Vector lineSplit(String data){ | |||||
public static Vector lineSplit(String data) { | |||||
return split(data, '\n'); | return split(data, '\n'); | ||||
} | } | ||||
@@ -84,11 +84,11 @@ public final class StringUtils { | |||||
* @param ch the separator character. | * @param ch the separator character. | ||||
* @return the list of elements. | * @return the list of elements. | ||||
*/ | */ | ||||
public static Vector split(String data, int ch){ | |||||
public static Vector split(String data, int ch) { | |||||
Vector elems = new Vector(); | Vector elems = new Vector(); | ||||
int pos = -1; | int pos = -1; | ||||
int i = 0; | int i = 0; | ||||
while ((pos = data.indexOf(ch, i)) != -1){ | |||||
while ((pos = data.indexOf(ch, i)) != -1) { | |||||
String elem = data.substring(i, pos); | String elem = data.substring(i, pos); | ||||
elems.addElement(elem); | elems.addElement(elem); | ||||
i = pos + 1; | i = pos + 1; | ||||
@@ -104,11 +104,11 @@ public final class StringUtils { | |||||
* @param to the occurrence to be used as a replacement. | * @param to the occurrence to be used as a replacement. | ||||
* @return the new string with replaced occurrences. | * @return the new string with replaced occurrences. | ||||
*/ | */ | ||||
public static String replace(String data, String from, String to){ | |||||
public static String replace(String data, String from, String to) { | |||||
StringBuffer buf = new StringBuffer(data.length()); | StringBuffer buf = new StringBuffer(data.length()); | ||||
int pos = -1; | int pos = -1; | ||||
int i = 0; | int i = 0; | ||||
while ((pos = data.indexOf(from, i)) != -1){ | |||||
while ((pos = data.indexOf(from, i)) != -1) { | |||||
buf.append(data.substring(i, pos)).append(to); | buf.append(data.substring(i, pos)).append(to); | ||||
i = pos + from.length(); | i = pos + from.length(); | ||||
} | } | ||||
@@ -62,40 +62,33 @@ import org.apache.tools.ant.Task; | |||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | ||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public final class TaskLogger | |||||
{ | |||||
public final class TaskLogger { | |||||
/** | /** | ||||
* Task to use to do logging. | * Task to use to do logging. | ||||
*/ | */ | ||||
private Task m_task; | private Task m_task; | ||||
public TaskLogger( final Task task ) | |||||
{ | |||||
public TaskLogger( final Task task) { | |||||
this.m_task = task; | this.m_task = task; | ||||
} | } | ||||
public void info( final String message ) | |||||
{ | |||||
public void info( final String message) { | |||||
m_task.log( message, Project.MSG_INFO ); | m_task.log( message, Project.MSG_INFO ); | ||||
} | } | ||||
public void error( final String message ) | |||||
{ | |||||
public void error( final String message) { | |||||
m_task.log( message, Project.MSG_ERR ); | m_task.log( message, Project.MSG_ERR ); | ||||
} | } | ||||
public void warning( final String message ) | |||||
{ | |||||
public void warning( final String message) { | |||||
m_task.log( message, Project.MSG_WARN ); | m_task.log( message, Project.MSG_WARN ); | ||||
} | } | ||||
public void verbose( final String message ) | |||||
{ | |||||
public void verbose( final String message) { | |||||
m_task.log( message, Project.MSG_VERBOSE ); | m_task.log( message, Project.MSG_VERBOSE ); | ||||
} | } | ||||
public void debug( final String message ) | |||||
{ | |||||
public void debug( final String message) { | |||||
m_task.log( message, Project.MSG_DEBUG ); | m_task.log( message, Project.MSG_DEBUG ); | ||||
} | } | ||||
} | } |
@@ -76,7 +76,7 @@ public abstract class WeakishReference { | |||||
* @return reference to the Object. | * @return reference to the Object. | ||||
*/ | */ | ||||
public static WeakishReference createReference(Object object) { | public static WeakishReference createReference(Object object) { | ||||
if(referenceConstructor==null) { | |||||
if (referenceConstructor==null) { | |||||
createReferenceConstructor(); | createReferenceConstructor(); | ||||
} | } | ||||
try { | try { | ||||
@@ -125,7 +125,7 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
&& name.startsWith("class$")) { | && name.startsWith("class$")) { | ||||
String classname = name.substring(6).replace('$', '.'); | String classname = name.substring(6).replace('$', '.'); | ||||
// does the class have a package structure | // does the class have a package structure | ||||
int index = classname.lastIndexOf("."); | |||||
int index = classname.lastIndexOf("."); | |||||
if (index > 0) { | if (index > 0) { | ||||
char start; | char start; | ||||
// check if the package structure is more than 1 level deep | // check if the package structure is more than 1 level deep | ||||
@@ -133,8 +133,7 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
if (index2 != -1) { | if (index2 != -1) { | ||||
// class name has more than 1 package level 'com.company.Class' | // class name has more than 1 package level 'com.company.Class' | ||||
start = classname.charAt(index2 + 1); | start = classname.charAt(index2 + 1); | ||||
} | |||||
else { | |||||
} else { | |||||
// class name has only 1 package level 'package.Class' | // class name has only 1 package level 'package.Class' | ||||
start = classname.charAt(0); | start = classname.charAt(0); | ||||
} | } | ||||
@@ -143,15 +142,13 @@ public class DependencyVisitor extends EmptyVisitor { | |||||
// first letter of the previous segment of the class name 'Class' | // first letter of the previous segment of the class name 'Class' | ||||
// is upper case ascii. so according to the spec it's an inner class | // is upper case ascii. so according to the spec it's an inner class | ||||
classname = classname.substring(0, index) + "$" + | classname = classname.substring(0, index) + "$" + | ||||
classname.substring(index + 1); | |||||
classname.substring(index + 1); | |||||
addClass(classname); | addClass(classname); | ||||
} | |||||
else { | |||||
// Add the class in dotted notation 'com.company.Class' | |||||
} else { | |||||
// Add the class in dotted notation 'com.company.Class' | |||||
addClass(classname); | addClass(classname); | ||||
} | |||||
} | |||||
else { | |||||
} | |||||
} else { | |||||
// Add a class with no package 'Class' | // Add a class with no package 'Class' | ||||
addClass(classname); | addClass(classname); | ||||
} | } | ||||
@@ -207,7 +207,7 @@ public class MailMessage { | |||||
* @param port the port to use for connection. | * @param port the port to use for connection. | ||||
* @see #DEFAULT_PORT | * @see #DEFAULT_PORT | ||||
*/ | */ | ||||
public void setPort(int port){ | |||||
public void setPort(int port) { | |||||
this.port = port; | this.port = port; | ||||
} | } | ||||