ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1374870 - in /ant/ivy/core/trunk/src/java/org/apache/ivy: ant/ core/ core/cache/ core/check/ core/report/ core/repository/ core/resolve/ core/settings/ osgi/obr/ osgi/p2/ osgi/repo/ osgi/util/ plugins/parser/xml/ plugins/repository/sftp/ p...
Date Sun, 19 Aug 2012 22:15:38 GMT
Author: hibou
Date: Sun Aug 19 22:15:36 2012
New Revision: 1374870

URL: http://svn.apache.org/viewvc?rev=1374870&view=rev
Log:
When catching an exception, and the stacktrace might be miningful (actually hightly valuable for a NPE), log the stack trace in debug.

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDependencyArtifact.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/ChainedRepository.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpResource.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/MemoryUtil.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java Sun Aug 19 22:15:36 2012
@@ -107,7 +107,6 @@ public class AntBuildTrigger extends Abs
                     ant.execute();
                 } catch (BuildException e) {
                     Message.verbose("Exception occurred while executing target " + target);
-                    e.printStackTrace(); // TODO: remove when finished debugging
                     throw e;
                 }
                 markBuilt(f);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java Sun Aug 19 22:15:36 2012
@@ -65,7 +65,7 @@ public class ConvertManifestTask extends
             try {
                 profileProvider = new ExecutionEnvironmentProfileProvider();
             } catch (IOException e) {
-                throw new BuildException("Enable to load the default environment profiles");
+                throw new BuildException("Enable to load the default environment profiles", e);
             }
         }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDependencyArtifact.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDependencyArtifact.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDependencyArtifact.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDependencyArtifact.java Sun Aug 19 22:15:36 2012
@@ -58,7 +58,7 @@ public class IvyDependencyArtifact {
         try {
             u = url == null ? null : new URL(url);
         } catch (MalformedURLException e) {
-            throw new BuildException("Malformed url in the artifact: " + e.getMessage());
+            throw new BuildException("Malformed url in the artifact: " + e.getMessage(), e);
         }
         DefaultDependencyArtifactDescriptor dad = new DefaultDependencyArtifactDescriptor(dd, name,
                 typePattern, extPattern, u, null);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java Sun Aug 19 22:15:36 2012
@@ -200,6 +200,7 @@ public class IvyContext {
             try {
                 defaultIvy.configureDefault();
             } catch (Exception e) {
+                Message.debug(e);
                 //???
             }
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java Sun Aug 19 22:15:36 2012
@@ -684,8 +684,7 @@ public class DefaultRepositoryCacheManag
                     }
                 } catch (Exception e) {
                     // will try with resolver
-                    Message.debug("\tproblem while parsing cached ivy file for: " + mrid + ": "
-                        + e.getMessage());
+                    Message.debug("\tproblem while parsing cached ivy file for: " + mrid, e);
                 }
             } else {
                 Message.debug("\tno ivy file in cache for " + mrid + ": tried " + ivyFile);
@@ -896,6 +895,7 @@ public class DefaultRepositoryCacheManag
                         adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
                     }
                 } catch (Exception ex) {
+                    Message.debug(ex);
                     adr.setDownloadStatus(DownloadStatus.FAILED);
                     adr.setDownloadDetails(ex.getMessage());
                     adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
@@ -982,6 +982,7 @@ public class DefaultRepositoryCacheManag
                         adr.setLocalFile(archiveFile);
                     }
                 } catch (Exception ex) {
+                    Message.debug(ex);
                     origin.setExist(false);
                     saveArtifactOrigin(artifact, origin);
                     adr.setDownloadStatus(DownloadStatus.FAILED);
@@ -1081,11 +1082,13 @@ public class DefaultRepositoryCacheManag
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
-            Message.warn("impossible to put metadata file in cache: " 
-                + (orginalMetadataRef == null 
-                        ? String.valueOf(md.getResolvedModuleRevisionId()) 
-                        : String.valueOf(orginalMetadataRef))
-                + ". " + e.getClass().getName() + ": " + e.getMessage());
+            String metadataRef;
+            if (orginalMetadataRef == null) {
+                metadataRef = String.valueOf(md.getResolvedModuleRevisionId());
+            } else {
+                metadataRef = String.valueOf(orginalMetadataRef);
+            }
+            Message.warn("impossible to put metadata file in cache: " + metadataRef, e);
         } finally {
             unlockMetadataArtifact(mrid);
         }
