Revision: 485
http://svn.sourceforge.net/stripes/?rev=485&view=rev
Author: bengunter
Date: 2007-03-05 21:29:44 -0800 (Mon, 05 Mar 2007)
Log Message:
-----------
Fixed a couple of NPEs. The useActionBean tag does not set an event in the
execution context (unless one is explicitly specified). That was causing a NPE
when looking for @DontBind on the handler. This also happened when looking for
@DontValidate on the handler when validate="true" was specified for
useActionBean. This fix disables binding and validation when there is no
handler present in the execution context.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
2007-03-06 03:32:12 UTC (rev 484)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
2007-03-06 05:29:44 UTC (rev 485)
@@ -176,8 +176,9 @@
public static Resolution doBindingAndValidation(final ExecutionContext ctx,
final boolean validate)
throws Exception {
// Bind the value to the bean - this includes performing field level
validation
- final boolean doBind = ctx.getHandler().getAnnotation(DontBind.class)
== null;
- final boolean doValidate = doBind && validate &&
ctx.getHandler().getAnnotation(DontValidate.class) == null;
+ final Method handler = ctx.getHandler();
+ final boolean doBind = handler != null &&
handler.getAnnotation(DontBind.class) == null;
+ final boolean doValidate = doBind && validate &&
handler.getAnnotation(DontValidate.class) == null;
final Configuration config = StripesFilter.getConfiguration();
if (doBind) {
@@ -210,8 +211,9 @@
final boolean
alwaysInvokeValidate) throws Exception {
final ValidationErrors errors =
ctx.getActionBeanContext().getValidationErrors();
final ActionBean bean = ctx.getActionBean();
- final boolean doBind = ctx.getHandler().getAnnotation(DontBind.class)
== null;
- final boolean doValidate = doBind &&
ctx.getHandler().getAnnotation(DontValidate.class) == null;
+ final Method handler = ctx.getHandler();
+ final boolean doBind = handler != null &&
handler.getAnnotation(DontBind.class) == null;
+ final boolean doValidate = doBind &&
handler.getAnnotation(DontValidate.class) == null;
Configuration config = StripesFilter.getConfiguration();
// Run the bean's validate() method if the following conditions are
met:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development