Browse Source

there simply is no better logger around

master
Stefan Bodewig 8 years ago
parent
commit
4cecc03af6
16 changed files with 34 additions and 29 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/Main.java
  2. +1
    -1
      src/main/org/apache/tools/ant/Project.java
  3. +3
    -3
      src/main/org/apache/tools/ant/ProjectHelperRepository.java
  4. +6
    -1
      src/main/org/apache/tools/ant/filters/ReplaceTokens.java
  5. +2
    -2
      src/main/org/apache/tools/ant/launch/Launcher.java
  6. +1
    -1
      src/main/org/apache/tools/ant/listener/MailLogger.java
  7. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  8. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/KeySubst.java
  9. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
  10. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  12. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  14. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
  15. +2
    -2
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
  16. +1
    -1
      src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java

+ 3
- 3
src/main/org/apache/tools/ant/Main.java View File

@@ -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
} }


+ 1
- 1
src/main/org/apache/tools/ant/Project.java View File

@@ -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;


+ 3
- 3
src/main/org/apache/tools/ant/ProjectHelperRepository.java View File

@@ -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;


+ 6
- 1
src/main/org/apache/tools/ant/filters/ReplaceTokens.java View File

@@ -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);
} }


+ 2
- 2
src/main/org/apache/tools/ant/launch/Launcher.java View File

@@ -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) {


+ 1
- 1
src/main/org/apache/tools/ant/listener/MailLogger.java View File

@@ -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
} }
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -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;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/KeySubst.java View File

@@ -153,7 +153,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
} }
} }




+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java View File

@@ -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


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java View File

@@ -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();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java View File

@@ -401,7 +401,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) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java View File

@@ -310,7 +310,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;
} }


@@ -1484,7 +1484,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);
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java View File

@@ -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]);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java View File

@@ -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) {


+ 2
- 2
src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java View File

@@ -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;


+ 1
- 1
src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java View File

@@ -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;
} }


Loading…
Cancel
Save