@@ -1256,8 +1259,7 @@ public class DefaultRepositoryCacheManag
                 
                 return new ResolvedModuleRevision(resolver, resolver, md, madr);
             } catch (IOException ex) {
-                Message.warn("io problem while parsing ivy file: " + mdRef.getResource() + ": "
-                    + ex.getMessage());
+                Message.warn("io problem while parsing ivy file: " + mdRef.getResource(), ex);
                 return null;
             }
         } finally {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java Sun Aug 19 22:15:36 2012
@@ -124,13 +124,13 @@ public class CheckEngine {
             }
             return result;
         } catch (ParseException e) {
-            Message.info("parse problem on " + ivyFile + ": " + e);
+            Message.info("parse problem on " + ivyFile, e);
             return false;
         } catch (IOException e) {
-            Message.info("io problem on " + ivyFile + ": " + e);
+            Message.info("io problem on " + ivyFile, e);
             return false;
         } catch (Exception e) {
-            Message.info("problem on " + ivyFile + ": " + e);
+            Message.info("problem on " + ivyFile, e);
             return false;
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java Sun Aug 19 22:15:36 2012
@@ -101,8 +101,7 @@ public class ConfigurationResolveReport 
                 hasChanged = Boolean.valueOf(!previousDepSet.equals(getModuleRevisionIds()));
             } catch (Exception e) {
                 Message.warn("Error while parsing configuration resolve report "
-                        + previousReportFile.getAbsolutePath());
-                e.printStackTrace();
+                        + previousReportFile.getAbsolutePath(), e);
                 hasChanged = Boolean.TRUE;
             }
         } else {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java Sun Aug 19 22:15:36 2012
@@ -145,6 +145,7 @@ public class RepositoryManagementEngine 
             try {
                 loadModuleRevision(mrids[i]);
             } catch (Exception e) {
+                Message.debug(e);
                 errors.put(mrids[i], e.getMessage());
             }
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Sun Aug 19 22:15:36 2012
@@ -346,6 +346,7 @@ public class ResolveEngine {
             eventManager.fireIvyEvent(new EndResolveEvent(md, confs, report));
             return report;
         } catch (RuntimeException ex) {
+            Message.debug(ex);
             Message.error(ex.getMessage());
             Message.sumupProblems();
             throw ex;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Sun Aug 19 22:15:36 2012
@@ -234,15 +234,14 @@ public class IvySettings implements Sort
                 } catch (FileNotFoundException e) {
                     Message.warn("typedefs file not found: " + files[i].trim());
                 } catch (IOException e) {
-                    Message.warn("problem with typedef file: " + files[i].trim() + ": "
-                            + e.getMessage());
+                    Message.warn("problem with typedef file: " + files[i].trim(), e);
                 }
             }
         } else {
             try {
                 typeDefs(getSettingsURL("typedef.properties").openStream(), true);
             } catch (IOException e) {
-                Message.warn("impossible to load default type defs");
+                Message.warn("impossible to load default type defs", e);
             }
         }
         LatestLexicographicStrategy latestLexicographicStrategy = new LatestLexicographicStrategy();
@@ -279,8 +278,8 @@ public class IvySettings implements Sort
             addMatcher((PatternMatcher) instanceField.get(null));
         } catch (Exception e) {
             // ignore: the matcher isn't on the classpath
-            Message.info("impossible to define glob matcher: " 
-                + "org.apache.ivy.plugins.matcher.GlobPatternMatcher was not found.");
+            Message.info("impossible to define glob matcher: "
+                    + "org.apache.ivy.plugins.matcher.GlobPatternMatcher was not found", e);
         }
 
         addReportOutputter(new LogReportOutputter());
@@ -323,8 +322,7 @@ public class IvySettings implements Sort
                     props.load(URLHandlerRegistry.getDefault().openStream(url));
                     configured = true;
                 } catch (Exception ex) {
-                    Message.verbose("unable to use remote repository configuration: "
-                            + ex.getMessage());
+                    Message.verbose("unable to use remote repository configuration", ex);
                     props = new Properties();
                 }
             }
