You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by steve rock <st...@gmail.com> on 2005/08/14 17:51:48 UTC

h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Here's my component. 

 <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
value="#{userTool.newUserFeatures}"  >
      <f:selectItems value="#{userTool.featureSelectItems}"/>
</h:selectManyCheckbox>

It presents a list of radio stations a user can select. However as
part of the business requirements they can have none selected. When I
select none and submit the form, I get a NullPointerException. How
come?


Here is the stack trace:

java.lang.NullPointerException
	at org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:118)
	at org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:792)
	at org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue(HtmlCheckboxRendererBase.java:260)
	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.UIComponentBase.processValidators(UIComponentBase.java:427)
	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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(StationToolsRequestContextFilter.java:49)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
	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.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	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)

Re: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by steve rock <st...@gmail.com>.
Figured out the problem. Bug in v1.0.9rc3. Upgraded to v1.0.9m9 and
everything works fine.
-Steve

On 8/19/05, steve rock <st...@gmail.com> wrote:
> 1.0.9
> -Steve
> 
> On 8/18/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> > I am really sorry. Must be in a daze or something to not see the stacktrace.
> >
> > What version of myfaces are you using?
> >
> > -----Original Message-----
> > From: steve rock [mailto:stevenrock@gmail.com]
> > Sent: Thursday, August 18, 2005 4:30 PM
> > To: MyFaces Discussion; rpilani@3ptsoft.com
> > Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> > selected. Why?
> >
> > Stack trace is in first message.
> >
> > It's occuring in UISelectMany.getConvertedValue
> >
> > which is definitly in the myfaces lib.  I put debug in all my
> > functions calls and don't see that being called yet.
> >
> > -Steve
> >
> > On 8/17/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> > > Can you paste the stacktrace. It would be more helpful to know where
> > exactly
> > > is the nullpointer exception happening..
> > >
> > > It might not be the component's fault. This is the behaviour I was
> > > experiencing with myfaces 1.09 , might be something similar in your case.
> > >
> > > I had a bunch of different radio buttons in a datatable, all disconnected
> > > and having an individual selectOneRadio. For each radio that was not
> > > selected, myfaces was setting the corresponding backing bean value to
> > null.
> > >
> > > And my application was crashing because if some earlier radio button was
> > > clicked, but not a later one, then the end result would be a null value in
> > > the backing bean due to the later radio button.
> > >
> > > Hope this helps..
> > >
> > > Rahul
> > >
> > >
> > > -----Original Message-----
> > > From: steve rock [mailto:stevenrock@gmail.com]
> > > Sent: Wednesday, August 17, 2005 3:55 PM
> > > To: MyFaces Discussion
> > > Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> > > selected. Why?
> > >
> > > Second request. Stopping me from implementing a new feature in production.
> > >
> > > I basically have a list of checkboxes on a form that throws an error
> > > if none of them are selected. I need to be able to not have to select
> > > any checkboxes. Any ideas?
> > >
> > > -Steve
> > >
> > > On 8/14/05, steve rock <st...@gmail.com> wrote:
> > > > Here's my component.
> > > >
> > > >  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> > > > value="#{userTool.newUserFeatures}"  >
> > > >       <f:selectItems value="#{userTool.featureSelectItems}"/>
> > > > </h:selectManyCheckbox>
> > > >
> > > > It presents a list of radio stations a user can select. However as
> > > > part of the business requirements they can have none selected. When I
> > > > select none and submit the form, I get a NullPointerException. How
> > > > come?
> > > >
> > > >
> > > > Here is the stack trace:
> > > >
> > > > java.lang.NullPointerException
> > > >         at
> > >
> > org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyVa
> > > lue(_SharedRendererUtils.java:118)
> > > >         at
> > >
> > org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(Ren
> > > dererUtils.java:792)
> > > >         at
> > >
> > org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue
> > > (HtmlCheckboxRendererBase.java:260)
> > > >         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.UIComponentBase.processValidators(UIComponentBase.java
> > > :427)
> > > >         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > > FilterChain.java:237)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > > ain.java:157)
> > > >         at
> > >
> > com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(S
> > > tationToolsRequestContextFilter.java:49)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > > FilterChain.java:186)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > > ain.java:157)
> > > >         at
> > >
> > org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsF
> > > ilter.java:112)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > > FilterChain.java:186)
> > > >         at
> > >
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > > ain.java:157)
> > > >         at
> > >
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> > > va:214)
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.java:104)
> > > >         at
> > >
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > > >         at
> > >
> > org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> > > Valve.java:198)
> > > >         at
> > >
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> > > va:152)
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.java:104)
> > > >         at
> > >
> > org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> > > ationValve.java:72)
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.java:102)
> > > >         at
> > >
> > org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
> > > ealm.java:275)
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.java:102)
> > > >         at
> > >
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> > > .java:540)
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.java:102)
> > > >         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(StandardValveContex
> > > t.java:104)
> > > >         at
> > >
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
> > > )
> > > >         at
> > >
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > > t.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(StandardValveContex
> > > t.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.processConne
> > > ction(Http11Protocol.java:705)
> > > >         at
> > > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> > > >         at
> > >
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> > > a:683)
> > > >         at java.lang.Thread.run(Thread.java:534)
> > > >
> > >
> > >
> >
> >
>

