You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2013/01/04 18:32:18 UTC
svn commit: r1428993 -
/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
Author: kkolinko
Date: Fri Jan 4 17:32:18 2013
New Revision: 1428993
URL: http://svn.apache.org/viewvc?rev=1428993&view=rev
Log:
Review of r1428643
Align implememntation between IS_SECURITY_ENABLED true and false branches
(essentially add i18n to the IS_SECURITY_ENABLED==true branch).
Add the same fix to setFilterDef(null), though I think nobody passes null filterDef to that method.
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=1428993&r1=1428992&r2=1428993&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java Fri Jan 4 17:32:18 2013
@@ -301,23 +301,22 @@ public final class ApplicationFilterConf
if (this.filter != null)
{
- if (Globals.IS_SECURITY_ENABLED) {
- try {
- SecurityUtil.doAsPrivilege("destroy", filter);
- } catch(java.lang.Exception ex){
- context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
- }
- SecurityUtil.remove(filter);
- } else {
- try {
+ try {
+ if (Globals.IS_SECURITY_ENABLED) {
+ try {
+ SecurityUtil.doAsPrivilege("destroy", filter);
+ } finally {
+ SecurityUtil.remove(filter);
+ }
+ } else {
filter.destroy();
- } catch (Throwable t) {
- ExceptionUtils.handleThrowable(t);
- context.getLogger().error(sm.getString(
- "applicationFilterConfig.release",
- filterDef.getFilterName(),
- filterDef.getFilterClass()), t);
}
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ context.getLogger().error(sm.getString(
+ "applicationFilterConfig.release",
+ filterDef.getFilterName(),
+ filterDef.getFilterClass()), t);
}
if (!context.getIgnoreAnnotations()) {
try {
@@ -357,20 +356,28 @@ public final class ApplicationFilterConf
IllegalAccessException, InstantiationException,
ServletException, InvocationTargetException, NamingException {
+ FilterDef oldFilterDef = this.filterDef;
this.filterDef = filterDef;
if (filterDef == null) {
// Release any previously allocated filter instance
if (this.filter != null){
- if (Globals.IS_SECURITY_ENABLED) {
- try{
- SecurityUtil.doAsPrivilege("destroy", filter);
- } catch(java.lang.Exception ex){
- context.getLogger().error("ApplicationFilterConfig.doAsPrivilege", ex);
+ try {
+ if (Globals.IS_SECURITY_ENABLED) {
+ try{
+ SecurityUtil.doAsPrivilege("destroy", filter);
+ } finally {
+ SecurityUtil.remove(filter);
+ }
+ } else {
+ filter.destroy();
}
- SecurityUtil.remove(filter);
- } else {
- filter.destroy();
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ context.getLogger().error(sm.getString(
+ "applicationFilterConfig.release",
+ oldFilterDef.getFilterName(),
+ oldFilterDef.getFilterClass()), t);
}
if (!context.getIgnoreAnnotations()) {
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org