diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
index 0b94bce61..8f8983f3e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
@@ -156,10 +156,8 @@ public class ANTLR extends Task {
public void setGlib(String superGrammar) {
String sg = null;
if (Os.isFamily("dos")) {
- sg = superGrammar.replace('\\','/');
- }
- else
- {
+ sg = superGrammar.replace('\\', '/');
+ } else {
sg = superGrammar;
}
setGlib(fileUtils.resolveFile(getProject().getBaseDir(), sg));
@@ -304,8 +302,8 @@ public class ANTLR extends Task {
File generatedFile = getGeneratedFile();
boolean targetIsOutOfDate =
target.lastModified() > generatedFile.lastModified();
- boolean superGrammarIsOutOfDate = superGrammar != null &&
- (superGrammar.lastModified() > generatedFile.lastModified());
+ boolean superGrammarIsOutOfDate = superGrammar != null
+ && (superGrammar.lastModified() > generatedFile.lastModified());
if (targetIsOutOfDate || superGrammarIsOutOfDate) {
if (targetIsOutOfDate) {
log("Compiling " + target + " as it is newer than "
@@ -431,6 +429,7 @@ public class ANTLR extends Task {
try {
bos.close();
} catch (IOException e) {
+ // ignore
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
index 15e076989..7720b4846 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
@@ -144,7 +144,7 @@ public class Cab extends MatchingTask {
protected void checkConfiguration() throws BuildException {
if (baseDir == null && filesets.size() == 0) {
throw new BuildException("basedir attribute or at least one "
- + "nested filest is required!",
+ + "nested filest is required!",
getLocation());
}
if (baseDir != null && !baseDir.exists()) {
@@ -266,7 +266,7 @@ public class Cab extends MatchingTask {
try {
Process p = Execute.launch(getProject(),
new String[] {"listcab"}, null,
- baseDir != null ? baseDir
+ baseDir != null ? baseDir
: getProject().getBaseDir(),
true);
OutputStream out = p.getOutputStream();
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
index f9243eb27..8dcd25b87 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
@@ -164,7 +164,7 @@ public class EchoProperties extends Task {
*
* @param file the input file
*/
- public void setSrcfile( File file ) {
+ public void setSrcfile(File file) {
inFile = file;
}
@@ -260,16 +260,16 @@ public class EchoProperties extends Task {
if (inFile.exists() && !inFile.canRead()) {
String message = "Can not read from the specified srcfile!";
if (failonerror) {
- throw new BuildException( message, getLocation() );
+ throw new BuildException(message, getLocation());
} else {
- log( message, Project.MSG_ERR );
+ log(message, Project.MSG_ERR);
}
return;
}
FileInputStream in = null;
try {
- in = new FileInputStream( inFile );
+ in = new FileInputStream(inFile);
Properties props = new Properties();
props.load(in);
CollectionUtils.putAll(allProps, props);
@@ -279,21 +279,21 @@ public class EchoProperties extends Task {
if (failonerror) {
throw new BuildException(message, fnfe, getLocation());
} else {
- log( message, Project.MSG_WARN );
+ log(message, Project.MSG_WARN);
}
return;
- } catch( IOException ioe ) {
+ } catch(IOException ioe) {
String message =
"Could not read file " + inFile.getAbsolutePath();
if (failonerror) {
throw new BuildException(message, ioe, getLocation());
} else {
- log( message, Project.MSG_WARN );
+ log(message, Project.MSG_WARN);
}
return;
} finally {
try {
- if( null != in ) {
+ if(null != in) {
in.close();
}
} catch(IOException ioe) {}
@@ -305,7 +305,7 @@ public class EchoProperties extends Task {
PropertySet ps = (PropertySet) enum.nextElement();
CollectionUtils.putAll(allProps, ps.getProperties());
}
-
+
OutputStream os = null;
try {
if (destfile == null) {
@@ -376,7 +376,7 @@ public class EchoProperties extends Task {
if ("text".equals(format)) {
jdkSaveProperties(props, os, "Ant properties");
} else if ("xml".equals(format)) {
- xmlSaveProperties(props, os );
+ xmlSaveProperties(props, os);
}
}
@@ -384,29 +384,29 @@ public class EchoProperties extends Task {
OutputStream os) throws IOException {
// create XML document
Document doc = getDocumentBuilder().newDocument();
- Element rootElement = doc.createElement( PROPERTIES );
+ Element rootElement = doc.createElement(PROPERTIES);
// output properties
String name;
Enumeration e = props.propertyNames();
- while( e.hasMoreElements() ) {
+ while(e.hasMoreElements()) {
name = (String)e.nextElement();
- Element propElement = doc.createElement( PROPERTY );
- propElement.setAttribute( ATTR_NAME, name );
- propElement.setAttribute( ATTR_VALUE, props.getProperty( name ) );
- rootElement.appendChild( propElement );
+ Element propElement = doc.createElement(PROPERTY);
+ propElement.setAttribute(ATTR_NAME, name);
+ propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
+ rootElement.appendChild(propElement);
}
Writer wri = null;
try {
- wri = new OutputStreamWriter( os, "UTF8" );
- wri.write( "" );
- ( new DOMElementWriter() ).write( rootElement, wri, 0, "\t" );
+ wri = new OutputStreamWriter(os, "UTF8");
+ wri.write("");
+ (new DOMElementWriter()).write(rootElement, wri, 0, "\t");
wri.flush();
- } catch( IOException ioe ) {
- throw new BuildException( "Unable to write XML file", ioe );
+ } catch(IOException ioe) {
+ throw new BuildException("Unable to write XML file", ioe);
} finally {
- if( wri != null ) {
+ if(wri != null) {
wri.close();
}
}
@@ -414,11 +414,11 @@ public class EchoProperties extends Task {
/**
* JDK 1.2 allows for the safer method
- * Properties.store( OutputStream, String ), which throws an
+ * Properties.store(OutputStream, String), which throws an
* IOException on an output error. This method attempts to
* use the JDK 1.2 method first, and if that does not exist, then the
* JDK 1.0 compatible method
- * Properties.save( OutputStream, String ) is used instead.
+ * Properties.save(OutputStream, String) is used instead.
*
*@param props the properties to record
*@param os record the properties to this output stream
@@ -476,8 +476,8 @@ public class EchoProperties extends Task {
private static DocumentBuilder getDocumentBuilder() {
try {
return DocumentBuilderFactory.newInstance().newDocumentBuilder();
- } catch( Exception e ) {
- throw new ExceptionInInitializerError( e );
+ } catch(Exception e) {
+ throw new ExceptionInInitializerError(e);
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
index 2e1a13033..baced0bba 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
@@ -78,10 +78,13 @@ import org.apache.tools.ant.types.Reference;
/**
* Instruments Java classes with iContract DBC preprocessor.
*
- * The task can generate a properties file for iControl,
- * a graphical user interface that lets you turn on/off assertions. iControl generates a control file that you can refer to
+ * The task can generate a properties file for
+ * iControl,
+ * a graphical user interface that lets you turn on/off assertions.
+ * iControl generates a control file that you can refer to
* from this task using the controlfile attribute.
- * iContract is at http://www.reliable-systems.com/tools/
+ * iContract is at
+ * http://www.reliable-systems.com/tools/
*
error*,warning*,note*,info*,progress*,debug*
(comma separated) can be
- * used. Defaults to error*
error*,warning*,note*,info*,progress*,debug*
+ * (comma separated) can be used. Defaults to error*
false
false
false
.false
.
+ * string
.
*
@@ -490,11 +487,11 @@ public class PropertyFile extends Task {
String newValue = DEFAULT_STRING_VALUE;
String currentValue = getCurrentValue(oldValue);
-
+
if (currentValue == null) {
currentValue = DEFAULT_STRING_VALUE;
}
-
+
if (operation == Operation.EQUALS_OPER) {
newValue = currentValue;
} else if (operation == Operation.INCREMENT_OPER) {
@@ -502,7 +499,7 @@ public class PropertyFile extends Task {
}
this.newValue = newValue;
}
-
+
/**
* Check if parameter combinations can be supported
* @todo make sure the 'unit' attribute is only specified on date
@@ -511,11 +508,11 @@ public class PropertyFile extends Task {
private void checkParameters() throws BuildException {
if (type == Type.STRING_TYPE &&
operation == Operation.DECREMENT_OPER) {
- throw new BuildException("- is not suported for string "
+ throw new BuildException("- is not suported for string "
+ "properties (key:" + key + ")");
}
if (value == null && defaultValue == null) {
- throw new BuildException("\"value\" and/or \"default\" "
+ throw new BuildException("\"value\" and/or \"default\" "
+ "attribute must be specified (key:" + key + ")");
}
if (key == null) {
@@ -523,7 +520,7 @@ public class PropertyFile extends Task {
}
if (type == Type.STRING_TYPE &&
pattern != null) {
- throw new BuildException("pattern is not suported for string "
+ throw new BuildException("pattern is not suported for string "
+ "properties (key:" + key + ")");
}
}
@@ -532,13 +529,13 @@ public class PropertyFile extends Task {
String ret = null;
if (operation == Operation.EQUALS_OPER) {
// If only value is specified, the property is set to it
- // regardless of its previous value.
+ // regardless of its previous value.
if (value != null && defaultValue == null) {
ret = value;
}
-
+
// If only default is specified and the property previously
- // existed in the property file, it is unchanged.
+ // existed in the property file, it is unchanged.
if (value == null && defaultValue != null && oldValue != null) {
ret = oldValue;
}
@@ -548,7 +545,7 @@ public class PropertyFile extends Task {
if (value == null && defaultValue != null && oldValue == null) {
ret = defaultValue;
}
-
+
// If value and default are both specified and the property
// previously existed in the property file, the property
// is set to value.
@@ -558,17 +555,17 @@ public class PropertyFile extends Task {
// If value and default are both specified and the property
// did not exist in the property file, the property is set
- // to default.
+ // to default.
if (value != null && defaultValue != null && oldValue == null) {
ret = defaultValue;
}
} else {
ret = (oldValue == null) ? defaultValue : oldValue;
}
-
+
return ret;
}
-
+
/**
* Enumerated attribute with the values "+", "-", "="
*/
@@ -617,7 +614,7 @@ public class PropertyFile extends Task {
}
}
}
-
+
/**
* Borrowed from Tstamp
* @todo share all this time stuff across many tasks as a datetime datatype
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
index 3ae29383c..41512d4c9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
@@ -103,7 +103,7 @@ public class RenameExtensions extends MatchingTask {
fromExtension = from;
}
- /**
+ /**
* The string that renamed files will end with on
* completion
*/
@@ -133,7 +133,7 @@ public class RenameExtensions extends MatchingTask {
// first off, make sure that we've got a from and to extension
if (fromExtension == null || toExtension == null || srcDir == null) {
- throw new BuildException("srcDir, fromExtension and toExtension "
+ throw new BuildException("srcDir, fromExtension and toExtension "
+ "attributes must be set!");
}
@@ -147,7 +147,7 @@ public class RenameExtensions extends MatchingTask {
log(" from=\"*" + fromExtension + "\"", Project.MSG_INFO);
log(" to=\"*" + toExtension + "\" />", Project.MSG_INFO);
log("", Project.MSG_INFO);
- log("using the same patterns on It is basically a wrapper for the jlink code written originally * by Patrick Beard. The @@ -154,11 +154,11 @@ public class JlinkTask extends MatchingTask { public void execute() throws BuildException { //Be sure everything has been set. if (outfile == null) { - throw new BuildException("outfile attribute is required! " + throw new BuildException("outfile attribute is required! " + "Please set."); } if (!haveAddFiles() && !haveMergeFiles()) { - throw new BuildException("addfiles or mergefiles required! " + throw new BuildException("addfiles or mergefiles required! " + "Please set."); } log("linking: " + outfile.getPath()); @@ -181,19 +181,19 @@ public class JlinkTask extends MatchingTask { } } - private boolean haveAddFiles(){ + private boolean haveAddFiles() { return haveEntries(addfiles); } - private boolean haveMergeFiles(){ + private boolean haveMergeFiles() { return haveEntries(mergefiles); } - private boolean haveEntries(Path p){ - if (p == null){ + private boolean haveEntries(Path p) { + if (p == null) { return false; } - if (p.size() > 0){ + if (p.size() > 0) { return true; } return false; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index 0aac86e37..0cb5e6ef5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -164,7 +164,7 @@ public class JspC extends MatchingTask { src.append(srcDir); } } - public Path getSrcDir(){ + public Path getSrcDir() { return src; } @@ -175,28 +175,28 @@ public class JspC extends MatchingTask { public void setDestdir(File destDir) { this.destDir = destDir; } - public File getDestdir(){ + public File getDestdir() { return destDir; } /** * Set the name of the package the compiled jsp files should be in. */ - public void setPackage(String pkg){ + public void setPackage(String pkg) { this.packageName = pkg; } - public String getPackage(){ + public String getPackage() { return packageName; } /** * Set the verbose level of the compiler */ - public void setVerbose(int i){ + public void setVerbose(int i) { verbose = i; } - public int getVerbose(){ + public int getVerbose() { return verbose; } @@ -298,7 +298,7 @@ public class JspC extends MatchingTask { public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } - public Path getClasspath(){ + public Path getClasspath() { return classpath; } @@ -316,7 +316,7 @@ public class JspC extends MatchingTask { /** * get the classpath used to find the compiler adapter */ - public Path getCompilerclasspath(){ + public Path getCompilerclasspath() { return compilerClasspath; } @@ -389,7 +389,7 @@ public class JspC extends MatchingTask { /** * get the list of files to compile */ - public Vector getCompileList(){ + public Vector getCompileList() { return compileList; } @@ -430,7 +430,7 @@ public class JspC extends MatchingTask { if (src == null) { throw new BuildException("srcdir attribute must be set!", getLocation()); - } + } String [] list = src.list(); if (list.length == 0) { throw new BuildException("srcdir attribute must be set!", diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index 822206e14..8951b99f4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -132,9 +132,9 @@ public class JasperC extends DefaultJspCompilerAdapter { getJspc().deleteEmptyJavaFiles(); } } - - + + /** * build up a command line * @return a command line for jasper @@ -149,12 +149,12 @@ public class JasperC extends DefaultJspCompilerAdapter { addArg(cmd, "-uribase", jspc.getUribase()); addArg(cmd, "-ieplugin", jspc.getIeplugin()); addArg(cmd, "-webinc", jspc.getWebinc()); - addArg(cmd, "-webxml", jspc.getWebxml()); + addArg(cmd, "-webxml", jspc.getWebxml()); addArg(cmd, "-die9"); - if (jspc.isMapped()){ + if (jspc.isMapped()) { addArg(cmd, "-mapped"); - } + } if (jspc.getWebApp() != null) { File dir = jspc.getWebApp().getDirectory(); addArg(cmd, "-webapp", dir); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 7d1651434..c52ef41d2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -84,7 +84,7 @@ public class AggregateTransformer { public static final String NOFRAMES = "noframes"; public static class Format extends EnumeratedAttribute { - public String[] getValues(){ + public String[] getValues() { return new String[]{FRAMES, NOFRAMES}; } } @@ -106,16 +106,16 @@ public class AggregateTransformer { /** XML Parser factory */ private static DocumentBuilderFactory privateDBFactory; - + /** XML Parser factory accessible to subclasses */ protected static DocumentBuilderFactory dbfactory; - + static { privateDBFactory = DocumentBuilderFactory.newInstance(); dbfactory = privateDBFactory; } - public AggregateTransformer(Task task){ + public AggregateTransformer(Task task) { this.task = task; } @@ -127,12 +127,12 @@ public class AggregateTransformer { protected static DocumentBuilderFactory getDocumentBuilderFactory() { return privateDBFactory; } - - public void setFormat(Format format){ + + public void setFormat(Format format) { this.format = format.getValue(); } - public void setXmlDocument(Document doc){ + public void setXmlDocument(Document doc) { this.document = doc; } @@ -151,7 +151,7 @@ public class AggregateTransformer { } finally { in.close(); } - } catch (Exception e){ + } catch (Exception e) { throw new BuildException("Error while parsing document: " + xmlfile, e); } } @@ -162,17 +162,17 @@ public class AggregateTransformer { * @param styledir the directory containing the xsl files if the user * would like to override with its own style. */ - public void setStyledir(File styledir){ + public void setStyledir(File styledir) { this.styleDir = styledir; } /** set the destination directory */ - public void setTodir(File todir){ + public void setTodir(File todir) { this.toDir = todir; } /** set the extension of the output files */ - public void setExtension(String ext){ + public void setExtension(String ext) { task.log("extension is not used anymore", Project.MSG_WARN); } @@ -182,7 +182,7 @@ public class AggregateTransformer { XalanExecutor executor = XalanExecutor.newInstance(this); try { executor.execute(); - } catch (Exception e){ + } catch (Exception e) { throw new BuildException("Errors while applying transformations: " + e.getMessage(), e); } @@ -210,18 +210,18 @@ public class AggregateTransformer { */ protected String getStylesheetSystemId() throws IOException { String xslname = "junit-frames.xsl"; - if (NOFRAMES.equals(format)){ + if (NOFRAMES.equals(format)) { xslname = "junit-noframes.xsl"; } - if (styleDir == null){ + if (styleDir == null) { URL url = getClass().getResource("xsl/" + xslname); - if (url == null){ + if (url == null) { throw new FileNotFoundException("Could not find jar resource " + xslname); } return url.toExternalForm(); } File file = new File(styleDir, xslname); - if (!file.exists()){ + if (!file.exists()) { throw new FileNotFoundException("Could not find file '" + file + "'"); } return JAXPUtils.getSystemId(file); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java index a476ce06b..a9c645cb3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java @@ -60,7 +60,7 @@ import java.util.Vector; /** * Baseclass for BatchTest and JUnitTest. * - * @author Stefan Bodewig + * @author Stefan Bodewig * @author Stephane Bailliez */ public abstract class BaseTest { @@ -84,7 +84,7 @@ public abstract class BaseTest { public boolean getFiltertrace() { return filtertrace; } - + public void setFork(boolean value) { fork = value; } @@ -125,15 +125,15 @@ public abstract class BaseTest { * Sets the destination directory. */ public void setTodir(File destDir) { - this.destDir = destDir; + this.destDir = destDir; } /** * @return the destination directory as an absolute path if it exists * otherwise return null */ - public String getTodir(){ - if (destDir != null){ + public String getTodir() { + if (destDir != null) { return destDir.getAbsolutePath(); } return null; @@ -142,15 +142,15 @@ public abstract class BaseTest { public java.lang.String getFailureProperty() { return failureProperty; } - + public void setFailureProperty(String failureProperty) { this.failureProperty = failureProperty; } - + public java.lang.String getErrorProperty() { return errorProperty; } - + public void setErrorProperty(String errorProperty) { this.errorProperty = errorProperty; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java index 461114148..7d77ecb9e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java @@ -65,8 +65,8 @@ import org.apache.tools.ant.types.FileSet; /** *
Create then run JUnitTest
's based on the list of files given by the fileset attribute.
*
- *
Every .java
or .class
file in the fileset is
- * assumed to be a testcase.
+ *
Every .java
or .class
file in the fileset is
+ * assumed to be a testcase.
* A JUnitTest
is created for each of these named classes with basic setup
* inherited from the parent BatchTest
.
*
@@ -88,7 +88,7 @@ public final class BatchTest extends BaseTest {
* create a new batchtest instance
* @param project the project it depends on.
*/
- public BatchTest(Project project){
+ public BatchTest(Project project) {
this.project = project;
}
@@ -107,7 +107,7 @@ public final class BatchTest extends BaseTest {
* @return an enumeration of all elements of this batchtest that are
* a JUnitTest instance.
*/
- public final Enumeration elements(){
+ public final Enumeration elements() {
JUnitTest[] tests = createAllJUnitTest();
return Enumerations.fromArray(tests);
}
@@ -118,7 +118,7 @@ public final class BatchTest extends BaseTest {
* @param v the vector to which should be added all individual tests of this
* batch test.
*/
- final void addTestsTo(Vector v){
+ final void addTestsTo(Vector v) {
JUnitTest[] tests = createAllJUnitTest();
v.ensureCapacity(v.size() + tests.length);
for (int i = 0; i < tests.length; i++) {
@@ -131,7 +131,7 @@ public final class BatchTest extends BaseTest {
* is configured to match this instance properties.
* @return the array of all JUnitTests that belongs to this batch.
*/
- private JUnitTest[] createAllJUnitTest(){
+ private JUnitTest[] createAllJUnitTest() {
String[] filenames = getFilenames();
JUnitTest[] tests = new JUnitTest[filenames.length];
for (int i = 0; i < tests.length; i++) {
@@ -151,7 +151,7 @@ public final class BatchTest extends BaseTest {
* qualified class name (If it is not the case it will fail when running the test).
* For the class org/apache/Whatever.class it will return org/apache/Whatever.
*/
- private String[] getFilenames(){
+ private String[] getFilenames() {
Vector v = new Vector();
final int size = this.filesets.size();
for (int j = 0; j < size; j++) {
@@ -181,7 +181,7 @@ public final class BatchTest extends BaseTest {
* @param filename the filename to "convert" to a classname.
* @return the classname matching the filename.
*/
- public static final String javaToClass(String filename){
+ public static final String javaToClass(String filename) {
return filename.replace(File.separatorChar, '.');
}
@@ -192,7 +192,7 @@ public final class BatchTest extends BaseTest {
* JUnitTest. It must be a fully qualified name.
* @return the JUnitTest over the given classname.
*/
- private JUnitTest createJUnitTest(String classname){
+ private JUnitTest createJUnitTest(String classname) {
JUnitTest test = new JUnitTest();
test.setName(classname);
test.setHaltonerror(this.haltOnError);
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
index b9b37e98d..01e776fec 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
@@ -74,7 +74,7 @@ import org.w3c.dom.Text;
public final class DOMUtil {
/** unused constructor */
- private DOMUtil(){
+ private DOMUtil() {
}
/**
@@ -98,7 +98,7 @@ public final class DOMUtil {
* @param recurse true if you want the list to be made recursively
* otherwise false.
*/
- public static NodeList listChildNodes(Node parent, NodeFilter filter, boolean recurse){
+ public static NodeList listChildNodes(Node parent, NodeFilter filter, boolean recurse) {
NodeListImpl matches = new NodeListImpl();
NodeList children = parent.getChildNodes();
if (children != null) {
@@ -122,13 +122,13 @@ public final class DOMUtil {
/** custom implementation of a nodelist */
public static class NodeListImpl extends Vector implements NodeList {
- public int getLength(){
+ public int getLength() {
return size();
}
- public Node item(int i){
+ public Node item(int i) {
try {
return (Node) elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e){
+ } catch (ArrayIndexOutOfBoundsException e) {
return null; // conforming to NodeList interface
}
}
@@ -160,7 +160,7 @@ public final class DOMUtil {
* given name.
*/
public static Element getChildByTagName (Node parent, String tagname) {
- if (parent == null){
+ if (parent == null) {
return null;
}
NodeList childList = parent.getChildNodes();
@@ -187,7 +187,7 @@ public final class DOMUtil {
* appended to parent.
* @return the cloned node that is appended to parent
*/
- public static final Node importNode(Node parent, Node child){
+ public static final Node importNode(Node parent, Node child) {
Node copy = null;
final Document doc = parent.getOwnerDocument();
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java
index 2fb6070be..f75dc27a8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java
@@ -64,8 +64,8 @@ import java.util.NoSuchElementException;
* @author Stephane Bailliez
*/
public final class Enumerations {
-
- private Enumerations(){
+
+ private Enumerations() {
}
/**
@@ -73,7 +73,7 @@ public final class Enumerations {
* @param array the array of object to enumerate.
* @return the enumeration over the array of objects.
*/
- public static Enumeration fromArray(Object[] array){
+ public static Enumeration fromArray(Object[] array) {
return new ArrayEnumeration(array);
}
@@ -84,7 +84,7 @@ public final class Enumerations {
* @param enums the array of enumerations.
* @return the enumeration over the array of enumerations.
*/
- public static Enumeration fromCompound(Enumeration[] enums){
+ public static Enumeration fromCompound(Enumeration[] enums) {
return new CompoundEnumeration(enums);
}
@@ -96,18 +96,18 @@ public final class Enumerations {
* @author Stephane Bailliez
*/
class ArrayEnumeration implements Enumeration {
-
+
/** object array */
private Object[] array;
-
+
/** current index */
private int pos;
-
+
/**
* Initialize a new enumeration that wraps an array.
* @param array the array of object to enumerate.
*/
- public ArrayEnumeration(Object[] array){
+ public ArrayEnumeration(Object[] array) {
this.array = array;
this.pos = 0;
}
@@ -142,11 +142,11 @@ class ArrayEnumeration implements Enumeration {
* Convenient enumeration over an array of enumeration. For example:
*
* Enumeration e1 = v1.elements(); - * while (e1.hasMoreElements()){ + * while (e1.hasMoreElements()) { * // do something * } * Enumeration e2 = v2.elements(); - * while (e2.hasMoreElements()){ + * while (e2.hasMoreElements()) { * // do the same thing * } *@@ -154,7 +154,7 @@ class ArrayEnumeration implements Enumeration { *
* Enumeration[] enums = { v1.elements(), v2.elements() }; * Enumeration e = Enumerations.fromCompound(enums); - * while (e.hasMoreElements()){ + * while (e.hasMoreElements()) { * // do something * } *@@ -163,17 +163,17 @@ class ArrayEnumeration implements Enumeration { *
* Enumeration[] enums = { v1.elements(), null, v2.elements() }; // a null enumeration in the array * Enumeration e = Enumerations.fromCompound(enums); - * while (e.hasMoreElements()){ + * while (e.hasMoreElements()) { * // do something * } ** @author Stephane Bailliez */ class CompoundEnumeration implements Enumeration { - + /** enumeration array */ private Enumeration[] enumArray; - + /** index in the enums array */ private int index = 0; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 4aa8aaffe..286bbfc07 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -911,7 +911,7 @@ public class JUnitTask extends Task { * @since Ant 1.2 */ protected ExecuteWatchdog createWatchdog() throws BuildException { - if (timeout == null){ + if (timeout == null) { return null; } return new ExecuteWatchdog(timeout.intValue()); @@ -922,7 +922,7 @@ public class JUnitTask extends Task { * * @since Ant 1.3 */ - protected OutputStream getDefaultOutput(){ + protected OutputStream getDefaultOutput() { return new LogOutputStream(this, Project.MSG_INFO); } @@ -932,7 +932,7 @@ public class JUnitTask extends Task { * * @since Ant 1.3 */ - protected Enumeration getIndividualTests(){ + protected Enumeration getIndividualTests() { final int count = batchTests.size(); final Enumeration[] enums = new Enumeration[ count + 1]; for (int i = 0; i < count; i++) { @@ -954,7 +954,7 @@ public class JUnitTask extends Task { /** * @since Ant 1.3 */ - private FormatterElement[] mergeFormatters(JUnitTest test){ + private FormatterElement[] mergeFormatters(JUnitTest test) { Vector feVector = (Vector) formatters.clone(); test.addFormattersTo(feVector); FormatterElement[] feArray = new FormatterElement[feVector.size()]; @@ -968,7 +968,7 @@ public class JUnitTask extends Task { * * @since Ant 1.3 */ - protected File getOutput(FormatterElement fe, JUnitTest test){ + protected File getOutput(FormatterElement fe, JUnitTest test) { if (fe.getUseFile()) { String filename = test.getOutfile() + fe.getExtension(); File destFile = new File(test.getTodir(), filename); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java index 927085e0e..1b8b7de44 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java @@ -76,10 +76,10 @@ import org.apache.tools.ant.Project; * @see JUnitTestRunner */ public class JUnitTest extends BaseTest implements Cloneable { - + /** the name of the test case */ private String name = null; - + /** the name of the result file */ private String outfile = null; @@ -99,7 +99,7 @@ public class JUnitTest extends BaseTest implements Cloneable { this.name = name; } - public JUnitTest(String name, boolean haltOnError, boolean haltOnFailure, + public JUnitTest(String name, boolean haltOnError, boolean haltOnFailure, boolean filtertrace) { this.name = name; this.haltOnError = haltOnError; @@ -107,7 +107,7 @@ public class JUnitTest extends BaseTest implements Cloneable { this.filtertrace = filtertrace; } - /** + /** * Set the name of the test class. */ public void setName(String value) { @@ -121,7 +121,7 @@ public class JUnitTest extends BaseTest implements Cloneable { outfile = value; } - /** + /** * Get the name of the test class. */ public String getName() { @@ -130,7 +130,7 @@ public class JUnitTest extends BaseTest implements Cloneable { /** * Get the name of the output file - * + * * @return the name of the output file. */ public String getOutfile() { @@ -150,15 +150,15 @@ public class JUnitTest extends BaseTest implements Cloneable { public long runCount() { return runs; } - + public long failureCount() { return failures; } - + public long errorCount() { return errors; } - + public long getRunTime() { return runTime; } @@ -166,9 +166,9 @@ public class JUnitTest extends BaseTest implements Cloneable { public Properties getProperties() { return props; } - - public void setProperties(Hashtable p) { - props = new Properties(); + + public void setProperties(Hashtable p) { + props = new Properties(); for (Enumeration enum = p.keys(); enum.hasMoreElements();) { Object key = enum.nextElement(); props.put(key, p.get(key)); @@ -178,7 +178,7 @@ public class JUnitTest extends BaseTest implements Cloneable { public boolean shouldRun(Project p) { if (ifProperty != null && p.getProperty(ifProperty) == null) { return false; - } else if (unlessProperty != null && + } else if (unlessProperty != null && p.getProperty(unlessProperty) != null) { return false; } @@ -195,9 +195,9 @@ public class JUnitTest extends BaseTest implements Cloneable { /** * Convenient method to add formatters to a vector */ - void addFormattersTo(Vector v){ + void addFormattersTo(Vector v) { final int count = formatters.size(); - for (int i = 0; i < count; i++){ + for (int i = 0; i < count; i++) { v.addElement(formatters.elementAt(i)); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java index 8131049d8..f6ed995f3 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java @@ -247,7 +247,7 @@ public class JUnitTestRunner implements TestListener { // know exactly what is the cause, but we're doing exactly // the same as JUnit TestRunner do. We swallow the exceptions. } - if (suiteMethod != null){ + if (suiteMethod != null) { // if there is a suite method available, then try // to extract the suite from it. If there is an error // here it will be caught below and reported. diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java index 08c16028e..517c9cbf9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java @@ -114,7 +114,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { /** * Generate a report based on the document created by the merge. */ - public AggregateTransformer createReport(){ + public AggregateTransformer createReport() { AggregateTransformer transformer = new AggregateTransformer(this); transformers.addElement(transformer); return transformer; @@ -126,7 +126,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { * @param value the name of the file. * @see #setTodir(File) */ - public void setTofile(String value){ + public void setTofile(String value) { toFile = value; } @@ -137,7 +137,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { * @param value the directory where to write the results, absolute or * relative. */ - public void setTodir(File value){ + public void setTodir(File value) { toDir = value; } @@ -161,7 +161,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { // write the document try { writeDOMTree(rootElement.getOwnerDocument(), destFile); - } catch (IOException e){ + } catch (IOException e) { throw new BuildException("Unable to write test aggregate to '" + destFile + "'", e); } // apply transformation @@ -179,11 +179,11 @@ public class XMLResultAggregator extends Task implements XMLConstants { * the todir and tofile attributes. * @return the destination file where should be written the result file. */ - protected File getDestinationFile(){ - if (toFile == null){ + protected File getDestinationFile() { + if (toFile == null) { toFile = DEFAULT_FILENAME; } - if (toDir == null){ + if (toDir == null) { toDir = getProject().resolveFile(DEFAULT_DIR); } return new File(toDir, toFile); @@ -235,7 +235,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { (new DOMElementWriter()).write(doc.getDocumentElement(), wri, 0, " "); wri.flush(); // writers do not throw exceptions, so check for them. - if (wri.checkError()){ + if (wri.checkError()) { throw new IOException("Error while writing DOM content"); } } finally { @@ -270,7 +270,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { //XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object // will investigate later. It does not use the given directory but // the vm dir instead ? Works fine with crimson. - Document testsuiteDoc + Document testsuiteDoc = builder.parse("file:///" + files[i].getAbsolutePath()); Element elem = testsuiteDoc.getDocumentElement(); // make sure that this is REALLY a testsuite. @@ -280,12 +280,12 @@ public class XMLResultAggregator extends Task implements XMLConstants { // issue a warning. log("the file " + files[i] + " is not a valid testsuite XML document", Project.MSG_WARN); } - } catch (SAXException e){ + } catch (SAXException e) { // a testcase might have failed and write a zero-length document, // It has already failed, but hey.... mm. just put a warning log("The file " + files[i] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN); log(StringUtils.getStackTrace(e), Project.MSG_DEBUG); - } catch (IOException e){ + } catch (IOException e) { log("Error while accessing file " + files[i] + ": " + e.getMessage(), Project.MSG_ERR); } } @@ -304,7 +304,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { * modify the original node to change the name attribute and add * a package one. */ - protected void addTestSuite(Element root, Element testsuite){ + protected void addTestSuite(Element root, Element testsuite) { String fullclassname = testsuite.getAttribute(ATTR_NAME); int pos = fullclassname.lastIndexOf('.'); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java index c2a7d5d0f..c58b7f515 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java @@ -76,13 +76,13 @@ abstract class XalanExecutor { protected AggregateTransformer caller; /** set the caller for this object. */ - private final void setCaller(AggregateTransformer caller){ + private final void setCaller(AggregateTransformer caller) { this.caller = caller; } /** get the appropriate stream based on the format (frames/noframes) */ protected OutputStream getOutputStream() throws IOException { - if (AggregateTransformer.FRAMES.equals(caller.format)){ + if (AggregateTransformer.FRAMES.equals(caller.format)) { // dummy output for the framed report // it's all done by extension... return new ByteArrayOutputStream(); @@ -109,7 +109,7 @@ abstract class XalanExecutor { procVersion = Class.forName("org.apache.xalan.processor.XSLProcessorVersion"); executor = (XalanExecutor) Class.forName( "org.apache.tools.ant.taskdefs.optional.junit.Xalan2Executor").newInstance(); - } catch (Exception xalan2missing){ + } catch (Exception xalan2missing) { StringWriter swr = new StringWriter(); xalan2missing.printStackTrace(new PrintWriter(swr)); caller.task.log("Didn't find Xalan2.", Project.MSG_DEBUG); @@ -118,7 +118,7 @@ abstract class XalanExecutor { procVersion = Class.forName("org.apache.xalan.xslt.XSLProcessorVersion"); executor = (XalanExecutor) Class.forName( "org.apache.tools.ant.taskdefs.optional.junit.Xalan1Executor").newInstance(); - } catch (Exception xalan1missing){ + } catch (Exception xalan1missing) { swr = new StringWriter(); xalan1missing.printStackTrace(new PrintWriter(swr)); caller.task.log("Didn't find Xalan1.", Project.MSG_DEBUG); @@ -137,7 +137,7 @@ abstract class XalanExecutor { try { Field f = procVersion.getField("S_VERSION"); return f.get(null).toString(); - } catch (Exception e){ + } catch (Exception e) { return "?"; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java index 744cd8851..bf7bb2641 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java @@ -70,7 +70,7 @@ import org.apache.tools.ant.types.Path; *
* maudit performs static analysis of the Java source code and byte code files to find and report
* errors of style and potential problems related to performance, maintenance and robustness.
- * As a convenience, a stylesheet is given in etc directory, so that an HTML report
+ * As a convenience, a stylesheet is given in etc directory, so that an HTML report
* can be generated from the XML file.
*
* @author Stephane Bailliez
@@ -135,16 +135,16 @@ public class MAudit extends AbstractMetamataTask {
super("com.metamata.gui.rc.MAudit");
}
- /**
+ /**
* The XML file to which the Audit result should be written to; required
*/
-
+
public void setTofile(File outFile) {
this.outFile = outFile;
}
/**
- * Automatically fix certain errors
+ * Automatically fix certain errors
* (those marked as fixable in the manual);
* optional, default=false
*/
@@ -153,7 +153,7 @@ public class MAudit extends AbstractMetamataTask {
}
/**
- * Creates listing file for each audited file; optional, default false.
+ * Creates listing file for each audited file; optional, default false.
* When set, a .maudit file will be generated in the
* same location as the source file.
*/
@@ -162,9 +162,9 @@ public class MAudit extends AbstractMetamataTask {
}
/**
- * Finds declarations unused in search paths; optional, default false.
+ * Finds declarations unused in search paths; optional, default false.
* It will look for unused global declarations
- * in the source code within a use domain specified by the
+ * in the source code within a use domain specified by the
* searchpath element.
*/
public void setUnused(boolean flag) {
@@ -181,7 +181,7 @@ public class MAudit extends AbstractMetamataTask {
}
/**
- * flag to tell the task to exit after the first error.
+ * flag to tell the task to exit after the first error.
* internal/testing only
* @ant.attribute ignore="true"
*/
@@ -214,9 +214,9 @@ public class MAudit extends AbstractMetamataTask {
this.fullsemanticize = flag;
}
- /**
+ /**
* classpath for additional audit rules
- * these must be placed before metamata.jar !!
+ * these must be placed before metamata.jar !!
*/
public Path createRulespath() {
if (rulesPath == null) {
@@ -225,9 +225,9 @@ public class MAudit extends AbstractMetamataTask {
return rulesPath;
}
- /**
- * search path to use for unused global declarations;
- * required when unused is set.
+ /**
+ * search path to use for unused global declarations;
+ * required when unused is set.
*/
public Path createSearchpath() {
if (searchPath == null) {
@@ -333,10 +333,10 @@ public class MAudit extends AbstractMetamataTask {
} catch (IOException e) {
throw new BuildException(e);
} finally {
- if (out == null){
+ if (out == null) {
try {
out.close();
- } catch (IOException e){
+ } catch (IOException e) {
}
}
}
@@ -350,7 +350,7 @@ public class MAudit extends AbstractMetamataTask {
// the .maudit files match the .java files
// we'll use includedFiles to get the .maudit files.
- /*if (out != null){
+ /*if (out != null) {
// close it if not closed by the handler...
}*/
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditParser.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditParser.java
index d3a9e3cd1..f139d17ed 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditParser.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditParser.java
@@ -82,7 +82,7 @@ final class MAuditParser {
/** matcher that will be used to extract the info from the line */
private final RegexpMatcher matcher;
- MAuditParser(){
+ MAuditParser() {
/** the matcher should be the Oro one. I don't know about the other one */
matcher = (new RegexpMatcherFactory()).newRegexpMatcher();
matcher.setPattern(AUDIT_PATTERN);
@@ -95,9 +95,9 @@ final class MAuditParser {
* or null if it could not parse it. (might be a
* message info or copyright or summary).
*/
- Violation parseLine(String line){
+ Violation parseLine(String line) {
Vector matches = matcher.getGroups(line);
- if (matches == null){
+ if (matches == null) {
return null;
}
final String file = (String) matches.elementAt(1);
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java
index e7df2b214..ccb95dd58 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java
@@ -205,7 +205,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler {
DOMElementWriter domWriter = new DOMElementWriter();
try {
domWriter.write(rootElement, xmlOut);
- } catch (IOException e){
+ } catch (IOException e) {
throw new BuildException(e);
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
index 3d2c0fe2a..5dd77f5a7 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
@@ -413,7 +413,7 @@ class MetricsElement {
while ((pos = line.indexOf('\t')) != -1) {
String token = line.substring(0, pos);
// only parse what coudl be a valid number. ie not constructs nor no value
- /*if (metrics.size() != 0 || token.length() != 0){
+ /*if (metrics.size() != 0 || token.length() != 0) {
Number num = METAMATA_NF.parse(token); // parse with Metamata NF
token = NEUTRAL_NF.format(num.doubleValue()); // and format with a neutral NF
}*/
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
index 3e72b8590..8731cbe2d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
@@ -93,17 +93,17 @@ public class MParse extends AbstractMetamataTask {
}
/** set verbose mode */
- public void setVerbose(boolean flag){
+ public void setVerbose(boolean flag) {
verbose = flag;
}
/** set scanner debug mode; optional, default false */
- public void setDebugscanner(boolean flag){
+ public void setDebugscanner(boolean flag) {
debugscanner = flag;
}
/** set parser debug mode; optional, default false */
- public void setDebugparser(boolean flag){
+ public void setDebugparser(boolean flag) {
debugparser = flag;
}
@@ -132,7 +132,7 @@ public class MParse extends AbstractMetamataTask {
}
/** return the default stream handler for this task */
- protected ExecuteStreamHandler createStreamHandler(){
+ protected ExecuteStreamHandler createStreamHandler() {
return new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_INFO);
}
@@ -145,7 +145,7 @@ public class MParse extends AbstractMetamataTask {
// set the classpath as the jar files
File[] jars = getMetamataLibs();
final Path classPath = cmdl.createClasspath(getProject());
- for (int i = 0; i < jars.length; i++){
+ for (int i = 0; i < jars.length; i++) {
classPath.createPathElement().setLocation(jars[i]);
}
@@ -186,14 +186,14 @@ public class MParse extends AbstractMetamataTask {
if (process.execute() != 0) {
throw new BuildException("Metamata task failed.");
}
- } catch (IOException e){
+ } catch (IOException e) {
throw new BuildException("Failed to launch Metamata task: ", e);
}
}
/** clean up all the mess that we did with temporary objects */
- protected void cleanUp(){
- if (optionsFile != null){
+ protected void cleanUp() {
+ if (optionsFile != null) {
optionsFile.delete();
optionsFile = null;
}
@@ -216,7 +216,7 @@ public class MParse extends AbstractMetamataTask {
* forked process do it for you.
* @return array of jars/zips needed to run metamata.
*/
- protected File[] getMetamataLibs(){
+ protected File[] getMetamataLibs() {
Vector files = new Vector();
files.addElement(new File(metamataHome, "lib/metamata.jar"));
files.addElement(new File(metamataHome, "bin/lib/JavaCC.zip"));
@@ -233,15 +233,15 @@ public class MParse extends AbstractMetamataTask {
*/
protected void checkOptions() throws BuildException {
// check that the home is ok.
- if (metamataHome == null || !metamataHome.exists()){
+ if (metamataHome == null || !metamataHome.exists()) {
throw new BuildException("'metamatahome' must point to Metamata home directory.");
}
metamataHome = getProject().resolveFile(metamataHome.getPath());
// check that the needed jar exists.
File[] jars = getMetamataLibs();
- for (int i = 0; i < jars.length; i++){
- if (!jars[i].exists()){
+ for (int i = 0; i < jars.length; i++) {
+ if (!jars[i].exists()) {
throw new BuildException(jars[i]
+ " does not exist. Check your metamata installation.");
}
@@ -261,20 +261,20 @@ public class MParse extends AbstractMetamataTask {
*/
protected Vector getOptions() {
Vector options = new Vector();
- if (verbose){
+ if (verbose) {
options.addElement("-verbose");
}
- if (debugscanner){
+ if (debugscanner) {
options.addElement("-ds");
}
- if (debugparser){
+ if (debugparser) {
options.addElement("-dp");
}
- if (classPath != null){
+ if (classPath != null) {
options.addElement("-classpath");
options.addElement(classPath.toString());
}
- if (sourcePath != null){
+ if (sourcePath != null) {
options.addElement("-sourcepath");
options.addElement(sourcePath.toString());
}
@@ -294,17 +294,17 @@ public class MParse extends AbstractMetamataTask {
try {
fw = new FileWriter(tofile);
PrintWriter pw = new PrintWriter(fw);
- for (int i = 0; i < options.length; i++){
+ for (int i = 0; i < options.length; i++) {
pw.println(options[i]);
}
pw.flush();
- } catch (IOException e){
+ } catch (IOException e) {
throw new BuildException("Error while writing options file " + tofile, e);
} finally {
- if (fw != null){
+ if (fw != null) {
try {
fw.close();
- } catch (IOException ignored){}
+ } catch (IOException ignored) {}
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
index 5104b0232..799ac9f2d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
@@ -135,7 +135,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
try {
audioInputStream = AudioSystem.getAudioInputStream(file);
} catch (UnsupportedAudioFileException uafe) {
- project.log("Audio format is not yet supported: "
+ project.log("Audio format is not yet supported: "
+ uafe.getMessage());
} catch (IOException ioe) {
ioe.printStackTrace();
@@ -205,7 +205,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
/**
* Fired before any targets are started.
*/
- public void buildStarted(BuildEvent event){
+ public void buildStarted(BuildEvent event) {
}
/**
@@ -214,7 +214,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
*
* @see BuildEvent#getException()
*/
- public void buildFinished(BuildEvent event){
+ public void buildFinished(BuildEvent event) {
if (event.getException() == null && fileSuccess != null) {
// build successfull!
play(event.getProject(), fileSuccess, loopsSuccess, durationSuccess);
@@ -228,7 +228,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
*
* @see BuildEvent#getTarget()
*/
- public void targetStarted(BuildEvent event){
+ public void targetStarted(BuildEvent event) {
}
/**
@@ -237,7 +237,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
*
* @see BuildEvent#getException()
*/
- public void targetFinished(BuildEvent event){
+ public void targetFinished(BuildEvent event) {
}
/**
@@ -245,7 +245,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
*
* @see BuildEvent#getTask()
*/
- public void taskStarted(BuildEvent event){
+ public void taskStarted(BuildEvent event) {
}
/**
@@ -254,7 +254,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
*
* @see BuildEvent#getException()
*/
- public void taskFinished(BuildEvent event){
+ public void taskFinished(BuildEvent event) {
}
/**
@@ -263,7 +263,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
* @see BuildEvent#getMessage()
* @see BuildEvent#getPriority()
*/
- public void messageLogged(BuildEvent event){
+ public void messageLogged(BuildEvent event) {
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
index 768c34d2f..ed752fde3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
@@ -105,7 +105,7 @@ public class SoundTask extends Task {
public SoundTask() {
}
- public void init(){
+ public void init() {
}
public void execute() {
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
index b5ed20745..2166e63cd 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
@@ -82,13 +82,13 @@ class SplashScreen extends JWindow implements ActionListener, BuildListener {
init(null);
setText(msg);
}
-
+
public SplashScreen(ImageIcon img) {
init(img);
}
protected void init(ImageIcon img) {
-
+
JPanel pan = (JPanel) getContentPane();
JLabel piccy;
if (img == null) {
@@ -96,7 +96,7 @@ class SplashScreen extends JWindow implements ActionListener, BuildListener {
} else {
piccy = new JLabel(img);
}
-
+
piccy.setBorder(BorderFactory.createLineBorder(Color.black, 1));
text = new JLabel("Building....", JLabel.CENTER);
text.setFont(new Font("Sans-Serif", Font.BOLD, 12));
@@ -138,16 +138,16 @@ class SplashScreen extends JWindow implements ActionListener, BuildListener {
pb.setValue(total);
}
- public void buildStarted(BuildEvent event){ actionPerformed(null);}
- public void buildFinished(BuildEvent event){
+ public void buildStarted(BuildEvent event) { actionPerformed(null);}
+ public void buildFinished(BuildEvent event) {
pb.setValue(max);
setVisible(false);
dispose();
}
- public void targetStarted(BuildEvent event){actionPerformed(null);}
- public void targetFinished(BuildEvent event){actionPerformed(null);}
- public void taskStarted(BuildEvent event){actionPerformed(null);}
- public void taskFinished(BuildEvent event){actionPerformed(null);}
- public void messageLogged(BuildEvent event){actionPerformed(null);}
+ public void targetStarted(BuildEvent event) {actionPerformed(null);}
+ public void targetFinished(BuildEvent event) {actionPerformed(null);}
+ public void taskStarted(BuildEvent event) {actionPerformed(null);}
+ public void taskFinished(BuildEvent event) {actionPerformed(null);}
+ public void messageLogged(BuildEvent event) {actionPerformed(null);}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
index f3842c9c8..966988ec8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
@@ -64,13 +64,13 @@ import javax.swing.ImageIcon;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
-
+
/**
* Creates a splash screen. The splash screen is displayed
* for the duration of the build and includes a handy progress bar as
* well. Use in conjunction with the sound task to provide interest
* whilst waiting for your builds to complete...
- * @since Ant1.5
+ * @since Ant1.5
* @author Les Hughes (leslie.hughes@rubus.com)
*/
public class SplashTask extends Task {
@@ -92,10 +92,10 @@ public class SplashTask extends Task {
public void setImageURL(String imgurl) {
this.imgurl = imgurl;
}
-
+
/**
* flag to enable proxy settings; optional, deprecated : consider
- * using <setproxy> instead
+ * using <setproxy> instead
* @deprecated use org.apache.tools.ant.taskdefs.optional.SetProxy
*/
public void setUseproxy(boolean useProxy) {
@@ -105,31 +105,31 @@ public class SplashTask extends Task {
/**
* name of proxy; optional.
*/
- public void setProxy(String proxy){
+ public void setProxy(String proxy) {
this.proxy = proxy;
}
-
+
/**
- * Proxy port; optional, default 80.
+ * Proxy port; optional, default 80.
*/
- public void setPort(String port){
+ public void setPort(String port) {
this.port = port;
}
/**
- * Proxy user; optional, default =none.
+ * Proxy user; optional, default =none.
*/
- public void setUser(String user){
+ public void setUser(String user) {
this.user = user;
}
-
+
/**
* Proxy password; required if user is set.
*/
- public void setPassword(String password){
+ public void setPassword(String password) {
this.password = password;
}
-
+
/**
* how long to show the splash screen in milliseconds,
* optional; default 5000 ms.
@@ -137,7 +137,7 @@ public class SplashTask extends Task {
public void setShowduration(int duration) {
this.showDuration = duration;
}
-
+
public void execute() throws BuildException {
if (splash != null) {
@@ -146,33 +146,33 @@ public class SplashTask extends Task {
splash.dispose();
splash = null;
}
-
+
log("Creating new SplashScreen", Project.MSG_VERBOSE);
InputStream in = null;
if (imgurl != null) {
try {
URLConnection conn = null;
-
+
if (useProxy &&
(proxy != null && proxy.length() > 0) &&
(port != null && port.length() > 0)) {
-
+
log("Using proxied Connection", Project.MSG_DEBUG);
System.getProperties().put("http.proxySet", "true");
System.getProperties().put("http.proxyHost", proxy);
System.getProperties().put("http.proxyPort", port);
-
+
URL url = new URL(imgurl);
-
+
conn = url.openConnection();
if (user != null && user.length() > 0) {
- String encodedcreds =
+ String encodedcreds =
new sun.misc.BASE64Encoder().encode((new String(user + ":" + password)).getBytes());
- conn.setRequestProperty("Proxy-Authorization",
+ conn.setRequestProperty("Proxy-Authorization",
encodedcreds);
}
-
+
} else {
System.getProperties().put("http.proxySet", "false");
System.getProperties().put("http.proxyHost", "");
@@ -183,16 +183,16 @@ public class SplashTask extends Task {
}
conn.setDoInput(true);
conn.setDoOutput(false);
-
+
in = conn.getInputStream();
// Catch everything - some of the above return nulls, throw exceptions or generally misbehave
// in the event of a problem etc
-
+
} catch (Throwable ioe) {
- log("Unable to download image, trying default Ant Logo",
+ log("Unable to download image, trying default Ant Logo",
Project.MSG_DEBUG);
- log("(Exception was \"" + ioe.getMessage() + "\"",
+ log("(Exception was \"" + ioe.getMessage() + "\"",
Project.MSG_DEBUG);
}
}
@@ -210,10 +210,10 @@ public class SplashTask extends Task {
while ((data = din.read()) != -1) {
bout.write((byte) data);
}
-
+
log("Got ByteArray, creating splash", Project.MSG_DEBUG);
ImageIcon img = new ImageIcon(bout.toByteArray());
-
+
splash = new SplashScreen(img);
success = true;
} catch (Exception e) {
@@ -240,6 +240,6 @@ public class SplashTask extends Task {
Thread.currentThread().sleep(showDuration);
} catch (InterruptedException e) {
}
-
+
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
index 7a1907c2e..a5dac665e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
@@ -256,7 +256,7 @@ public class Symlink extends Task {
linksToStore.put(alink.getName(),
alink.getCanonicalPath());
} catch (IOException ioe) {
- handleError("Couldn't get canonical "
+ handleError("Couldn't get canonical "
+ "name of a parent link");
}
}
@@ -541,7 +541,7 @@ public class Symlink extends Task {
return;
}
if (link == null) {
- handleError("Must define the link "
+ handleError("Must define the link "
+ "name for symlink!");
return;
}
@@ -573,7 +573,7 @@ public class Symlink extends Task {
* Simultaneously get included directories and included files.
*
* @param ds The scanner with which to get the files and directories.
- * @return A vector of String
objects containing the
+ * @return A vector of String
objects containing the
* included file names and directory names.
*/
@@ -772,7 +772,7 @@ public class Symlink extends Task {
// loop through the files identified by each file set
// and load their contents.
- for (int j = 0; j < includedFiles.length; j++){
+ for (int j = 0; j < includedFiles.length; j++) {
File inc = new File(workingDir + File.separator
+ includedFiles[j]);
String inDir;
diff --git a/src/main/org/apache/tools/ant/types/optional/ScriptFilter.java b/src/main/org/apache/tools/ant/types/optional/ScriptFilter.java
index b68e166db..d690c6c54 100644
--- a/src/main/org/apache/tools/ant/types/optional/ScriptFilter.java
+++ b/src/main/org/apache/tools/ant/types/optional/ScriptFilter.java
@@ -73,10 +73,7 @@ import org.apache.tools.ant.BuildException;
* The script is meant to use get self.token and
* set self.token in the reply.
*/
-
-public class ScriptFilter
- extends TokenFilter.ChainableReaderFilter
-{
+public class ScriptFilter extends TokenFilter.ChainableReaderFilter {
/** The language - attribute of element */
private String language;
/** The script - inline text or external file */
@@ -132,12 +129,14 @@ public class ScriptFilter
* @exception BuildException if someting goes wrong
*/
private void init() throws BuildException {
- if (initialized)
+ if (initialized) {
return;
+ }
initialized = true;
- if (language == null)
+ if (language == null) {
throw new BuildException(
"scriptfilter: language is not defined");
+ }
try {
addBeans(getProject().getProperties());
@@ -151,14 +150,13 @@ public class ScriptFilter
manager = new BSFManager ();
- for (Enumeration e = beans.keys() ; e.hasMoreElements() ;) {
+ for (Enumeration e = beans.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
Object value = beans.get(key);
manager.declareBean(key, value, value.getClass());
}
- }
- catch (BSFException e) {
+ } catch (BSFException e) {
Throwable t = e;
Throwable te = e.getTargetException();
if (te != null) {