@@ -334,8 +332,7 @@ public class IvySettings implements Sort
                     repositoryPropsStream = getSettingsURL("repository.properties").openStream();
                     props.load(repositoryPropsStream);
                 } catch (IOException e) {
-                    Message.error("unable to use internal repository configuration: "
-                            + e.getMessage());
+                    Message.error("unable to use internal repository configuration", e);
                     if (repositoryPropsStream != null) {
                         try {
                             repositoryPropsStream.close();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/OBRResolver.java Sun Aug 19 22:15:36 2012
@@ -128,15 +128,15 @@ public class OBRResolver extends Abstrac
         } catch (ParseException e) {
             throw new RuntimeException("The OBR repository resolver " + getName()
                     + " couldn't be configured: the file " + sourceLocation
-                    + " is incorrectly formed (" + e.getMessage() + ")");
+                    + " is incorrectly formed (" + e.getMessage() + ")", e);
         } catch (IOException e) {
             throw new RuntimeException("The OBR repository resolver " + getName()
                     + " couldn't be configured: the file " + sourceLocation
-                    + " could not be read (" + e.getMessage() + ")");
+                    + " could not be read (" + e.getMessage() + ")", e);
         } catch (SAXException e) {
             throw new RuntimeException("The OBR repository resolver " + getName()
                     + " couldn't be configured: the file " + sourceLocation
-                    + " has incorrect XML (" + e.getMessage() + ")");
+                    + " has incorrect XML (" + e.getMessage() + ")", e);
         }
         try {
             in.close();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java Sun Aug 19 22:15:36 2012
@@ -163,17 +163,24 @@ public class P2MetadataParser implements
             options = Integer.parseInt(atts.getValue(OPTIONS));
             name = atts.getValue(NAME);
 
-            try {
-                String uriAtt = atts.getValue(URI);
-                String url = atts.getValue(URL);
-                if (uri != null) {
+            String uriAtt = atts.getValue(URI);
+            String urlAtt = atts.getValue(URL);
+
+            if (uriAtt != null) {
+                try {
                     uri = new URI(uriAtt);
-                } else if (url != null) {
-                    uri = new URI(url);
+                } catch (URISyntaxException e) {
+                    throw new SAXParseException("Invalid uri attribute " + uriAtt + "("
+                            + e.getMessage() + ")", getLocator());
+                }
+            }
+            if (uri != null && urlAtt != null) {
+                try {
+                    uri = new URI(urlAtt);
+                } catch (URISyntaxException e) {
+                    throw new SAXParseException("Invalid url attribute " + urlAtt + "("
+                            + e.getMessage() + ")", getLocator());
                 }
-            } catch (URISyntaxException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
             }
         }
     }
@@ -300,14 +307,14 @@ public class P2MetadataParser implements
                         try {
                             embeddedInfo = ManifestParser.parseManifest(manifest);
                         } catch (IOException e) {
-                            Message.verbose("The Manifest of the source bundle "
-                                    + bundleInfo.getSymbolicName() + " could not be parsed: "
-                                    + e.getMessage());
+                            Message.verbose(
+                                "The Manifest of the source bundle " + bundleInfo.getSymbolicName()
+                                        + " could not be parsed", e);
                             return;
                         } catch (ParseException e) {
-                            Message.verbose("The Manifest of the source bundle "
-                                    + bundleInfo.getSymbolicName() + " is ill formed: "
-                                    + e.getMessage());
+                            Message.verbose(
+                                "The Manifest of the source bundle " + bundleInfo.getSymbolicName()
+                                        + " is ill formed", e);
                             return;
                         }
                         if (!embeddedInfo.isSource()) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java Sun Aug 19 22:15:36 2012
@@ -89,7 +89,7 @@ public abstract class AbstractFSManifest
                         try {
                             bundleCandidates = listBundleFiles(currentDir).iterator();
                         } catch (IOException e) {
-                            Message.warn("Unlistable dir: " + currentDir + " (" + e + ")");
+                            Message.warn("Unlistable dir: " + currentDir, e);
                             currentDir = null;
                         }
                     } else if (dirs.size() <= 1) {
@@ -112,9 +112,9 @@ public abstract class AbstractFSManifest
                             Message.debug("No manifest in jar: " + bundleCandidate);
                         }
                     } catch (FileNotFoundException e) {
-                        Message.debug("Jar file just removed: " + bundleCandidate + " (" + e + ")");
+                        Message.debug("Jar file just removed: " + bundleCandidate, e);
                     } catch (IOException e) {
-                        Message.warn("Unreadable jar: " + bundleCandidate + " (" + e + ")");
+                        Message.warn("Unreadable jar: " + bundleCandidate, e);
                     } finally {
                         if (in != null) {
                             try {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/DelegetingHandler.java Sun Aug 19 22:15:36 2012
@@ -145,7 +145,7 @@ public class DelegetingHandler extends D
         } catch (SAXException e) {
             if (skipOnError) {
                 skip();
-                log(Message.MSG_ERR, e.getMessage());
+                log(Message.MSG_ERR, e.getMessage(), e);
             } else {
                 throw e;
             }
@@ -511,6 +511,11 @@ public class DelegetingHandler extends D
     // Functions related to error handling
     // //////////////////////
 
+    protected void log(int logLevel, String message, Throwable t) {
+        Message.debug(t);
+        log(logLevel, message);
+    }
+
     protected void log(int logLevel, String message) {
         Message.log(logLevel, getLocation(getLocator()) + message);
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java Sun Aug 19 22:15:36 2012
@@ -411,8 +411,7 @@ public class XmlModuleDescriptorParser e
                     parent = resolveParentFromModuleInheritanceRepository(parentResolver, parentMrid);
                 }
             } catch (IOException e) {
-                Message.warn("Unable to parse included ivy file " + location + ": " 
-                    + e.getMessage());
+                Message.warn("Unable to parse included ivy file " + location, e);
             }
             
             // if not found, tries to resolve using repositories
@@ -420,7 +419,7 @@ public class XmlModuleDescriptorParser e
                 try {
                     parent = parseOtherIvyFile(parentMrid);
                 } catch (ParseException e) {
-                    Message.warn("Unable to parse included ivy file for " + parentMrid.toString());
+                    Message.warn("Unable to parse included ivy file for " + parentMrid.toString(), e);
                 }
             }
             

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java Sun Aug 19 22:15:36 2012
@@ -104,7 +104,7 @@ public class SFTPRepository extends Abst
                 }
             }
         } catch (Exception e) {
-            Message.debug("reolving resource error: " + e.getMessage());
+            Message.debug("Error while resolving resource " + path, e);
             // silent fail, return unexisting resource
         }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/ChainedRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/ChainedRepository.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/ChainedRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/url/ChainedRepository.java Sun Aug 19 22:15:36 2012
