[ http://issues.apache.org/jira/browse/MYFACES-157?page=history ]

Whitney Hunter updated MYFACES-157:
-----------------------------------

    Attachment: _SharedRendererUtils.java
                _SharedRendererUtils.java

It looks like the NullPointerException is being caused by the fact that the 
submittedValue parameter to getConvertedUISelectManyValue is null when no 
elements are selected the list box. This causes the call(s) to 
submittedValue.length() to hurl. I have patched the two _SharedRendererUtils 
classes to check for this condition.

> Null pointer exception in selectManyListbox when using converter
> ----------------------------------------------------------------
>
>          Key: MYFACES-157
>          URL: http://issues.apache.org/jira/browse/MYFACES-157
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.9 beta
>  Environment: Windows XP SP2
>     Reporter: Whitney Hunter
>     Priority: Critical
>  Attachments: _SharedRendererUtils.java, _SharedRendererUtils.java
>
> I believe that this is a new bug in 1.0.9. It seems to not exist in 1.0.8.
> When I have jsp code like this:
>   <f:view>
>     <h:form>
>       <h:panelGrid columns="1">
>         <h:selectManyListbox>
>           <f:selectItem itemLabel="one" itemValue="one" />
>           <f:selectItem itemLabel="two" itemValue="two" />
>           <f:selectItem itemLabel="three" itemValue="three" />
>           <f:converter converterId="converter" />
>         </h:selectManyListbox>
>         <h:commandButton value="submit"
>           actionListener="#{controller.submit}" />
>       </h:panelGrid>
>     </h:form>
>   </f:view>
> I get a NullPointerException when I submit the form without selecting 
> anything in the list box (no problem when a selection is made).
> Here is the stack trace:
> java.lang.NullPointerException
>       at 
> org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:151)
>       at 
> org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:792)
>       at 
> org.apache.myfaces.renderkit.html.HtmlListboxRendererBase.getConvertedValue(HtmlListboxRendererBase.java:143)
>       at 
> javax.faces.component.UISelectMany.getConvertedValue(UISelectMany.java:295)
>       at javax.faces.component.UIInput.validate(UIInput.java:291)
>       at javax.faces.component.UISelectMany.validate(UISelectMany.java:284)
>       at javax.faces.component.UIInput.processValidators(UIInput.java:166)
>       at 
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:427)
>       at javax.faces.component.UIForm.processValidators(UIForm.java:66)
>       at 
> javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:427)
>       at 
> javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:162)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:208)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:92)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>       at 
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>       at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>       at 
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>       at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
>       at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
>       at java.lang.Thread.run(Thread.java:534)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to