Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-903

Changing the rendered "state" of inputDate causes a NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.5-SNAPSHOT
    • 1.1.5
    • Date
    • None
    • Tomahawk 1.1.5 SNAPSHOT of February 19th 2007, JSF 1.2_2 RI, J2EE 1.5

    Description

      I have a boolean checkbox, which toggles the rendered attribute on 2 inputDate tags. When I check the "continuous" checkbox, the page refreshes and the "begins" and "ends" inputDate tags are not rendered. But when I uncheck the checkbox, I get an exception. I have tried to replace the inputDate tags with inputText tags and that works just fine. Everything seems to indicate a problem with inputDate.

      Here's the code I'm using, along with the exception thrown.

      My JSF:
      <html:form id="myForm">
      <tomahawk:selectBooleanCheckbox id="continuous"
      value="#

      {ManagedBean.continuous}

      "
      onclick="document.forms['myForm'].submit();"
      immediate="true"/>
      <html:outputText rendered="#

      {!ManagedBean.continuous}

      ">
      <tomahawk:inputDate id="begins" value="#

      {ManagedBean.begins}

      " required="true"/>
      <tomahawk:inputDate id="ends" value="#

      {ManagedBean.ends}

      " required="true"/>
      </html:outputText>
      </html:form>

      My ManagedBean:
      public class ManagedBean extends AbstractRequestBean {
      private boolean continuous;
      private Date begins;
      private Date ends;

      public ManagedBean() {
      String value = null;
      if ((value = getRequestParameter("myForm:continuous")) != null)

      { continuous = value.equalsIgnoreCase("true"); }

      else

      { continuous = false; }

      }

      public boolean getContinuous()

      { return continuous; }

      public void setContinuous(boolean continuous)

      { this.continuous = continuous; }

      public Date getBegins()

      { return begins; }

      public void setBegins(Date begins)

      { this.begins = begins; }

      public Date getEnds()

      { return ends; }

      public void setEnds(Date ends)

      { this.ends = ends; }

      }

      Exception thrown:
      java.lang.NullPointerException
      at org.apache.myfaces.custom.date.HtmlInputDate$UserData.isDateSubmitted(HtmlInputDate.java:329)
      at org.apache.myfaces.custom.date.HtmlInputDate$UserData.isSubmitValid(HtmlInputDate.java:346)
      at org.apache.myfaces.custom.date.HtmlInputDate$UserData.parse(HtmlInputDate.java:274)
      at org.apache.myfaces.custom.date.HtmlDateRenderer.getConvertedValue(HtmlDateRenderer.java:359)
      at javax.faces.component.UIInput.getConvertedValue(UIInput.java:936)
      at javax.faces.component.UIInput.validate(UIInput.java:861)
      at javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
      at javax.faces.component.UIInput.processValidators(UIInput.java:663)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
      at javax.faces.component.UIForm.processValidators(UIForm.java:229)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
      at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:667)
      at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:113)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at portal.b2b.filters.StatisticsFilter.doFilter(StatisticsFilter.java:103)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at portal.b2b.filters.UserFilter.doFilter(UserFilter.java:75)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at portal.b2b.filters.HostFilter.doFilter(HostFilter.java:97)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at portal.b2b.filters.InitializeFilter.doFilter(InitializeFilter.java:36)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
      at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
      at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
      at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
      at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

      #]

      Attachments

        1. HtmlInputDate.patch
          0.9 kB
          Zdenek Sochor

        Activity

          People

            cagatay_civici Cagatay Civici
            bjorn_stenfeldt Bjørn Stenfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: