ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [3/8] ant git commit: there simply is no better logger around
Date Wed, 21 Dec 2016 19:17:41 GMT
there simply is no better logger around


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/4cecc03a
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/4cecc03a
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/4cecc03a

Branch: refs/heads/master
Commit: 4cecc03af634d050ab17667ab63e22a843b88f45
Parents: 0555c6d
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Wed Dec 21 19:56:31 2016 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Wed Dec 21 19:56:31 2016 +0100

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/Main.java                   |  6 +++---
 src/main/org/apache/tools/ant/Project.java                |  2 +-
 .../org/apache/tools/ant/ProjectHelperRepository.java     |  6 +++---
 src/main/org/apache/tools/ant/filters/ReplaceTokens.java  |  7 ++++++-
 src/main/org/apache/tools/ant/launch/Launcher.java        |  4 ++--
 src/main/org/apache/tools/ant/listener/MailLogger.java    |  2 +-
 src/main/org/apache/tools/ant/taskdefs/Execute.java       |  4 ++--
 src/main/org/apache/tools/ant/taskdefs/KeySubst.java      |  2 +-
 .../org/apache/tools/ant/taskdefs/ProcessDestroyer.java   | 10 +++++-----
 src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java |  2 +-
 .../apache/tools/ant/taskdefs/optional/PropertyFile.java  |  2 +-
 .../tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java      |  4 ++--
 .../ant/taskdefs/optional/junit/JUnitTestRunner.java      |  2 +-
 .../tools/ant/taskdefs/optional/sound/AntSoundPlayer.java |  4 ++--
 .../selectors/modifiedselector/PropertiesfileCache.java   |  4 ++--
 .../apache/tools/ant/util/LayoutPreservingProperties.java |  2 +-
 16 files changed, 34 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/Main.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 647fc9f..4626e14 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -246,7 +246,7 @@ public class Main implements AntMain {
                 printMessage(be);
             }
         } catch (final Throwable exc) {
-            exc.printStackTrace();
+            exc.printStackTrace(); //NOSONAR
             printMessage(exc);
         } finally {
             handleLogfile();
@@ -881,11 +881,11 @@ public class Main implements AntMain {
                     // but if we don't, we lose valuable information
                     System.err.println("Caught an exception while logging the"
                                        + " end of the build.  Exception was:");
-                    t.printStackTrace();
+                    t.printStackTrace(); //NOSONAR
                     if (error != null) {
                         System.err.println("There has been an error prior to"
                                            + " that:");
-                        error.printStackTrace();
+                        error.printStackTrace(); //NOSONAR
                     }
                     throw new BuildException(t); //NOSONAR
                 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/Project.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java
index e916002..827183d 100644
--- a/src/main/org/apache/tools/ant/Project.java
+++ b/src/main/org/apache/tools/ant/Project.java
@@ -873,7 +873,7 @@ public class Project implements ResourceFactory {
             try {
                 setBasedir(".");
             } catch (final BuildException ex) {
-                ex.printStackTrace();
+                ex.printStackTrace(); //NOSONAR
             }
         }
         return baseDir;

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/ProjectHelperRepository.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ProjectHelperRepository.java b/src/main/org/apache/tools/ant/ProjectHelperRepository.java
index 1dd4412..02ad62d 100644
--- a/src/main/org/apache/tools/ant/ProjectHelperRepository.java
+++ b/src/main/org/apache/tools/ant/ProjectHelperRepository.java
@@ -108,7 +108,7 @@ public class ProjectHelperRepository {
                                + e.getClass().getName()
                                + ": " + e.getMessage() + ")");
             if (DEBUG) {
-                e.printStackTrace(System.err);
+                e.printStackTrace(System.err); //NOSONAR
             }
         }
     }
@@ -175,7 +175,7 @@ public class ProjectHelperRepository {
                                + ProjectHelper.HELPER_PROPERTY + " ("
                                + e.getMessage() + ")");
             if (DEBUG) {
-                e.printStackTrace(System.err);
+                e.printStackTrace(System.err); //NOSONAR
             }
         }
         return null;
@@ -203,7 +203,7 @@ public class ProjectHelperRepository {
             System.out.println("Unable to load ProjectHelper from service "
                     + ProjectHelper.SERVICE_ID + " (" + e.getMessage() + ")");
             if (DEBUG) {
-                e.printStackTrace(System.err);
+                e.printStackTrace(System.err); //NOSONAR
             }
         }
         return null;

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
index 21ca3bc..74da64a 100644
--- a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
+++ b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
@@ -27,6 +27,7 @@ import java.util.Properties;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
+import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Parameter;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.resources.FileResource;
@@ -244,7 +245,11 @@ public final class ReplaceTokens
             in = resource.getInputStream();
             props.load(in);
         } catch (IOException ioe) {
-            ioe.printStackTrace();
+            if (getProject() != null) {
+                getProject().log("getProperties failed, " + ioe.getMessage(), Project.MSG_ERR);
+            } else {
+                ioe.printStackTrace(); //NOSONAR
+            }
         } finally {
             FileUtils.close(in);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/launch/Launcher.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/launch/Launcher.java b/src/main/org/apache/tools/ant/launch/Launcher.java
index 364bc58..534bbfb 100644
--- a/src/main/org/apache/tools/ant/launch/Launcher.java
+++ b/src/main/org/apache/tools/ant/launch/Launcher.java
@@ -117,7 +117,7 @@ public class Launcher {
             System.err.println(e.getMessage());
         } catch (final Throwable t) {
             exitCode = EXIT_CODE_ERROR;
-            t.printStackTrace(System.err);
+            t.printStackTrace(System.err); //NOSONAR
         }
         if (exitCode != 0) {
             if (launchDiag) {
@@ -297,7 +297,7 @@ public class Launcher {
                     "Failed to locate" + mainClassname);
             thrown = cnfe;
         } catch (final Throwable t) {
-            t.printStackTrace(System.err);
+            t.printStackTrace(System.err); //NOSONAR
             thrown=t;
         }
         if(thrown!=null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/listener/MailLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/listener/MailLogger.java b/src/main/org/apache/tools/ant/listener/MailLogger.java
index 4b50547..3d5bcd2 100644
--- a/src/main/org/apache/tools/ant/listener/MailLogger.java
+++ b/src/main/org/apache/tools/ant/listener/MailLogger.java
@@ -177,7 +177,7 @@ public class MailLogger extends DefaultLogger {
             }
         } catch (Exception e) {
             System.out.println("MailLogger failed to send e-mail!");
-            e.printStackTrace(System.err);
+            e.printStackTrace(System.err); //NOSONAR
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/Execute.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java
index 128caa9..956309a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Execute.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java
@@ -113,7 +113,7 @@ public class Execute {
                 procEnvironment = System.getenv();
                 return procEnvironment;
             } 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));
             }
         } catch (java.io.IOException exc) {
-            exc.printStackTrace();
+            exc.printStackTrace(); //NOSONAR
             // Just try to see how much we got
         }
         return procEnvironment;

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
index 6ff67c0..28d46b9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
+++ b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
@@ -153,7 +153,7 @@ public class KeySubst extends Task {
             System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",
                                                 hash));
         } catch (Exception e) {
-            e.printStackTrace();
+            e.printStackTrace(); //NOSONAR
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
index ba9c9d4..bc3ff49 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
@@ -84,7 +84,7 @@ class ProcessDestroyer implements Runnable {
         } catch (NoSuchMethodException e) {
             // it just won't be added as a shutdown hook... :(
         } catch (Exception e) {
-            e.printStackTrace();
+            e.printStackTrace(); //NOSONAR
         }
     }
 
@@ -100,14 +100,14 @@ class ProcessDestroyer implements Runnable {
                 addShutdownHookMethod.invoke(Runtime.getRuntime(), args);
                 added = true;
             } catch (IllegalAccessException e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             } catch (InvocationTargetException e) {
                 Throwable t = e.getTargetException();
                 if (t != null && t.getClass() == IllegalStateException.class) {
                     // shutdown already is in progress
                     running = true;
                 } else {
-                    e.printStackTrace();
+                    e.printStackTrace(); //NOSONAR
                 }
             }
         }
@@ -129,14 +129,14 @@ class ProcessDestroyer implements Runnable {
                     System.err.println("Could not remove shutdown hook");
                 }
             } catch (IllegalAccessException e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             } catch (InvocationTargetException e) {
                 Throwable t = e.getTargetException();
                 if (t != null && t.getClass() == IllegalStateException.class) {
                     // shutdown already is in progress
                     running = true;
                 } else {
-                    e.printStackTrace();
+                    e.printStackTrace(); //NOSONAR
                 }
             }
             // start the hook thread, a unstarted thread may not be

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
index dfb8e84..a495936 100644
--- a/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
+++ b/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
@@ -111,7 +111,7 @@ public class RecorderEntry implements BuildLogger, SubBuildListener {
             } else {
                 out.println(StringUtils.LINE_SEP + "BUILD FAILED"
                             + StringUtils.LINE_SEP);
-                error.printStackTrace(out);
+                error.printStackTrace(out); //NOSONAR
             }
         }
         cleanup();

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
index 7c778da..02106a9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
@@ -401,7 +401,7 @@ public class PropertyFile extends Task {
             } catch (NullPointerException npe) {
                 // Default to string type
                 // which means do nothing
-                npe.printStackTrace();
+                npe.printStackTrace(); //NOSONAR
             }
 
             if (newValue == null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
index 984fc37..f9c2ef1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
@@ -310,7 +310,7 @@ public class IPlanetEjbc {
             // SAXException or ParserConfigurationException may be thrown
             System.out.println("An exception was generated while trying to ");
             System.out.println("create a new SAXParser.");
-            e.printStackTrace();
+            e.printStackTrace(); //NOSONAR
             return;
         }
 
@@ -1484,7 +1484,7 @@ public class IPlanetEjbc {
                     System.out.println(text);
                 }
             } catch (IOException e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             } finally {
                 FileUtils.close(reader);
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
----------------------------------------------------------------------
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 0397d84..c7d39e0 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
@@ -1023,7 +1023,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR
                     }
                 }
             } catch (final IOException e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             }
         } else {
             final JUnitTest t = new JUnitTest(args[0]);

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
----------------------------------------------------------------------
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 aef214f..d1675a8 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
@@ -109,7 +109,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
             project.log("Audio format is not yet supported: "
                 + uafe.getMessage());
         } catch (IOException ioe) {
-            ioe.printStackTrace();
+            ioe.printStackTrace(); //NOSONAR
         }
 
         if (audioInputStream != null) {
@@ -125,7 +125,7 @@ public class AntSoundPlayer implements LineListener, BuildListener {
                     project.log("The sound device is currently unavailable");
                     return;
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    e.printStackTrace(); //NOSONAR
                 }
 
                 if (duration != null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
index 1446e89..e8cf3fe 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
@@ -137,7 +137,7 @@ public class PropertiesfileCache implements Cache {
                 cache.load(bis);
                 bis.close();
             } catch (Exception e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             }
         }
         // after loading the cache is up to date with the file
@@ -164,7 +164,7 @@ public class PropertiesfileCache implements Cache {
                 bos.flush();
                 bos.close();
             } catch (Exception e) {
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             }
         }
         cacheDirty = false;

http://git-wip-us.apache.org/repos/asf/ant/blob/4cecc03a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
index aed6f37..eceb9a0 100644
--- a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
+++ b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
@@ -700,7 +700,7 @@ public class LayoutPreservingProperties extends Properties {
                 dolly = super.clone();
             } catch (final CloneNotSupportedException e) {
                 // should be fine
-                e.printStackTrace();
+                e.printStackTrace(); //NOSONAR
             }
             return dolly;
         }


Mime
View raw message