From 373b5943b5a9d9c6f064fb4a7d54ab3d472e9417 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 15 Mar 2011 23:05:53 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50929 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 | 4 ++-- java/org/apache/catalina/connector/CoyoteInputStream.java | 10 +++++----- java/org/apache/catalina/realm/JDBCRealm.java | 2 +- java/org/apache/catalina/valves/JDBCAccessLogValve.java | 2 +- java/org/apache/naming/resources/WARDirContext.java | 2 +- java/org/apache/tomcat/util/digester/NodeCreateRule.java | 8 ++++---- webapps/docs/changelog.xml | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/java/javax/servlet/http/HttpUtils.java b/java/javax/servlet/http/HttpUtils.java index ba756e6fb..e7e1b912f 100644 --- a/java/javax/servlet/http/HttpUtils.java +++ b/java/javax/servlet/http/HttpUtils.java @@ -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); } } diff --git a/java/org/apache/catalina/connector/CoyoteInputStream.java b/java/org/apache/catalina/connector/CoyoteInputStream.java index 9d26cb9c5..dfdca5b04 100644 --- a/java/org/apache/catalina/connector/CoyoteInputStream.java +++ b/java/org/apache/catalina/connector/CoyoteInputStream.java @@ -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 { diff --git a/java/org/apache/catalina/realm/JDBCRealm.java b/java/org/apache/catalina/realm/JDBCRealm.java index 639596dfb..332ff6b96 100644 --- a/java/org/apache/catalina/realm/JDBCRealm.java +++ b/java/org/apache/catalina/realm/JDBCRealm.java @@ -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); } } diff --git a/java/org/apache/catalina/valves/JDBCAccessLogValve.java b/java/org/apache/catalina/valves/JDBCAccessLogValve.java index 2ba0069fa..767c30fea 100644 --- a/java/org/apache/catalina/valves/JDBCAccessLogValve.java +++ b/java/org/apache/catalina/valves/JDBCAccessLogValve.java @@ -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); } } diff --git a/java/org/apache/naming/resources/WARDirContext.java b/java/org/apache/naming/resources/WARDirContext.java index 8106fd1a7..264be9f47 100644 --- a/java/org/apache/naming/resources/WARDirContext.java +++ b/java/org/apache/naming/resources/WARDirContext.java @@ -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(); } diff --git a/java/org/apache/tomcat/util/digester/NodeCreateRule.java b/java/org/apache/tomcat/util/digester/NodeCreateRule.java index 296f62500..c6dd07283 100644 --- a/java/org/apache/tomcat/util/digester/NodeCreateRule.java +++ b/java/org/apache/tomcat/util/digester/NodeCreateRule.java @@ -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); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5c2e943d1..028db9a8f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -73,6 +73,10 @@ When using parallel deployment, correctly handle the scenario when the client sends multiple JSESSIONID cookies. (markt) + + 50929When wrapping an exception, include the root cause. + Patch provided by sebb. (markt) + @@ -91,10 +95,6 @@ 50928: Don't ignore keyPass attribute for HTTP BIO and NIO connectors. Based on a patch provided by sebb. (markt) - - Make root cause exception available if JSSE SSL initialisation fails. - Patch provided by sebb. (markt) - -- 2.11.0