@@ -48,7 +48,7 @@ public class ChainedRepository extends A
                     return r;
                 }
             } catch (Exception e) {
-                logFailed(repository);
+                logFailed(repository, e);
             }
         }
         // resource that basically doesn't exists
@@ -65,7 +65,7 @@ public class ChainedRepository extends A
                 repository.get(source, destination);
                 ok = true;
             } catch (Exception e) {
-                logFailed(repository);
+                logFailed(repository, e);
             }
             if (ok) {
                 logSuccess(repository);
@@ -87,7 +87,7 @@ public class ChainedRepository extends A
                     return list;
                 }
             } catch (Exception e) {
-                logFailed(repository);
+                logFailed(repository, e);
             }
         }
         throw newIOEFail("list contents in " + parent);
@@ -97,9 +97,10 @@ public class ChainedRepository extends A
         Message.debug("Mirrored repository " + getName() + ": trying " + repository.getName());
     }
 
-    private void logFailed(Repository repository) {
-        Message.warn("Mirrored repository " + getName() + ": " + repository
-                + " is not available. Trying the next one in the mirror list...");
+    private void logFailed(Repository repository, Exception e) {
+        Message.warn("Mirrored repository " + getName() + ": " + repository.getName()
+                + " is not available", e);
+        Message.warn("Trying the next one in the mirror list...");
     }
 
     private void logSuccess(Repository repository) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java Sun Aug 19 22:15:36 2012
@@ -68,6 +68,7 @@ public class VfsResource implements Reso
                 lastModified = content.getLastModifiedTime();
                 contentLength = content.getSize();
             } catch (FileSystemException e) {
+                Message.debug(e);
                 Message.verbose(e.getLocalizedMessage());
                 exists = false;
                 lastModified = 0;
@@ -98,6 +99,7 @@ public class VfsResource implements Reso
                 }
             }
         } catch (IOException e) {
+            Message.debug(e);
             Message.verbose(e.getLocalizedMessage());
         }
         return list;
