Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50929
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Mar 2011 23:05:53 +0000 (23:05 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Mar 2011 23:05:53 +0000 (23:05 +0000)
When wrapping an exception, set the root cause

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1081987 13f79535-47bb-0310-9956-ffa450edef68

java/javax/servlet/http/HttpUtils.java
java/org/apache/catalina/connector/CoyoteInputStream.java
java/org/apache/catalina/realm/JDBCRealm.java
java/org/apache/catalina/valves/JDBCAccessLogValve.java
java/org/apache/naming/resources/WARDirContext.java
java/org/apache/tomcat/util/digester/NodeCreateRule.java
webapps/docs/changelog.xml

index ba756e6..e7e1b91 100644 (file)
@@ -182,7 +182,7 @@ public class HttpUtils {
             } while ((len - offset) > 0);
 
         } catch (IOException e) {
-            throw new IllegalArgumentException(e.getMessage());
+            throw new IllegalArgumentException(e.getMessage(), e);
         }
 
         // XXX we shouldn't assume that the only kind of POST body
@@ -194,7 +194,7 @@ public class HttpUtils {
         } catch (java.io.UnsupportedEncodingException e) {
             // XXX function should accept an encoding parameter & throw this
             // exception.  Otherwise throw something expected.
-            throw new IllegalArgumentException(e.getMessage());
+            throw new IllegalArgumentException(e.getMessage(), e);
         }
     }
 
index 9d26cb9..dfdca5b 100644 (file)
@@ -101,7 +101,7 @@ public class CoyoteInputStream
                 if (e instanceof IOException){
                     throw (IOException)e;
                 } else {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e.getMessage(), e);
                 }
             }
         } else {
@@ -131,7 +131,7 @@ public class CoyoteInputStream
                 if (e instanceof IOException){
                     throw (IOException)e;
                 } else {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e.getMessage(), e);
                 }
             }
         } else {
@@ -162,7 +162,7 @@ public class CoyoteInputStream
                 if (e instanceof IOException){
                     throw (IOException)e;
                 } else {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e.getMessage() ,e);
                 }
             }
         } else {
@@ -195,7 +195,7 @@ public class CoyoteInputStream
                 if (e instanceof IOException){
                     throw (IOException)e;
                 } else {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e.getMessage(), e);
                 }
             }
         } else {
@@ -235,7 +235,7 @@ public class CoyoteInputStream
                 if (e instanceof IOException){
                     throw (IOException)e;
                 } else {
-                    throw new RuntimeException(e.getMessage());
+                    throw new RuntimeException(e.getMessage(), e);
                 }
             }
         } else {
index 639596d..332ff6b 100644 (file)
@@ -698,7 +698,7 @@ public class JDBCRealm
                 driver = (Driver) clazz.newInstance();
             } catch (Throwable e) {
                 ExceptionUtils.handleThrowable(e);
-                throw new SQLException(e.getMessage());
+                throw new SQLException(e.getMessage(), e);
             }
         }
 
index 2ba0069..767c30f 100644 (file)
@@ -573,7 +573,7 @@ public final class JDBCAccessLogValve extends ValveBase implements AccessLog {
                 driver = (Driver) clazz.newInstance();
             } catch (Throwable e) {
                 ExceptionUtils.handleThrowable(e);
-                throw new SQLException(e.getMessage());
+                throw new SQLException(e.getMessage(), e);
             }
         }
 
index 8106fd1..264be9f 100644 (file)
@@ -990,7 +990,7 @@ public class WARDirContext extends BaseDirContext {
                     return is;
                 }
             } catch (ZipException e) {
-                throw new IOException(e.getMessage());
+                throw new IOException(e.getMessage(), e);
             }
             return super.streamContent();
         }
index 296f625..c6dd072 100644 (file)
@@ -172,7 +172,7 @@ public class NodeCreateRule extends Rule {
                     top.appendChild(doc.createTextNode(str));
                 }
             } catch (DOMException e) {
-                throw new SAXException(e.getMessage());
+                throw new SAXException(e.getMessage(), e);
             }
 
         }
@@ -202,7 +202,7 @@ public class NodeCreateRule extends Rule {
                 top = top.getParentNode();
                 depth--;
             } catch (DOMException e) {
-                throw new SAXException(e.getMessage());
+                throw new SAXException(e.getMessage(), e);
             }
 
         }
@@ -225,7 +225,7 @@ public class NodeCreateRule extends Rule {
             try {
                 top.appendChild(doc.createProcessingInstruction(target, data));
             } catch (DOMException e) {
-                throw new SAXException(e.getMessage());
+                throw new SAXException(e.getMessage(), e);
             }
 
         }
@@ -270,7 +270,7 @@ public class NodeCreateRule extends Rule {
                 previousTop.appendChild(top);
                 depth++;
             } catch (DOMException e) {
-                throw new SAXException(e.getMessage());
+                throw new SAXException(e.getMessage(), e);
             }
 
         }
index 5c2e943..028db9a 100644 (file)
         When using parallel deployment, correctly handle the scenario when the
         client sends multiple JSESSIONID cookies. (markt)
       </fix>
+      <fix>
+        <bug>50929</bug>When wrapping an exception, include the root cause.
+        Patch provided by sebb. (markt) 
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">
         <bug>50928</bug>: Don&apos;t ignore keyPass attribute for HTTP BIO and
         NIO connectors. Based on a patch provided by sebb. (markt)
       </fix>
-      <fix>
-        Make root cause exception available if JSSE SSL initialisation fails.
-        Patch provided by sebb. (markt) 
-      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">