Author: maartenc
Date: Mon Apr  7 15:32:30 2008
New Revision: 645714

URL: http://svn.apache.org/viewvc?rev=645714&view=rev
Log:
Make sure the cause of the SAXException is printed in stacktraces, this will 
make it easier to find parsing problems.

Modified:
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
    
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=645714&r1=645713&r2=645714&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java 
Mon Apr  7 15:32:30 2008
@@ -213,9 +213,14 @@
                 moduleStarted(attributes);
             }
         } catch (ParseException ex) {
-            throw new SAXException("problem in config file: " + 
ex.getMessage(), ex);
+            SAXException sax = new SAXException("problem in config file: " + 
ex.getMessage(), ex);
+            sax.initCause(ex);
+            throw sax;
         } catch (IOException ex) {
-            throw new SAXException("io problem while parsing config file: " + 
ex.getMessage(), ex);
+            SAXException sax = new SAXException("io problem while parsing 
config file: " 
+                        + ex.getMessage(), ex);
+            sax.initCause(ex);
+            throw sax;
         }
     }
 

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=645714&r1=645713&r2=645714&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
 Mon Apr  7 15:32:30 2008
@@ -336,8 +336,10 @@
                 if (ex instanceof SAXException) {
                     throw (SAXException) ex;
                 }
-                throw new SAXException("problem occured while parsing ivy 
file. message: "
+                SAXException sax = new SAXException("Problem occured while 
parsing ivy file: "
                         + ex.getMessage(), ex);
+                sax.initCause(ex);
+                throw sax;
             }
         }
 


Reply via email to