Re: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by steve rock <st...@gmail.com>.
1.0.9
-Steve

On 8/18/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> I am really sorry. Must be in a daze or something to not see the stacktrace.
> 
> What version of myfaces are you using?
> 
> -----Original Message-----
> From: steve rock [mailto:stevenrock@gmail.com]
> Sent: Thursday, August 18, 2005 4:30 PM
> To: MyFaces Discussion; rpilani@3ptsoft.com
> Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> selected. Why?
> 
> Stack trace is in first message.
> 
> It's occuring in UISelectMany.getConvertedValue
> 
> which is definitly in the myfaces lib.  I put debug in all my
> functions calls and don't see that being called yet.
> 
> -Steve
> 
> On 8/17/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> > Can you paste the stacktrace. It would be more helpful to know where
> exactly
> > is the nullpointer exception happening..
> >
> > It might not be the component's fault. This is the behaviour I was
> > experiencing with myfaces 1.09 , might be something similar in your case.
> >
> > I had a bunch of different radio buttons in a datatable, all disconnected
> > and having an individual selectOneRadio. For each radio that was not
> > selected, myfaces was setting the corresponding backing bean value to
> null.
> >
> > And my application was crashing because if some earlier radio button was
> > clicked, but not a later one, then the end result would be a null value in
> > the backing bean due to the later radio button.
> >
> > Hope this helps..
> >
> > Rahul
> >
> >
> > -----Original Message-----
> > From: steve rock [mailto:stevenrock@gmail.com]
> > Sent: Wednesday, August 17, 2005 3:55 PM
> > To: MyFaces Discussion
> > Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> > selected. Why?
> >
> > Second request. Stopping me from implementing a new feature in production.
> >
> > I basically have a list of checkboxes on a form that throws an error
> > if none of them are selected. I need to be able to not have to select
> > any checkboxes. Any ideas?
> >
> > -Steve
> >
> > On 8/14/05, steve rock <st...@gmail.com> wrote:
> > > Here's my component.
> > >
> > >  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> > > value="#{userTool.newUserFeatures}"  >
> > >       <f:selectItems value="#{userTool.featureSelectItems}"/>
> > > </h:selectManyCheckbox>
> > >
> > > It presents a list of radio stations a user can select. However as
> > > part of the business requirements they can have none selected. When I
> > > select none and submit the form, I get a NullPointerException. How
> > > come?
> > >
> > >
> > > Here is the stack trace:
> > >
> > > java.lang.NullPointerException
> > >         at
> >
> org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyVa
> > lue(_SharedRendererUtils.java:118)
> > >         at
> >
> org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(Ren
> > dererUtils.java:792)
> > >         at
> >
> org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue
> > (HtmlCheckboxRendererBase.java:260)
> > >         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.UIComponentBase.processValidators(UIComponentBase.java
> > :427)
> > >         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:237)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:157)
> > >         at
> >
> com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(S
> > tationToolsRequestContextFilter.java:49)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:186)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:157)
> > >         at
> >
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsF
> > ilter.java:112)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> > FilterChain.java:186)
> > >         at
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> > ain.java:157)
> > >         at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> > va:214)
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.java:104)
> > >         at
> >
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > >         at
> >
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> > Valve.java:198)
> > >         at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> > va:152)
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.java:104)
> > >         at
> >
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> > ationValve.java:72)
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.java:102)
> > >         at
> >
> org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
> > ealm.java:275)
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.java:102)
> > >         at
> >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> > .java:540)
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.java:102)
> > >         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(StandardValveContex
> > t.java:104)
> > >         at
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
> > )
> > >         at
> >
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> > t.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(StandardValveContex
> > t.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.processConne
> > ction(Http11Protocol.java:705)
> > >         at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> > >         at
> >
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> > a:683)
> > >         at java.lang.Thread.run(Thread.java:534)
> > >
> >
> >
> 
>

RE: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by Rahul Pilani <rp...@3ptsoft.com>.
I am really sorry. Must be in a daze or something to not see the stacktrace.

What version of myfaces are you using?

-----Original Message-----
From: steve rock [mailto:stevenrock@gmail.com] 
Sent: Thursday, August 18, 2005 4:30 PM
To: MyFaces Discussion; rpilani@3ptsoft.com
Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
selected. Why?

Stack trace is in first message. 

