File apache-tomcat-isconfigproblemfatal.patch of Package tomcat6.import5619
---
java/org/apache/catalina/filters/CsrfPreventionFilter.java | 7 ++++
java/org/apache/catalina/filters/FilterBase.java | 20 +++++++++++--
webapps/docs/changelog.xml | 4 ++
3 files changed, 29 insertions(+), 2 deletions(-)
Index: apache-tomcat-6.0.32-src/java/org/apache/catalina/filters/FilterBase.java
===================================================================
--- apache-tomcat-6.0.32-src.orig/java/org/apache/catalina/filters/FilterBase.java 2012-01-05 12:13:48.074439868 +0100
+++ apache-tomcat-6.0.32-src/java/org/apache/catalina/filters/FilterBase.java 2012-01-05 12:17:59.202265516 +0100
@@ -49,8 +49,13 @@
String paramName = (String) paramNames.nextElement();
if (!IntrospectionUtils.setProperty(this, paramName,
filterConfig.getInitParameter(paramName))) {
- getLogger().warn(sm.getString("filterbase.noSuchProperty",
- paramName, this.getClass().getName()));
+ String msg = sm.getString("filterbase.noSuchProperty",
+ paramName, this.getClass().getName());
+ if (isConfigProblemFatal()) {
+ throw new ServletException(msg);
+ } else {
+ getLogger().warn(msg);
+ }
}
}
}
@@ -59,4 +64,15 @@
// NOOP
}
+ /**
+ * Determines if an exception when calling a setter or an unknown
+ * configuration attribute triggers the failure of the this filter which in
+ * turn will prevent the web application from starting.
+ *
+ * @return <code>true</code> if a problem should trigger the failure of this
+ * filter, else <code>false</code>
+ */
+ protected boolean isConfigProblemFatal() {
+ return false;
+ }
}
Index: apache-tomcat-6.0.32-src/java/org/apache/catalina/filters/CsrfPreventionFilter.java
===================================================================
--- apache-tomcat-6.0.32-src.orig/java/org/apache/catalina/filters/CsrfPreventionFilter.java 2012-01-05 12:13:48.078440009 +0100
+++ apache-tomcat-6.0.32-src/java/org/apache/catalina/filters/CsrfPreventionFilter.java 2012-01-05 12:17:59.231266535 +0100
@@ -186,6 +186,13 @@
chain.doFilter(request, wResponse);
}
+
+ @Override
+ protected boolean isConfigProblemFatal() {
+ return true;
+ }
+
+
/**
* Generate a once time token (nonce) for authenticating subsequent
* requests. This will also add the token to the session. The nonce
Index: apache-tomcat-6.0.32-src/webapps/docs/changelog.xml
===================================================================
--- apache-tomcat-6.0.32-src.orig/webapps/docs/changelog.xml 2012-01-05 12:13:48.080440079 +0100
+++ apache-tomcat-6.0.32-src/webapps/docs/changelog.xml 2012-01-05 12:17:59.240266851 +0100
@@ -616,6 +616,10 @@
add DetailPrint statements for operations that may take time and
improve the descriptions of the components. (kkolinko, mturk, markt)
</update>
+ <add>
+ Make configuration issue for CsrfPreventionFilter result in the
+ failure of the filter rather than just a warning message. (kkolinko)
+ </add>
</changelog>
</subsection>
</section>