@@ -186,7 +188,7 @@ public class VfsResource implements Reso
             // include all exceptions when I found it would throw a NPE exception when the query was
             // run on non-wellformed VFS URI.
         } catch (Exception e) {
-            Message.verbose(e.getLocalizedMessage());
+            Message.verbose("Fail to check the existance of the resource " + getName(), e);
             return false;
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java Sun Aug 19 22:15:36 2012
@@ -659,9 +659,7 @@ public class VsftpRepository extends Abs
                     return new BasicResource(file, true, contentLength, FORMAT.parse(date)
                             .getTime(), false);
                 } catch (Exception ex) {
-                    Message
-                            .warn("impossible to parse server response: " + responseLine + ": "
-                                    + ex);
+                    Message.warn("impossible to parse server response: " + responseLine, ex);
                     return new BasicResource(file, false, 0, 0, false);
                 }
             }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpResource.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpResource.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpResource.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpResource.java Sun Aug 19 22:15:36 2012
@@ -36,6 +36,7 @@ public class VsftpResource extends LazyR
         try {
             init(repository.getInitResource(getName()));
         } catch (IOException e) {
+            Message.debug(e);
             Message.verbose(e.toString());
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java Sun Aug 19 22:15:36 2012
@@ -549,7 +549,7 @@ public abstract class BasicResolver exte
                         return new MDResolvedResource(resource, rev, rmr);
                     }
                 } catch (ParseException e) {
-                    Message.warn("Failed to parse the file '" + resource + "': " + e.getMessage());
+                    Message.warn("Failed to parse the file '" + resource + "'", e);
                     return null;
                 }
             }
@@ -868,6 +868,7 @@ public abstract class BasicResolver exte
                         String revision = origin.getArtifact().getModuleRevisionId().getRevision();
                         return new ResolvedResource(resource, revision);
                     } catch (IOException e) {
+                        Message.debug(e);
                         return null;
                     }
                 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java Sun Aug 19 22:15:36 2012
@@ -106,8 +106,7 @@ public class ChainResolver extends Abstr
                     mr = forcedRevision(mr);
                 }
             } catch (Exception ex) {
-                Message.verbose("problem occurred while resolving " + dd + " with " + resolver
-                        + ": " + StringUtils.getStackTrace(ex));
+                Message.verbose("problem occurred while resolving " + dd + " with " + resolver, ex);
                 errors.add(ex);
             } finally {
                 if (oldLatest != null) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Sun Aug 19 22:15:36 2012
@@ -195,14 +195,11 @@ public class IBiblioResolver extends URL
                     Message.verbose("\tmaven-metadata not available: " + metadata);
                 }
             } catch (IOException e) {
-                Message.verbose(
-                    "impossible to access maven metadata file, ignored: " + e.getMessage());
+                Message.verbose("impossible to access maven metadata file, ignored", e);
             } catch (SAXException e) {
-                Message.verbose(
-                    "impossible to parse maven metadata file, ignored: " + e.getMessage());
+                Message.verbose("impossible to parse maven metadata file, ignored", e);
             } catch (ParserConfigurationException e) {
-                Message.verbose(
-                    "impossible to parse maven metadata file, ignored: " + e.getMessage());
+                Message.verbose("impossible to parse maven metadata file, ignored", e);
             } finally {
                 if (metadataStream != null) {
                     try {
@@ -409,7 +406,7 @@ public class IBiblioResolver extends URL
                     } catch (IOException e) {
                         Message.warn(
                             "impossible to get resource from name listed by maven-metadata.xml:"
-                            + rres + ": " + e.getMessage());
+                                    + rres, e);
                     }
                 }
                 return (ResolvedResource[]) rres.toArray(new ResolvedResource[rres.size()]);