It's occuring in UISelectMany.getConvertedValue

which is definitly in the myfaces lib.  I put debug in all my
functions calls and don't see that being called yet.

-Steve

On 8/17/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> Can you paste the stacktrace. It would be more helpful to know where
exactly
> is the nullpointer exception happening..
> 
> It might not be the component's fault. This is the behaviour I was
> experiencing with myfaces 1.09 , might be something similar in your case.
> 
> I had a bunch of different radio buttons in a datatable, all disconnected
> and having an individual selectOneRadio. For each radio that was not
> selected, myfaces was setting the corresponding backing bean value to
null.
> 
> And my application was crashing because if some earlier radio button was
> clicked, but not a later one, then the end result would be a null value in
> the backing bean due to the later radio button.
> 
> Hope this helps..
> 
> Rahul
> 
> 
> -----Original Message-----
> From: steve rock [mailto:stevenrock@gmail.com]
> Sent: Wednesday, August 17, 2005 3:55 PM
> To: MyFaces Discussion
> Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> selected. Why?
> 
> Second request. Stopping me from implementing a new feature in production.
> 
> I basically have a list of checkboxes on a form that throws an error
> if none of them are selected. I need to be able to not have to select
> any checkboxes. Any ideas?
> 
> -Steve
> 
> On 8/14/05, steve rock <st...@gmail.com> wrote:
> > Here's my component.
> >
> >  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> > value="#{userTool.newUserFeatures}"  >
> >       <f:selectItems value="#{userTool.featureSelectItems}"/>
> > </h:selectManyCheckbox>
> >
> > It presents a list of radio stations a user can select. However as
> > part of the business requirements they can have none selected. When I
> > select none and submit the form, I get a NullPointerException. How
> > come?
> >
> >
> > Here is the stack trace:
> >
> > java.lang.NullPointerException
> >         at
>
org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyVa
> lue(_SharedRendererUtils.java:118)
> >         at
>
org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(Ren
> dererUtils.java:792)
> >         at
>
org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue
> (HtmlCheckboxRendererBase.java:260)
> >         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.UIComponentBase.processValidators(UIComponentBase.java
> :427)
> >         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:237)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
>
com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(S
> tationToolsRequestContextFilter.java:49)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:186)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
>
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsF
> ilter.java:112)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:186)
> >         at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:214)
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> >         at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
>
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> Valve.java:198)
> >         at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:152)
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> >         at
>
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> ationValve.java:72)
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         at
>
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
> ealm.java:275)
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         at
>
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> .java:540)
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         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(StandardValveContex
> t.java:104)
> >         at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
> )
> >         at
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.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(StandardValveContex
> t.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.processConne
> ction(Http11Protocol.java:705)
> >         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> >         at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> a:683)
> >         at java.lang.Thread.run(Thread.java:534)
> >
> 
>


Re: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by steve rock <st...@gmail.com>.
Stack trace is in first message. 

It's occuring in UISelectMany.getConvertedValue

which is definitly in the myfaces lib.  I put debug in all my
functions calls and don't see that being called yet.

-Steve

On 8/17/05, Rahul Pilani <rp...@3ptsoft.com> wrote:
> Can you paste the stacktrace. It would be more helpful to know where exactly
> is the nullpointer exception happening..
> 
> It might not be the component's fault. This is the behaviour I was
> experiencing with myfaces 1.09 , might be something similar in your case.
> 
> I had a bunch of different radio buttons in a datatable, all disconnected
> and having an individual selectOneRadio. For each radio that was not
> selected, myfaces was setting the corresponding backing bean value to null.
> 
> And my application was crashing because if some earlier radio button was
> clicked, but not a later one, then the end result would be a null value in
> the backing bean due to the later radio button.
> 
> Hope this helps..
> 
> Rahul
> 
> 
> -----Original Message-----
> From: steve rock [mailto:stevenrock@gmail.com]
> Sent: Wednesday, August 17, 2005 3:55 PM
> To: MyFaces Discussion
> Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
> selected. Why?
> 
> Second request. Stopping me from implementing a new feature in production.
> 
> I basically have a list of checkboxes on a form that throws an error
> if none of them are selected. I need to be able to not have to select
> any checkboxes. Any ideas?
> 
> -Steve
> 
> On 8/14/05, steve rock <st...@gmail.com> wrote:
> > Here's my component.
> >
> >  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> > value="#{userTool.newUserFeatures}"  >
> >       <f:selectItems value="#{userTool.featureSelectItems}"/>
> > </h:selectManyCheckbox>
> >
> > It presents a list of radio stations a user can select. However as
> > part of the business requirements they can have none selected. When I
> > select none and submit the form, I get a NullPointerException. How
> > come?
> >
> >
> > Here is the stack trace:
> >
> > java.lang.NullPointerException
> >         at
> org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyVa
> lue(_SharedRendererUtils.java:118)
> >         at
> org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(Ren
> dererUtils.java:792)
> >         at
> org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue
> (HtmlCheckboxRendererBase.java:260)
> >         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.UIComponentBase.processValidators(UIComponentBase.java
> :427)
> >         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:237)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
> com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(S
> tationToolsRequestContextFilter.java:49)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:186)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsF
> ilter.java:112)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:186)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:157)
> >         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:214)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> >         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> Valve.java:198)
> >         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:152)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:104)
> >         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
> ationValve.java:72)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         at
> org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
> ealm.java:275)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> .java:540)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.java:102)
> >         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(StandardValveContex
> t.java:104)
> >         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
> )
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
> t.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(StandardValveContex
> t.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.processConne
> ction(Http11Protocol.java:705)
> >         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> >         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> a:683)
> >         at java.lang.Thread.run(Thread.java:534)
> >
> 
>

