
|
If you were logged in you would be able to see more operations.
|
|
|
|
If I have both the BeforeAfterMethodInterceptor and Nic's SecurityInterceptor specified in web.xml I get a NPE at BeforeAfterMethodInterceptor.java:111 because the return of context.getActionBean() isn't checked for null. The @Before handler directly above works correctly because it is checking for null.
This fixes it:
Index: BeforeAfterMethodInterceptor.java
===================================================================
--- BeforeAfterMethodInterceptor.java (revision 424)
+++ BeforeAfterMethodInterceptor.java (working copy)
@@ -106,21 +106,23 @@
// Continue on and execute other filters and the lifecycle code
resolution = context.proceed();
- // Run After filter methods (if any)
- ActionBean bean = context.getActionBean();
- FilterMethods filterMethods = getFilterMethods(bean.getClass());
- List<Method> afterMethods = filterMethods.getAfterMethods(stage);
+ // Run @After methods, as long as there's a bean to run them on
+ if (context.getActionBean() != null) {
+ ActionBean bean = context.getActionBean();
+ FilterMethods filterMethods = getFilterMethods(bean.getClass());
+ List<Method> afterMethods = filterMethods.getAfterMethods(stage);
- Resolution overrideResolution = null;
- for (Method method : afterMethods) {
- overrideResolution = invoke(bean, method, stage, After.class);
- if (overrideResolution != null) {
- return overrideResolution;
+ Resolution overrideResolution = null;
+ for (Method method : afterMethods) {
+ overrideResolution = invoke(bean, method, stage, After.class);
+ if (overrideResolution != null) {
+ return overrideResolution;
+ }
}
}
- return resolution;
- }
+ return resolution;
+ }
|
|
Description
|
If I have both the BeforeAfterMethodInterceptor and Nic's SecurityInterceptor specified in web.xml I get a NPE at BeforeAfterMethodInterceptor.java:111 because the return of context.getActionBean() isn't checked for null. The @Before handler directly above works correctly because it is checking for null.
This fixes it:
Index: BeforeAfterMethodInterceptor.java
===================================================================
--- BeforeAfterMethodInterceptor.java (revision 424)
+++ BeforeAfterMethodInterceptor.java (working copy)
@@ -106,21 +106,23 @@
// Continue on and execute other filters and the lifecycle code
resolution = context.proceed();
- // Run After filter methods (if any)
- ActionBean bean = context.getActionBean();
- FilterMethods filterMethods = getFilterMethods(bean.getClass());
- List<Method> afterMethods = filterMethods.getAfterMethods(stage);
+ // Run @After methods, as long as there's a bean to run them on
+ if (context.getActionBean() != null) {
+ ActionBean bean = context.getActionBean();
+ FilterMethods filterMethods = getFilterMethods(bean.getClass());
+ List<Method> afterMethods = filterMethods.getAfterMethods(stage);
- Resolution overrideResolution = null;
- for (Method method : afterMethods) {
- overrideResolution = invoke(bean, method, stage, After.class);
- if (overrideResolution != null) {
- return overrideResolution;
+ Resolution overrideResolution = null;
+ for (Method method : afterMethods) {
+ overrideResolution = invoke(bean, method, stage, After.class);
+ if (overrideResolution != null) {
+ return overrideResolution;
+ }
}
}
- return resolution;
- }
+ return resolution;
+ }
|
Show » |
|
|