@@ -452,14 +449,11 @@ public class IBiblioResolver extends URL
                 Message.verbose("\tmaven-metadata not available: " + metadata);
             }
         } catch (IOException e) {
-            Message.verbose(
-                "impossible to access maven metadata file, ignored: " + e.getMessage());
+            Message.verbose("impossible to access maven metadata file, ignored", e);
         } catch (SAXException e) {
-            Message.verbose(
-                "impossible to parse maven metadata file, ignored: " + e.getMessage());
+            Message.verbose("impossible to parse maven metadata file, ignored", e);
         } catch (ParserConfigurationException e) {
-            Message.verbose(
-                "impossible to parse maven metadata file, ignored: " + e.getMessage());
+            Message.verbose("impossible to parse maven metadata file, ignored", e);
         } finally {
             if (metadataStream != null) {
                 try {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IvyRepResolver.java Sun Aug 19 22:15:36 2012
@@ -239,7 +239,7 @@ public class IvyRepResolver extends URLR
         } catch (MalformedURLException e) {
             //???
         } catch (Exception e) {
-            Message.warn("unable to parse content.xml file on ivyrep: " + e.getMessage());
+            Message.warn("unable to parse content.xml file on ivyrep", e);
         }
         return super.listOrganisations();
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/RepositoryResolver.java Sun Aug 19 22:15:36 2012
@@ -309,6 +309,7 @@ public class RepositoryResolver extends 
             Resource resource = repository.getResource(path);
             return resource.exists();
         } catch (IOException e) {
+            Message.debug(e);
             return false;
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java Sun Aug 19 22:15:36 2012
@@ -160,7 +160,6 @@ public class PackagerCacheEntry {
             project.executeTarget("build");
             this.built = true;
         } catch (BuildException e) {
-            e.printStackTrace(System.out);
             Message.verbose("packager resolver build failed: " + e);
             throw e;
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java Sun Aug 19 22:15:36 2012
@@ -89,13 +89,10 @@ public final class ResolverHelper {
                     return null;
                 }
             } catch (IOException e) {
-                Message.verbose(
-                    "problem while listing resources in " + root + " with " + rep + ":");
-                Message.verbose("  " + e.getClass().getName() + " " + e.getMessage());
+                Message.verbose("problem while listing resources in " + root + " with " + rep, e);
                 return null;
             } catch (Exception e) {
-                Message.warn("problem while listing resources in " + root + " with " + rep + ":");
-                Message.warn("  " + e.getClass().getName() + " " + e.getMessage());
+                Message.warn("problem while listing resources in " + root + " with " + rep, e);
                 return null;
             }
         }
@@ -123,12 +120,10 @@ public final class ResolverHelper {
                 return null;
             }
         } catch (IOException e) {
-            Message.verbose("problem while listing resources in " + parent + " with " + rep + ":");
-            Message.verbose("  " + e.getClass().getName() + " " + e.getMessage());
+            Message.verbose("problem while listing resources in " + parent + " with " + rep, e);
             return null;
         } catch (Exception e) {
-            Message.warn("problem while listing resources in " + parent + " with " + rep + ":");
-            Message.warn("  " + e.getClass().getName() + " " + e.getMessage());
+            Message.warn("problem while listing resources in " + parent + " with " + rep, e);
             return null;
         }
     }
@@ -159,7 +154,7 @@ public final class ResolverHelper {
                     }
                 } catch (IOException e) {
                     Message.warn("impossible to get resource from name listed by repository: "
-                            + rres + ": " + e.getMessage());
+                            + rres, e);
                 }
             }
             if (revs.length != ret.size()) {
@@ -180,7 +175,7 @@ public final class ResolverHelper {
                 }
             } catch (IOException e) {
                 Message.debug("\timpossible to get resource from name listed by repository: "
-                        + partiallyResolvedPattern + ": " + e.getMessage());
+                        + partiallyResolvedPattern, e);
             }
             Message.debug("\tno revision found");
         }
@@ -304,8 +299,7 @@ public final class ResolverHelper {
                     Message.debug("\t\t" + ret.size() + " matched " + pattern);
                     return (String[]) ret.toArray(new String[ret.size()]);
                 } catch (Exception e) {
-                    Message.warn("problem while listing files in " + root + ": " + e.getClass()
-                            + " " + e.getMessage());
+                    Message.warn("problem while listing files in " + root, e);
                     return null;
                 }
             }
@@ -337,8 +331,7 @@ public final class ResolverHelper {
             }
             return null;
         } catch (Exception e) {
-            Message.warn("problem while listing directories in " + root + ": " + e.getClass() + " "
-                    + e.getMessage());
+            Message.warn("problem while listing directories in " + root, e);
             return null;
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java Sun Aug 19 22:15:36 2012
@@ -80,8 +80,7 @@ public class JarJarDependencyAnalyser im
                 md.addDependency(dd);
             }
         } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            Message.debug(e);
         }
         return (ModuleDescriptor[]) mds.values().toArray(new ModuleDescriptor[mds.values().size()]);
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/JarModuleFinder.java Sun Aug 19 22:15:36 2012
@@ -26,6 +26,7 @@ import org.apache.ivy.core.module.id.Mod
 import org.apache.ivy.plugins.resolver.util.FileURLLister;
 import org.apache.ivy.plugins.resolver.util.ResolverHelper;
 import org.apache.ivy.plugins.resolver.util.URLLister;
