[ 
http://www.stripesframework.org/jira/browse/STS-408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Fennell resolved STS-408.
-----------------------------

       Resolution: Fixed
    Fix Version/s: Release 1.5

Fixed.  Now immediately after calling setContext() we call getContext() and 
assert that we got it back.  A nice exception message is generated if null is 
returned.

> NPE in DefaultActionBeanPropertyBinder due to error in ActionBean 
> implementation
> --------------------------------------------------------------------------------
>
>                 Key: STS-408
>                 URL: http://www.stripesframework.org/jira/browse/STS-408
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.4.3
>            Reporter: Thomas Biskup
>            Priority: Trivial
>             Fix For: Release 1.5
>
>
> I'm really nitpicking here but that is what you get for providing such great 
> exception messages in the usual cases ;-) I'm just starting out with Stripes 
> and while starting a small sample project I made a stupid mistake 
> implementing the action bean (that's what you get for using code wizards 
> while having a cold) which resulted in always returning null from my 
> getContext method.
> Stripes also reacted with a NPE and I thought it might be nice to have a 
> robust handling for such situations (_really_ nitpicking here, I know - take 
> it as a praise for the quality of the framework).
> The stack trace is:
> net.sourceforge.stripes.exception.StripesServletException: Unhandled 
> exception caught by the default exception handler.
>       
> net.sourceforge.stripes.exception.DefaultExceptionHandler.handle(DefaultExceptionHandler.java:45)
>       
> net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:183)
> root cause 
> java.lang.NullPointerException
>       
> net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.validateRequiredFields(DefaultActionBeanPropertyBinder.java:589)
>       
> net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:241)
>       
> net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:185)
>       
> net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:157)
>       
> net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:107)
>       
> net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
>       
> net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:73)
>       
> net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:182)
>       
> net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:217)
>       
> net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:142)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>       
> net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:180)
> My suggested fix:
> Add a null check in the Stripes sources where the action bean is looked up 
> initially (don't know where that is - I have been learning Stripes for 20 
> minutes now ;-). If the context is null throw some appropriate exception with 
> a message like "The action bean context of action bean %1 is null - there 
> seems to be an implementation problem in your action bean. Check the 
> 'getContext'" method."
> The fix seems reasonable to me since I was bewildered for a second while 
> trying my initial project code and believed to have made a mistake when 
> defining the actual business properties. All other problems I encountered 
> beforehand (very few) yielded very nice Stripes responses. This one was 
> surprising... end of nitpicking.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to