@@ -49,6 +49,7 @@ import org.apache.tools.ant.util.CollectionUtils; | |||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
import org.apache.tools.ant.util.LoaderUtils; | import org.apache.tools.ant.util.LoaderUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
import org.apache.tools.ant.util.VectorSet; | import org.apache.tools.ant.util.VectorSet; | ||||
import org.apache.tools.zip.ZipLong; | import org.apache.tools.zip.ZipLong; | ||||
@@ -405,6 +406,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
protected void log(final String message, final int priority) { | protected void log(final String message, final int priority) { | ||||
if (project != null) { | if (project != null) { | ||||
project.log(message, priority); | project.log(message, priority); | ||||
} else if (priority < Project.MSG_INFO) { | |||||
System.err.println(message); | |||||
} | } | ||||
} | } | ||||
@@ -1018,7 +1021,6 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
final String msg = "CLASSPATH element " + file | final String msg = "CLASSPATH element " + file | ||||
+ " is not a JAR."; | + " is not a JAR."; | ||||
log(msg, Project.MSG_WARN); | log(msg, Project.MSG_WARN); | ||||
System.err.println(msg); | |||||
return null; | return null; | ||||
} | } | ||||
jarFile = new JarFile(file); | jarFile = new JarFile(file); | ||||
@@ -1041,8 +1043,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
} catch (final Exception e) { | } catch (final Exception e) { | ||||
final String msg = "Unable to obtain resource from " + file + ": "; | final String msg = "Unable to obtain resource from " + file + ": "; | ||||
log(msg + e, Project.MSG_WARN); | log(msg + e, Project.MSG_WARN); | ||||
System.err.println(msg); | |||||
e.printStackTrace(); | |||||
log(StringUtils.getStackTrace(e), Project.MSG_WARN); | |||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
@@ -93,7 +93,7 @@ public class ArgumentProcessorRegistry { | |||||
+ SERVICE_ID + " (" + e.getClass().getName() + ": " | + SERVICE_ID + " (" + e.getClass().getName() + ": " | ||||
+ e.getMessage() + ")"); | + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); | |||||
e.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -971,7 +971,7 @@ public class ComponentHelper { | |||||
Throwable t = ex.getTargetException(); | Throwable t = ex.getTargetException(); | ||||
out.println("Cause: The constructor threw the exception"); | out.println("Cause: The constructor threw the exception"); | ||||
out.println(t.toString()); | out.println(t.toString()); | ||||
t.printStackTrace(out); | |||||
t.printStackTrace(out); //NOSONAR | |||||
} catch (NoClassDefFoundError ncdfe) { | } catch (NoClassDefFoundError ncdfe) { | ||||
jars = true; | jars = true; | ||||
out.println("Cause: A class needed by class " + classname | out.println("Cause: A class needed by class " + classname | ||||
@@ -472,7 +472,7 @@ public final class Diagnostics { | |||||
// report error if something weird happens...this is diagnostic. | // report error if something weird happens...this is diagnostic. | ||||
if (error != null) { | if (error != null) { | ||||
out.println("Error while running org.apache.env.Which"); | out.println("Error while running org.apache.env.Which"); | ||||
error.printStackTrace(); | |||||
error.printStackTrace(out); //NOSONAR | |||||
} | } | ||||
} | } | ||||
@@ -146,7 +146,7 @@ public class DirectoryScanner | |||||
* method instead. | * method instead. | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
protected static final String[] DEFAULTEXCLUDES = { | |||||
protected static final String[] DEFAULTEXCLUDES = { //NOSONAR | |||||
// Miscellaneous typical temporary files | // Miscellaneous typical temporary files | ||||
SelectorUtils.DEEP_TREE_MATCH + "/*~", | SelectorUtils.DEEP_TREE_MATCH + "/*~", | ||||
SelectorUtils.DEEP_TREE_MATCH + "/#*#", | SelectorUtils.DEEP_TREE_MATCH + "/#*#", | ||||
@@ -246,7 +246,7 @@ public class Main implements AntMain { | |||||
printMessage(be); | printMessage(be); | ||||
} | } | ||||
} catch (final Throwable exc) { | } catch (final Throwable exc) { | ||||
exc.printStackTrace(); | |||||
exc.printStackTrace(); //NOSONAR | |||||
printMessage(exc); | printMessage(exc); | ||||
} finally { | } finally { | ||||
handleLogfile(); | handleLogfile(); | ||||
@@ -881,11 +881,11 @@ public class Main implements AntMain { | |||||
// but if we don't, we lose valuable information | // but if we don't, we lose valuable information | ||||
System.err.println("Caught an exception while logging the" | System.err.println("Caught an exception while logging the" | ||||
+ " end of the build. Exception was:"); | + " end of the build. Exception was:"); | ||||
t.printStackTrace(); | |||||
t.printStackTrace(); //NOSONAR | |||||
if (error != null) { | if (error != null) { | ||||
System.err.println("There has been an error prior to" | System.err.println("There has been an error prior to" | ||||
+ " that:"); | + " that:"); | ||||
error.printStackTrace(); | |||||
error.printStackTrace(); //NOSONAR | |||||
} | } | ||||
throw new BuildException(t); //NOSONAR | throw new BuildException(t); //NOSONAR | ||||
} | } | ||||
@@ -873,7 +873,7 @@ public class Project implements ResourceFactory { | |||||
try { | try { | ||||
setBasedir("."); | setBasedir("."); | ||||
} catch (final BuildException ex) { | } catch (final BuildException ex) { | ||||
ex.printStackTrace(); | |||||
ex.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
return baseDir; | return baseDir; | ||||
@@ -108,7 +108,7 @@ public class ProjectHelperRepository { | |||||
+ e.getClass().getName() | + e.getClass().getName() | ||||
+ ": " + e.getMessage() + ")"); | + ": " + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); | |||||
e.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -175,7 +175,7 @@ public class ProjectHelperRepository { | |||||
+ ProjectHelper.HELPER_PROPERTY + " (" | + ProjectHelper.HELPER_PROPERTY + " (" | ||||
+ e.getMessage() + ")"); | + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); | |||||
e.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
@@ -203,7 +203,7 @@ public class ProjectHelperRepository { | |||||
System.out.println("Unable to load ProjectHelper from service " | System.out.println("Unable to load ProjectHelper from service " | ||||
+ ProjectHelper.SERVICE_ID + " (" + e.getMessage() + ")"); | + ProjectHelper.SERVICE_ID + " (" + e.getMessage() + ")"); | ||||
if (DEBUG) { | if (DEBUG) { | ||||
e.printStackTrace(System.err); | |||||
e.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
@@ -27,6 +27,7 @@ import java.util.Properties; | |||||
import java.util.SortedMap; | import java.util.SortedMap; | ||||
import java.util.TreeMap; | import java.util.TreeMap; | ||||
import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.types.Parameter; | import org.apache.tools.ant.types.Parameter; | ||||
import org.apache.tools.ant.types.Resource; | import org.apache.tools.ant.types.Resource; | ||||
import org.apache.tools.ant.types.resources.FileResource; | import org.apache.tools.ant.types.resources.FileResource; | ||||
@@ -244,7 +245,11 @@ public final class ReplaceTokens | |||||
in = resource.getInputStream(); | in = resource.getInputStream(); | ||||
props.load(in); | props.load(in); | ||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
ioe.printStackTrace(); | |||||
if (getProject() != null) { | |||||
getProject().log("getProperties failed, " + ioe.getMessage(), Project.MSG_ERR); | |||||
} else { | |||||
ioe.printStackTrace(); //NOSONAR | |||||
} | |||||
} finally { | } finally { | ||||
FileUtils.close(in); | FileUtils.close(in); | ||||
} | } | ||||
@@ -117,7 +117,7 @@ public class Launcher { | |||||
System.err.println(e.getMessage()); | System.err.println(e.getMessage()); | ||||
} catch (final Throwable t) { | } catch (final Throwable t) { | ||||
exitCode = EXIT_CODE_ERROR; | exitCode = EXIT_CODE_ERROR; | ||||
t.printStackTrace(System.err); | |||||
t.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
if (exitCode != 0) { | if (exitCode != 0) { | ||||
if (launchDiag) { | if (launchDiag) { | ||||
@@ -297,7 +297,7 @@ public class Launcher { | |||||
"Failed to locate" + mainClassname); | "Failed to locate" + mainClassname); | ||||
thrown = cnfe; | thrown = cnfe; | ||||
} catch (final Throwable t) { | } catch (final Throwable t) { | ||||
t.printStackTrace(System.err); | |||||
t.printStackTrace(System.err); //NOSONAR | |||||
thrown=t; | thrown=t; | ||||
} | } | ||||
if(thrown!=null) { | if(thrown!=null) { | ||||
@@ -177,7 +177,7 @@ public class MailLogger extends DefaultLogger { | |||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
System.out.println("MailLogger failed to send e-mail!"); | System.out.println("MailLogger failed to send e-mail!"); | ||||
e.printStackTrace(System.err); | |||||
e.printStackTrace(System.err); //NOSONAR | |||||
} | } | ||||
} | } | ||||
@@ -27,6 +27,7 @@ import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* EXPERIMENTAL | * EXPERIMENTAL | ||||
@@ -238,7 +239,7 @@ public class Classloader extends Task { | |||||
// TODO add exceptions | // TODO add exceptions | ||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
ex.printStackTrace(); | |||||
log(StringUtils.getStackTrace(ex), Project.MSG_ERR); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -113,7 +113,7 @@ public class Execute { | |||||
procEnvironment = System.getenv(); | procEnvironment = System.getenv(); | ||||
return procEnvironment; | return procEnvironment; | ||||
} catch (Exception x) { | } catch (Exception x) { | ||||
x.printStackTrace(); | |||||
x.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
@@ -162,7 +162,7 @@ public class Execute { | |||||
procEnvironment.put(var.substring(0, eq), var.substring(eq + 1)); | procEnvironment.put(var.substring(0, eq), var.substring(eq + 1)); | ||||
} | } | ||||
} catch (java.io.IOException exc) { | } catch (java.io.IOException exc) { | ||||
exc.printStackTrace(); | |||||
exc.printStackTrace(); //NOSONAR | |||||
// Just try to see how much we got | // Just try to see how much we got | ||||
} | } | ||||
return procEnvironment; | return procEnvironment; | ||||
@@ -43,11 +43,11 @@ import org.apache.tools.ant.Task; | |||||
public class HostInfo extends Task { | public class HostInfo extends Task { | ||||
private static final String DEF_REM_ADDR6 = "::"; | private static final String DEF_REM_ADDR6 = "::"; | ||||
private static final String DEF_REM_ADDR4 = "0.0.0.0"; | |||||
private static final String DEF_REM_ADDR4 = "0.0.0.0"; //NOSONAR | |||||
private static final String DEF_LOCAL_ADDR6 = "::1"; | private static final String DEF_LOCAL_ADDR6 = "::1"; | ||||
private static final String DEF_LOCAL_ADDR4 = "127.0.0.1"; | |||||
private static final String DEF_LOCAL_ADDR4 = "127.0.0.1"; //NOSONAR | |||||
private static final String DEF_LOCAL_NAME = "localhost"; | private static final String DEF_LOCAL_NAME = "localhost"; | ||||
private static final String DEF_DOMAIN = "localdomain"; | private static final String DEF_DOMAIN = "localdomain"; | ||||
@@ -40,6 +40,7 @@ import org.apache.tools.ant.types.PropertySet; | |||||
import org.apache.tools.ant.types.RedirectorElement; | import org.apache.tools.ant.types.RedirectorElement; | ||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
import org.apache.tools.ant.util.KeepAliveInputStream; | import org.apache.tools.ant.util.KeepAliveInputStream; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Launcher for Java applications. Allows use of | * Launcher for Java applications. Allows use of | ||||
@@ -997,11 +998,7 @@ public class Java extends Task { | |||||
* @since 1.6.2 | * @since 1.6.2 | ||||
*/ | */ | ||||
private void log(Throwable t) { | private void log(Throwable t) { | ||||
StringWriter sw = new StringWriter(); | |||||
PrintWriter w = new PrintWriter(sw); | |||||
t.printStackTrace(w); | |||||
w.close(); | |||||
log(sw.toString(), Project.MSG_ERR); | |||||
log(StringUtils.getStackTrace(t), Project.MSG_ERR); | |||||
} | } | ||||
/** | /** | ||||
@@ -1313,7 +1313,7 @@ public class Javadoc extends Task { | |||||
* cannot be static in inner classes.) The first letter | * cannot be static in inner classes.) The first letter | ||||
* from each element is used to build up the scope string. | * from each element is used to build up the scope string. | ||||
*/ | */ | ||||
static final String[] SCOPE_ELEMENTS = { | |||||
static final String[] SCOPE_ELEMENTS = { //NOSONAR | |||||
"overview", "packages", "types", "constructors", | "overview", "packages", "types", "constructors", | ||||
"methods", "fields" | "methods", "fields" | ||||
}; | }; | ||||
@@ -28,8 +28,10 @@ import java.util.Hashtable; | |||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Keyword substitution. Input file is written to output file. | * Keyword substitution. Input file is written to output file. | ||||
@@ -80,7 +82,7 @@ public class KeySubst extends Task { | |||||
} | } | ||||
bw.flush(); | bw.flush(); | ||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
ioe.printStackTrace(); | |||||
log(StringUtils.getStackTrace(ioe), Project.MSG_ERR); | |||||
} finally { | } finally { | ||||
FileUtils.close(bw); | FileUtils.close(bw); | ||||
FileUtils.close(br); | FileUtils.close(br); | ||||
@@ -153,7 +155,7 @@ public class KeySubst extends Task { | |||||
System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $", | System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $", | ||||
hash)); | hash)); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
@@ -247,7 +247,7 @@ public class Length extends Task implements Condition { | |||||
/** EnumeratedAttribute operation mode */ | /** EnumeratedAttribute operation mode */ | ||||
public static class FileMode extends EnumeratedAttribute { | public static class FileMode extends EnumeratedAttribute { | ||||
static final String[] MODES = new String[] {EACH, ALL}; | |||||
static final String[] MODES = new String[] {EACH, ALL}; //NOSONAR | |||||
/** | /** | ||||
* Return the possible values for FileMode. | * Return the possible values for FileMode. | ||||
@@ -84,7 +84,7 @@ class ProcessDestroyer implements Runnable { | |||||
} catch (NoSuchMethodException e) { | } catch (NoSuchMethodException e) { | ||||
// it just won't be added as a shutdown hook... :( | // it just won't be added as a shutdown hook... :( | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
@@ -100,14 +100,14 @@ class ProcessDestroyer implements Runnable { | |||||
addShutdownHookMethod.invoke(Runtime.getRuntime(), args); | addShutdownHookMethod.invoke(Runtime.getRuntime(), args); | ||||
added = true; | added = true; | ||||
} catch (IllegalAccessException e) { | } catch (IllegalAccessException e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} catch (InvocationTargetException e) { | } catch (InvocationTargetException e) { | ||||
Throwable t = e.getTargetException(); | Throwable t = e.getTargetException(); | ||||
if (t != null && t.getClass() == IllegalStateException.class) { | if (t != null && t.getClass() == IllegalStateException.class) { | ||||
// shutdown already is in progress | // shutdown already is in progress | ||||
running = true; | running = true; | ||||
} else { | } else { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -129,14 +129,14 @@ class ProcessDestroyer implements Runnable { | |||||
System.err.println("Could not remove shutdown hook"); | System.err.println("Could not remove shutdown hook"); | ||||
} | } | ||||
} catch (IllegalAccessException e) { | } catch (IllegalAccessException e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} catch (InvocationTargetException e) { | } catch (InvocationTargetException e) { | ||||
Throwable t = e.getTargetException(); | Throwable t = e.getTargetException(); | ||||
if (t != null && t.getClass() == IllegalStateException.class) { | if (t != null && t.getClass() == IllegalStateException.class) { | ||||
// shutdown already is in progress | // shutdown already is in progress | ||||
running = true; | running = true; | ||||
} else { | } else { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
// start the hook thread, a unstarted thread may not be | // start the hook thread, a unstarted thread may not be | ||||
@@ -111,7 +111,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener { | |||||
} else { | } else { | ||||
out.println(StringUtils.LINE_SEP + "BUILD FAILED" | out.println(StringUtils.LINE_SEP + "BUILD FAILED" | ||||
+ StringUtils.LINE_SEP); | + StringUtils.LINE_SEP); | ||||
error.printStackTrace(out); | |||||
error.printStackTrace(out); //NOSONAR | |||||
} | } | ||||
} | } | ||||
cleanup(); | cleanup(); | ||||
@@ -34,7 +34,7 @@ import org.apache.tools.ant.types.Path; | |||||
import org.apache.tools.ant.types.PropertySet; | import org.apache.tools.ant.types.PropertySet; | ||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
import org.apache.tools.ant.types.ResourceCollection; | import org.apache.tools.ant.types.ResourceCollection; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Calls a given target for all defined sub-builds. This is an extension | * Calls a given target for all defined sub-builds. This is an extension | ||||
@@ -255,7 +255,7 @@ public class SubAnt extends Task { | |||||
log("Target '" + file | log("Target '" + file | ||||
+ "' failed with message '" | + "' failed with message '" | ||||
+ thrownException.getMessage() + "'.", Project.MSG_ERR); | + thrownException.getMessage() + "'.", Project.MSG_ERR); | ||||
thrownException.printStackTrace(System.err); | |||||
log(StringUtils.getStackTrace(thrownException), Project.MSG_ERR); | |||||
if (buildException == null) { | if (buildException == null) { | ||||
buildException = | buildException = | ||||
new BuildException(thrownException); | new BuildException(thrownException); | ||||
@@ -58,6 +58,7 @@ import org.apache.tools.ant.util.ClasspathUtils; | |||||
import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.ResourceUtils; | import org.apache.tools.ant.util.ResourceUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Processes a set of XML documents via XSLT. This is | * Processes a set of XML documents via XSLT. This is | ||||
@@ -952,7 +953,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
try { | try { | ||||
resolveProcessor(PROCESSOR_TRAX); | resolveProcessor(PROCESSOR_TRAX); | ||||
} catch (final Throwable e1) { | } catch (final Throwable e1) { | ||||
e1.printStackTrace(); | |||||
log(StringUtils.getStackTrace(e1), Project.MSG_ERR); | |||||
handleError(e1); | handleError(e1); | ||||
} | } | ||||
} | } | ||||
@@ -390,7 +390,7 @@ public class PropertyFile extends Task { | |||||
} catch (NullPointerException npe) { | } catch (NullPointerException npe) { | ||||
// Default to string type | // Default to string type | ||||
// which means do nothing | // which means do nothing | ||||
npe.printStackTrace(); | |||||
npe.printStackTrace(); //NOSONAR | |||||
} | } | ||||
if (newValue == null) { | if (newValue == null) { | ||||
@@ -30,7 +30,7 @@ import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.taskdefs.Execute; | import org.apache.tools.ant.taskdefs.Execute; | ||||
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Creates new Continuus ccm task and sets it as the default. | * Creates new Continuus ccm task and sets it as the default. | ||||
@@ -322,7 +322,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
} // end of if () | } // end of if () | ||||
} catch (NullPointerException npe) { | } catch (NullPointerException npe) { | ||||
log("error procession stream , null pointer exception", Project.MSG_ERR); | log("error procession stream , null pointer exception", Project.MSG_ERR); | ||||
npe.printStackTrace(); | |||||
log(StringUtils.getStackTrace(npe), Project.MSG_ERR); | |||||
throw new BuildException(npe.getClass().getName()); | throw new BuildException(npe.getClass().getName()); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
log("error procession stream " + e.getMessage(), Project.MSG_ERR); | log("error procession stream " + e.getMessage(), Project.MSG_ERR); | ||||
@@ -43,6 +43,7 @@ import org.xml.sax.InputSource; | |||||
import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Compiles EJB stubs and skeletons for the iPlanet Application | * Compiles EJB stubs and skeletons for the iPlanet Application | ||||
@@ -310,7 +311,7 @@ public class IPlanetEjbc { | |||||
// SAXException or ParserConfigurationException may be thrown | // SAXException or ParserConfigurationException may be thrown | ||||
System.out.println("An exception was generated while trying to "); | System.out.println("An exception was generated while trying to "); | ||||
System.out.println("create a new SAXParser."); | System.out.println("create a new SAXParser."); | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
return; | return; | ||||
} | } | ||||
@@ -443,7 +444,7 @@ public class IPlanetEjbc { | |||||
p.destroy(); | p.destroy(); | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
log("An IOException has occurred while trying to execute ejbc."); | log("An IOException has occurred while trying to execute ejbc."); | ||||
e.printStackTrace(); | |||||
log(StringUtils.getStackTrace(e)); | |||||
} catch (InterruptedException e) { | } catch (InterruptedException e) { | ||||
// Do nothing | // Do nothing | ||||
} | } | ||||
@@ -1484,7 +1485,7 @@ public class IPlanetEjbc { | |||||
System.out.println(text); | System.out.println(text); | ||||
} | } | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} finally { | } finally { | ||||
FileUtils.close(reader); | FileUtils.close(reader); | ||||
} | } | ||||
@@ -40,6 +40,7 @@ import org.apache.tools.ant.types.optional.image.TransformOperation; | |||||
import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.IdentityMapper; | import org.apache.tools.ant.util.IdentityMapper; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
import com.sun.media.jai.codec.FileSeekableStream; | import com.sun.media.jai.codec.FileSeekableStream; | ||||
@@ -392,7 +393,7 @@ public class Image extends MatchingTask { | |||||
} | } | ||||
} catch (Exception err) { | } catch (Exception err) { | ||||
err.printStackTrace(); | |||||
log(StringUtils.getStackTrace(err), Project.MSG_ERR); | |||||
throw new BuildException(err.getMessage()); | throw new BuildException(err.getMessage()); | ||||
} | } | ||||
} | } | ||||
@@ -77,7 +77,7 @@ public class JavaCC extends Task { | |||||
protected static final int TASKDEF_TYPE_JJTREE = 2; | protected static final int TASKDEF_TYPE_JJTREE = 2; | ||||
protected static final int TASKDEF_TYPE_JJDOC = 3; | protected static final int TASKDEF_TYPE_JJDOC = 3; | ||||
protected static final String[] ARCHIVE_LOCATIONS = | |||||
protected static final String[] ARCHIVE_LOCATIONS = //NOSONAR | |||||
new String[] { | new String[] { | ||||
"JavaCC.zip", | "JavaCC.zip", | ||||
"bin/lib/JavaCC.zip", | "bin/lib/JavaCC.zip", | ||||
@@ -85,7 +85,7 @@ public class JavaCC extends Task { | |||||
"javacc.jar", // used by jpackage for JavaCC 3.x | "javacc.jar", // used by jpackage for JavaCC 3.x | ||||
}; | }; | ||||
protected static final int[] ARCHIVE_LOCATIONS_VS_MAJOR_VERSION = | |||||
protected static final int[] ARCHIVE_LOCATIONS_VS_MAJOR_VERSION = //NOSONAR | |||||
new int[] { | new int[] { | ||||
1, | 1, | ||||
2, | 2, | ||||
@@ -33,7 +33,7 @@ public class JspNameMangler implements JspMangler { | |||||
/** | /** | ||||
* this is the list of keywords which can not be used as classnames | * this is the list of keywords which can not be used as classnames | ||||
*/ | */ | ||||
public static final String[] keywords = { | |||||
public static final String[] keywords = { //NOSONAR | |||||
"assert", | "assert", | ||||
"abstract", "boolean", "break", "byte", | "abstract", "boolean", "break", "byte", | ||||
"case", "catch", "char", "class", | "case", "catch", "char", "class", | ||||
@@ -38,6 +38,7 @@ import org.apache.tools.ant.BuildListener; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.ProjectComponent; | import org.apache.tools.ant.ProjectComponent; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* <p>Collects all failing test <i>cases</i> and creates a new JUnit test class containing | * <p>Collects all failing test <i>cases</i> and creates a new JUnit test class containing | ||||
@@ -260,7 +261,7 @@ public class FailureRecorder extends ProjectComponent implements JUnitResultForm | |||||
createClassFooter(); | createClassFooter(); | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
e.printStackTrace(); | |||||
log(StringUtils.getStackTrace(e)); | |||||
} finally { | } finally { | ||||
FileUtils.close(writer); | FileUtils.close(writer); | ||||
} | } | ||||
@@ -62,6 +62,7 @@ import org.apache.tools.ant.types.PropertySet; | |||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.LoaderUtils; | import org.apache.tools.ant.util.LoaderUtils; | ||||
import org.apache.tools.ant.util.SplitClassLoader; | import org.apache.tools.ant.util.SplitClassLoader; | ||||
import org.apache.tools.ant.util.StringUtils; | |||||
/** | /** | ||||
* Runs JUnit tests. | * Runs JUnit tests. | ||||
@@ -1298,7 +1299,7 @@ public class JUnitTask extends Task { | |||||
+ " testcase not started or mixing ant versions?"; | + " testcase not started or mixing ant versions?"; | ||||
} | } | ||||
} catch (final Exception e) { | } catch (final Exception e) { | ||||
e.printStackTrace(); | |||||
log(StringUtils.getStackTrace(e), Project.MSG_INFO); | |||||
// ignored. | // ignored. | ||||
} finally { | } finally { | ||||
FileUtils.close(br); | FileUtils.close(br); | ||||
@@ -1023,7 +1023,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||||
} | } | ||||
} | } | ||||
} catch (final IOException e) { | } catch (final IOException e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} else { | } else { | ||||
final JUnitTest t = new JUnitTest(args[0]); | final JUnitTest t = new JUnitTest(args[0]); | ||||
@@ -144,7 +144,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
private String initialSiteCommand = null; | private String initialSiteCommand = null; | ||||
private boolean enableRemoteVerification = true; | private boolean enableRemoteVerification = true; | ||||
protected static final String[] ACTION_STRS = { | |||||
protected static final String[] ACTION_STRS = { //NOSONAR | |||||
"sending", | "sending", | ||||
"getting", | "getting", | ||||
"deleting", | "deleting", | ||||
@@ -155,7 +155,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
"site" | "site" | ||||
}; | }; | ||||
protected static final String[] COMPLETED_ACTION_STRS = { | |||||
protected static final String[] COMPLETED_ACTION_STRS = { //NOSONAR | |||||
"sent", | "sent", | ||||
"retrieved", | "retrieved", | ||||
"deleted", | "deleted", | ||||
@@ -166,7 +166,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
"site command executed" | "site command executed" | ||||
}; | }; | ||||
protected static final String[] ACTION_TARGET_STRS = { | |||||
protected static final String[] ACTION_TARGET_STRS = { //NOSONAR | |||||
"files", | "files", | ||||
"files", | "files", | ||||
"files", | "files", | ||||
@@ -108,7 +108,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
private ClassLoader mirrorLoader; | private ClassLoader mirrorLoader; | ||||
private FTPTaskMirror delegate = null; | private FTPTaskMirror delegate = null; | ||||
public static final String[] ACTION_STRS = { | |||||
public static final String[] ACTION_STRS = { //NOSONAR | |||||
"sending", | "sending", | ||||
"getting", | "getting", | ||||
"deleting", | "deleting", | ||||
@@ -119,7 +119,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
"site" | "site" | ||||
}; | }; | ||||
public static final String[] COMPLETED_ACTION_STRS = { | |||||
public static final String[] COMPLETED_ACTION_STRS = { //NOSONAR | |||||
"sent", | "sent", | ||||
"retrieved", | "retrieved", | ||||
"deleted", | "deleted", | ||||
@@ -130,7 +130,7 @@ public class FTPTask extends Task implements FTPTaskConfig { | |||||
"site command executed" | "site command executed" | ||||
}; | }; | ||||
public static final String[] ACTION_TARGET_STRS = { | |||||
public static final String[] ACTION_TARGET_STRS = { //NOSONAR | |||||
"files", | "files", | ||||
"files", | "files", | ||||
"files", | "files", | ||||
@@ -41,7 +41,7 @@ public abstract class SOS extends Task implements SOSCmd { | |||||
private String sosCmdDir = null; | private String sosCmdDir = null; | ||||
private String sosUsername = null; | private String sosUsername = null; | ||||
private String sosPassword = ""; | |||||
private String sosPassword = null; | |||||
private String projectPath = null; | private String projectPath = null; | ||||
private String vssServerPath = null; | private String vssServerPath = null; | ||||
private String sosServerPath = null; | private String sosServerPath = null; | ||||
@@ -269,7 +269,7 @@ public abstract class SOS extends Task implements SOSCmd { | |||||
* @return empty string if it wasn't set. | * @return empty string if it wasn't set. | ||||
*/ | */ | ||||
protected String getPassword() { | protected String getPassword() { | ||||
return sosPassword; | |||||
return sosPassword == null ? "" : sosPassword; | |||||
} | } | ||||
/** | /** | ||||
@@ -53,7 +53,7 @@ public interface SOSCmd { | |||||
/** The username option */ | /** The username option */ | ||||
String FLAG_USERNAME = "-name"; | String FLAG_USERNAME = "-name"; | ||||
/** The password option */ | /** The password option */ | ||||
String FLAG_PASSWORD = "-password"; | |||||
String FLAG_PASSWORD = "-password"; //NOSONAR | |||||
/** The log option */ | /** The log option */ | ||||
String FLAG_COMMENT = "-log"; | String FLAG_COMMENT = "-log"; | ||||
/** The workdir option */ | /** The workdir option */ | ||||
@@ -109,7 +109,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
project.log("Audio format is not yet supported: " | project.log("Audio format is not yet supported: " | ||||
+ uafe.getMessage()); | + uafe.getMessage()); | ||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
ioe.printStackTrace(); | |||||
ioe.printStackTrace(); //NOSONAR | |||||
} | } | ||||
if (audioInputStream != null) { | if (audioInputStream != null) { | ||||
@@ -125,7 +125,7 @@ public class AntSoundPlayer implements LineListener, BuildListener { | |||||
project.log("The sound device is currently unavailable"); | project.log("The sound device is currently unavailable"); | ||||
return; | return; | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
if (duration != null) { | if (duration != null) { | ||||
@@ -67,7 +67,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
// CheckStyle:VisibilityModifier OFF - bc | // CheckStyle:VisibilityModifier OFF - bc | ||||
/** The system classpath as a Path object */ | /** The system classpath as a Path object */ | ||||
public static Path systemClasspath = | |||||
public static final Path systemClasspath = | |||||
new Path(null, System.getProperty("java.class.path")); | new Path(null, System.getProperty("java.class.path")); | ||||
@@ -76,7 +76,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
* | * | ||||
* @since Ant 1.6.2 | * @since Ant 1.6.2 | ||||
*/ | */ | ||||
public static Path systemBootClasspath = | |||||
public static final Path systemBootClasspath = | |||||
new Path(null, System.getProperty("sun.boot.class.path")); | new Path(null, System.getProperty("sun.boot.class.path")); | ||||
// CheckStyle:VisibilityModifier OFF - bc | // CheckStyle:VisibilityModifier OFF - bc | ||||
@@ -137,7 +137,7 @@ public class PropertiesfileCache implements Cache { | |||||
cache.load(bis); | cache.load(bis); | ||||
bis.close(); | bis.close(); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
// after loading the cache is up to date with the file | // after loading the cache is up to date with the file | ||||
@@ -164,7 +164,7 @@ public class PropertiesfileCache implements Cache { | |||||
bos.flush(); | bos.flush(); | ||||
bos.close(); | bos.close(); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
} | } | ||||
cacheDirty = false; | cacheDirty = false; | ||||
@@ -49,7 +49,7 @@ public class Base64Converter { | |||||
// CheckStyle:ConstantNameCheck OFF - bc | // CheckStyle:ConstantNameCheck OFF - bc | ||||
/** Provided for BC purposes */ | /** Provided for BC purposes */ | ||||
public static final char[] alphabet = ALPHABET; | |||||
public static final char[] alphabet = ALPHABET; //NOSONAR | |||||
// CheckStyle:ConstantNameCheck ON | // CheckStyle:ConstantNameCheck ON | ||||
@@ -36,12 +36,9 @@ import java.util.Vector; | |||||
*/ | */ | ||||
public class CollectionUtils { | public class CollectionUtils { | ||||
/** | |||||
* Collections.emptyList() is Java5+. | |||||
*/ | |||||
@SuppressWarnings("rawtypes") | @SuppressWarnings("rawtypes") | ||||
@Deprecated | @Deprecated | ||||
public static final List EMPTY_LIST = Collections.EMPTY_LIST; | |||||
public static final List EMPTY_LIST = Collections.EMPTY_LIST; //NOSONAR | |||||
/** | /** | ||||
* Please use Vector.equals() or List.equals(). | * Please use Vector.equals() or List.equals(). | ||||
@@ -700,7 +700,7 @@ public class LayoutPreservingProperties extends Properties { | |||||
dolly = super.clone(); | dolly = super.clone(); | ||||
} catch (final CloneNotSupportedException e) { | } catch (final CloneNotSupportedException e) { | ||||
// should be fine | // should be fine | ||||
e.printStackTrace(); | |||||
e.printStackTrace(); //NOSONAR | |||||
} | } | ||||
return dolly; | return dolly; | ||||
} | } | ||||
@@ -57,7 +57,7 @@ public class ProxySetup { | |||||
/** the http proxy username property */ | /** the http proxy username property */ | ||||
public static final String HTTP_PROXY_USERNAME = "http.proxyUser"; | public static final String HTTP_PROXY_USERNAME = "http.proxyUser"; | ||||
/** the http proxy password property */ | /** the http proxy password property */ | ||||
public static final String HTTP_PROXY_PASSWORD = "http.proxyPassword"; | |||||
public static final String HTTP_PROXY_PASSWORD = "http.proxyPassword"; //NOSONAR | |||||
/** the socks proxy host property */ | /** the socks proxy host property */ | ||||
public static final String SOCKS_PROXY_HOST = "socksProxyHost"; | public static final String SOCKS_PROXY_HOST = "socksProxyHost"; | ||||
/** the socks proxy port property */ | /** the socks proxy port property */ | ||||
@@ -65,7 +65,7 @@ public class ProxySetup { | |||||
/** the socks proxy username property */ | /** the socks proxy username property */ | ||||
public static final String SOCKS_PROXY_USERNAME = "java.net.socks.username"; | public static final String SOCKS_PROXY_USERNAME = "java.net.socks.username"; | ||||
/** the socks proxy password property */ | /** the socks proxy password property */ | ||||
public static final String SOCKS_PROXY_PASSWORD = "java.net.socks.password"; | |||||
public static final String SOCKS_PROXY_PASSWORD = "java.net.socks.password"; //NOSONAR | |||||
/** | /** | ||||
* create a proxy setup class bound to this project | * create a proxy setup class bound to this project | ||||
@@ -97,7 +97,7 @@ public final class StringUtils { | |||||
public static String getStackTrace(Throwable t) { | public static String getStackTrace(Throwable t) { | ||||
StringWriter sw = new StringWriter(); | StringWriter sw = new StringWriter(); | ||||
PrintWriter pw = new PrintWriter(sw, true); | PrintWriter pw = new PrintWriter(sw, true); | ||||
t.printStackTrace(pw); | |||||
t.printStackTrace(pw); //NOSONAR | |||||
pw.flush(); | pw.flush(); | ||||
pw.close(); | pw.close(); | ||||
return sw.toString(); | return sw.toString(); | ||||
@@ -52,7 +52,7 @@ public interface BZip2Constants { | |||||
* <p>FIXME: This array should be in a private or package private | * <p>FIXME: This array should be in a private or package private | ||||
* location, since it could be modified by malicious code.</p> | * location, since it could be modified by malicious code.</p> | ||||
*/ | */ | ||||
int[] rNums = { | |||||
int[] rNums = { //NOSONAR | |||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | ||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | ||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | ||||
@@ -30,7 +30,7 @@ package org.apache.tools.bzip2; | |||||
* | * | ||||
*/ | */ | ||||
final class CRC { | final class CRC { | ||||
static final int crc32Table[] = { | |||||
static final int crc32Table[] = { //NOSONAR | |||||
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, | 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, | ||||
0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, | 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, | ||||
0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, | 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, | ||||
@@ -963,33 +963,33 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
* | * | ||||
* @since 1.1 | * @since 1.1 | ||||
*/ | */ | ||||
protected static final byte[] LFH_SIG = ZipLong.LFH_SIG.getBytes(); | |||||
protected static final byte[] LFH_SIG = ZipLong.LFH_SIG.getBytes(); //NOSONAR | |||||
/** | /** | ||||
* data descriptor signature | * data descriptor signature | ||||
* | * | ||||
* @since 1.1 | * @since 1.1 | ||||
*/ | */ | ||||
protected static final byte[] DD_SIG = ZipLong.DD_SIG.getBytes(); | |||||
protected static final byte[] DD_SIG = ZipLong.DD_SIG.getBytes(); //NOSONAR | |||||
/** | /** | ||||
* central file header signature | * central file header signature | ||||
* | * | ||||
* @since 1.1 | * @since 1.1 | ||||
*/ | */ | ||||
protected static final byte[] CFH_SIG = ZipLong.CFH_SIG.getBytes(); | |||||
protected static final byte[] CFH_SIG = ZipLong.CFH_SIG.getBytes(); //NOSONAR | |||||
/** | /** | ||||
* end of central dir signature | * end of central dir signature | ||||
* | * | ||||
* @since 1.1 | * @since 1.1 | ||||
*/ | */ | ||||
protected static final byte[] EOCD_SIG = ZipLong.getBytes(0X06054B50L); | |||||
protected static final byte[] EOCD_SIG = ZipLong.getBytes(0X06054B50L); //NOSONAR | |||||
/** | /** | ||||
* ZIP64 end of central dir signature | * ZIP64 end of central dir signature | ||||
*/ | */ | ||||
static final byte[] ZIP64_EOCD_SIG = ZipLong.getBytes(0X06064B50L); | |||||
static final byte[] ZIP64_EOCD_SIG = ZipLong.getBytes(0X06064B50L); //NOSONAR | |||||
/** | /** | ||||
* ZIP64 end of central dir locator signature | * ZIP64 end of central dir locator signature | ||||
*/ | */ | ||||
static final byte[] ZIP64_EOCD_LOC_SIG = ZipLong.getBytes(0X07064B50L); | |||||
static final byte[] ZIP64_EOCD_LOC_SIG = ZipLong.getBytes(0X07064B50L); //NOSONAR | |||||
/** | /** | ||||
* Writes next block of compressed data to the output stream. | * Writes next block of compressed data to the output stream. | ||||
@@ -195,10 +195,6 @@ public class AntClassLoaderTest { | |||||
int startMessage = log.indexOf("CLASSPATH element "); | int startMessage = log.indexOf("CLASSPATH element "); | ||||
assertTrue(startMessage >= 0); | assertTrue(startMessage >= 0); | ||||
assertTrue(log.indexOf("foo.jar is not a JAR", startMessage) > 0); | assertTrue(log.indexOf("foo.jar is not a JAR", startMessage) > 0); | ||||
log = errBuffer.toString(); | |||||
startMessage = log.indexOf("CLASSPATH element "); | |||||
assertTrue(startMessage >= 0); | |||||
assertTrue(log.indexOf("foo.jar is not a JAR", startMessage) > 0); | |||||
} finally { | } finally { | ||||
System.setErr(sysErr); | System.setErr(sysErr); | ||||
} | } | ||||