Author: markt
Date: Thu Aug 11 20:13:03 2016
New Revision: 1756039
URL: http://svn.apache.org/viewvc?rev=1756039&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59966
Fail Context if error page configuration in web.xml is broken.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java?rev=1756039&r1=1756038&r2=1756039&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/ErrorPage.java Thu
Aug 11 20:13:03 2016
@@ -88,9 +88,8 @@ public class ErrorPage implements Serial
try {
this.errorCode = Integer.parseInt(errorCode);
} catch (NumberFormatException nfe) {
- this.errorCode = 0;
+ throw new IllegalArgumentException(nfe);
}
-
}
Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java?rev=1756039&r1=1756038&r2=1756039&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardHostValve.java Thu
Aug 11 20:13:03 2016
@@ -73,6 +73,22 @@ public class TestStandardHostValve exten
}
+ @Test(expected=IllegalArgumentException.class)
+ public void testInvalidErrorPage() throws Exception {
+ // Set up a container
+ Tomcat tomcat = getTomcatInstance();
+
+ // No file system docBase required
+ Context ctx = tomcat.addContext("", null);
+
+ // Add a broken error page configuration
+ ErrorPage errorPage500 = new ErrorPage();
+ errorPage500.setErrorCode("java.lang.Exception");
+ errorPage500.setLocation("/report/500");
+ ctx.addErrorPage(errorPage500);
+ }
+
+
@Test
public void testSRLAfterError() throws Exception {
// Set up a container
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1756039&r1=1756038&r2=1756039&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Aug 11 20:13:03 2016
@@ -123,6 +123,10 @@
caused the attributes for forwarded requests to be lost if requested
from within a subsequent include. (markt)
</fix>
+ <fix>
+ <bug>59966</bug>: Do not start the web application if the error page
+ configuration in web.xml is invalid. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]