RE: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by Rahul Pilani <rp...@3ptsoft.com>.
Can you paste the stacktrace. It would be more helpful to know where exactly
is the nullpointer exception happening..

It might not be the component's fault. This is the behaviour I was
experiencing with myfaces 1.09 , might be something similar in your case.

I had a bunch of different radio buttons in a datatable, all disconnected
and having an individual selectOneRadio. For each radio that was not
selected, myfaces was setting the corresponding backing bean value to null.

And my application was crashing because if some earlier radio button was
clicked, but not a later one, then the end result would be a null value in
the backing bean due to the later radio button.

Hope this helps..

Rahul
 

-----Original Message-----
From: steve rock [mailto:stevenrock@gmail.com] 
Sent: Wednesday, August 17, 2005 3:55 PM
To: MyFaces Discussion
Subject: Re: h:selectManyCheckbox throwing NullPointerException when none
selected. Why?

Second request. Stopping me from implementing a new feature in production. 

I basically have a list of checkboxes on a form that throws an error
if none of them are selected. I need to be able to not have to select
any checkboxes. Any ideas?

-Steve

On 8/14/05, steve rock <st...@gmail.com> wrote:
> Here's my component.
> 
>  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> value="#{userTool.newUserFeatures}"  >
>       <f:selectItems value="#{userTool.featureSelectItems}"/>
> </h:selectManyCheckbox>
> 
> It presents a list of radio stations a user can select. However as
> part of the business requirements they can have none selected. When I
> select none and submit the form, I get a NullPointerException. How
> come?
> 
> 
> Here is the stack trace:
> 
> java.lang.NullPointerException
>         at
org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyVa
lue(_SharedRendererUtils.java:118)
>         at
org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(Ren
dererUtils.java:792)
>         at
org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue
(HtmlCheckboxRendererBase.java:260)
>         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.UIComponentBase.processValidators(UIComponentBase.java
:427)
>         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
>         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
>         at
com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(S
tationToolsRequestContextFilter.java:49)
>         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:186)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
>         at
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsF
ilter.java:112)
>         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:186)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
>         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
>         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>         at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
>         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
>         at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssoci
ationValve.java:72)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
>         at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrR
ealm.java:275)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
>         at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:540)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
>         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(StandardValveContex
t.java:104)
>         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
)
>         at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.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(StandardValveContex
t.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.processConne
ction(Http11Protocol.java:705)
>         at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
>         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:683)
>         at java.lang.Thread.run(Thread.java:534)
>


Re: h:selectManyCheckbox throwing NullPointerException when none selected. Why?

Posted by steve rock <st...@gmail.com>.
Second request. Stopping me from implementing a new feature in production. 

I basically have a list of checkboxes on a form that throws an error
if none of them are selected. I need to be able to not have to select
any checkboxes. Any ideas?

-Steve

On 8/14/05, steve rock <st...@gmail.com> wrote:
> Here's my component.
> 
>  <h:selectManyCheckbox id="stationFeatures" layout="pageDirection"
> value="#{userTool.newUserFeatures}"  >
>       <f:selectItems value="#{userTool.featureSelectItems}"/>
> </h:selectManyCheckbox>
> 
> It presents a list of radio stations a user can select. However as
> part of the business requirements they can have none selected. When I
> select none and submit the form, I get a NullPointerException. How
> come?
> 
> 
> Here is the stack trace:
> 
> java.lang.NullPointerException
>         at org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:118)
>         at org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:792)
>         at org.apache.myfaces.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue(HtmlCheckboxRendererBase.java:260)
>         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.UIComponentBase.processValidators(UIComponentBase.java:427)
>         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.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:70)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>         at com.m2g.stationtools.web.filters.StationToolsRequestContextFilter.doFilter(StationToolsRequestContextFilter.java:49)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
>         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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>         at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
>         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.StandardHostValve.invoke(StandardHostValve.java:137)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
>         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)
>