+import org.apache.ivy.util.Message;
 
 public class JarModuleFinder {
     private String pattern;
@@ -62,6 +63,7 @@ public class JarModuleFinder {
             }
 
         } catch (Exception e) {
+            Message.debug(e);
             // TODO: handle exception
         }
         return (JarModule[]) ret.toArray(new JarModule[ret.size()]);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/tools/analyser/RepositoryAnalyser.java Sun Aug 19 22:15:36 2012
@@ -38,8 +38,7 @@ public class RepositoryAnalyser {
                 Message.info("generating " + ivyFile);
                 XmlModuleDescriptorWriter.write(mds[i], ivyFile);
             } catch (IOException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
+                Message.debug(e);
             }
         }
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/CredentialsUtil.java Sun Aug 19 22:15:36 2012
@@ -115,7 +115,7 @@ public final class CredentialsUtil {
                     fos = new FileOutputStream(passfile);
                     props.store(fos, "");
                 } catch (Exception e) {
-                    Message.warn("error occurred while saving password file " + passfile + ": " + e);
+                    Message.warn("error occurred while saving password file " + passfile, e);
                 } finally {
                     if (fos != null) {
                         try {
@@ -148,7 +148,7 @@ public final class CredentialsUtil {
                 }
                 return new Credentials(c.getRealm(), c.getHost(), username, passwd);
             } catch (IOException e) {
-                Message.warn("error occurred while loading password file " + passfile + ": " + e);
+                Message.warn("error occurred while loading password file " + passfile, e);
             } finally {
                 if (fis != null) {
                     try {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/FileUtil.java Sun Aug 19 22:15:36 2012
@@ -156,11 +156,8 @@ public final class FileUtil {
                 dest.delete(); // just make sure we do delete the invalid symlink!
                 throw new IOException("error symlinking: " + dest + " isn't a symlink"); 
             }
-        } catch (IOException x) {
-            Message.verbose("symlink failed; falling back to copy");
-            StringWriter buffer = new StringWriter();
-            x.printStackTrace(new PrintWriter(buffer));
-            Message.debug(buffer.toString());
+        } catch (IOException e) {
+            Message.verbose("symlink failed; falling back to copy", e);
             copy(src, dest, l, overwrite);
         } catch (InterruptedException x) {
             Thread.currentThread().interrupt();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/MemoryUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/MemoryUtil.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/MemoryUtil.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/MemoryUtil.java Sun Aug 19 22:15:36 2012
@@ -47,8 +47,7 @@ public final class MemoryUtil {
             float approxSize = (endingMemoryUse - startingMemoryUse) / (float) objects.length;
             size = Math.round(approxSize);
         } catch (Exception e) {
-            System.out.println("WARNING:couldn't instantiate" + clazz);
-            e.printStackTrace();
+            Message.warn("Couldn't instantiate " + clazz, e);
         }
         return size;
     }
@@ -80,7 +79,7 @@ public final class MemoryUtil {
             System.runFinalization();
             Thread.sleep(SLEEP_TIME);
         } catch (Exception e) {
-            e.printStackTrace();
+            Message.debug(e);
         }
     }
     

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/Message.java Sun Aug 19 22:15:36 2012
@@ -165,4 +165,54 @@ public final class Message {
 
     private Message() {
     }
+
+    public static void debug(String message, Throwable t) {
+        if (t == null) {
+            debug(message);
+        } else {
+            debug(message + " (" + t.getClass().getName() + ": " + t.getMessage() + ")");
+            debug(t);
+        }
+    }
+
+    public static void verbose(String message, Throwable t) {
+        if (t == null) {
+            verbose(message);
+        } else {
+            verbose(message + " (" + t.getClass().getName() + ": " + t.getMessage() + ")");
+            debug(t);
+        }
+    }
+
+    public static void info(String message, Throwable t) {
+        if (t == null) {
+            info(message);
+        } else {
+            info(message + " (" + t.getClass().getName() + ": " + t.getMessage() + ")");
+            debug(t);
+        }
+    }
+
+    public static void warn(String message, Throwable t) {
+        if (t == null) {
+            warn(message);
+        } else {
+            warn(message + " (" + t.getClass().getName() + ": " + t.getMessage() + ")");
+            debug(t);
+        }
+    }
+
+    public static void error(String message, Throwable t) {
+        if (t == null) {
+            error(message);
+        } else {
+            error(message + " (" + t.getClass().getName() + ": " + t.getMessage() + ")");
+            debug(t);
+        }
+    }
+
+    public static void debug(Throwable t) {
+        debug(StringUtils.getStackTrace(t));
+    }
+
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/PropertiesFile.java Sun Aug 19 22:15:36 2012
@@ -40,8 +40,7 @@ public class PropertiesFile extends Prop
                 fis = new FileInputStream(file);
                 load(fis);
             } catch (Exception ex) {
-                Message.warn("exception occurred while reading properties file " + file + ": "
-                        + ex.getMessage());
+                Message.warn("exception occurred while reading properties file " + file, ex);
             }
             try {
                 if (fis != null) {
@@ -62,8 +61,7 @@ public class PropertiesFile extends Prop
             fos = new FileOutputStream(file);
             store(fos, header);
         } catch (Exception ex) {
-            Message.warn("exception occurred while writing properties file " + file + ": "
-                    + ex.getMessage());
+            Message.warn("exception occurred while writing properties file " + file, ex);
         }
         try {
             if (fos != null) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/StringUtils.java Sun Aug 19 22:15:36 2012
@@ -17,8 +17,8 @@
  */
 package org.apache.ivy.util;
 
-import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Locale;
 
@@ -73,17 +73,14 @@ public final class StringUtils {
      *            the exception to get the stack trace from.
      * @return the exception stack trace
      */
-    public static String getStackTrace(Exception e) {
+    public static String getStackTrace(Throwable e) {
         if (e == null) {
             return "";
         }
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        PrintWriter printWriter = new PrintWriter(baos);
+        StringWriter sw = new StringWriter();
+        PrintWriter printWriter = new PrintWriter(sw, true);
         e.printStackTrace(printWriter);
-        printWriter.flush();
-        String stackTrace = new String(baos.toByteArray());
-        printWriter.close();
-        return stackTrace;
+        return sw.getBuffer().toString();
     }
 
     /**

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/XMLHelper.java Sun Aug 19 22:15:36 2012
@@ -64,9 +64,8 @@ public abstract class XMLHelper {
                 parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                 parser.setProperty(JAXP_SCHEMA_SOURCE, schemaStream);
             } catch (SAXNotRecognizedException ex) {
-                System.err.println(
-                    "WARNING: problem while setting JAXP validating property on SAXParser... "
-                    + "XML validation will not be done: " + ex.getMessage());
+                Message.warn("problem while setting JAXP validating property on SAXParser... "
+                        + "XML validation will not be done", ex);
                 canUseSchemaValidation = false;
                 parserFactory.setValidating(false);
                 parser = parserFactory.newSAXParser();
@@ -123,9 +122,8 @@ public abstract class XMLHelper {
                 try {
                     parser.setProperty("http://xml.org/sax/properties/lexical-handler", lHandler);
                 } catch (SAXException ex) {
-                    System.err.println(
-                        "WARNING: problem while setting the lexical handler property on SAXParser: "
-                                    + ex.getMessage());
+                    Message.warn("problem while setting the lexical handler property on SAXParser",
+                        ex);
                     // continue without the lexical handler
                 }
             }
@@ -197,7 +195,6 @@ public abstract class XMLHelper {
         try {
             pomDomDoc = docBuilder.parse(stream, res.getName());
         } catch (SAXException e) {
-            e.printStackTrace();
             throw e;
         } finally {
             stream.close();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=1374870&r1=1374869&r2=1374870&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java Sun Aug 19 22:15:36 2012
@@ -89,7 +89,7 @@ public class BasicURLHandler extends Abs
             Message.info("You probably access the destination server through "
                 + "a proxy server that is not well configured.");
         } catch (IOException e) {
-            Message.error("Server access Error: " + e.getMessage() + " url=" + url);
+            Message.error("Server access error at url " + url, e);
         } finally {
             disconnect(con);
         }



Mime
View raw message