10 Replies Latest reply on Feb 1, 2012 12:41 PM by Alberto Calleja

    3.3.1 GA - NullPointerException in UISimpleTogglePanel

    Michael Knapp Newbie

      I'm constantly getting NullPointerExceptions in UISimpleTogglePanel,
      during AJAX request processing. I'm using simpleTogglePanel with switchType 'client' only


      java.lang.NullPointerException
       at org.richfaces.component.UISimpleTogglePanel.isWasOpened(UISimpleTogglePanel.java:72)
       at org.richfaces.component.UISimpleTogglePanel.processValidators(UISimpleTogglePanel.java:147)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at org.ajax4jsf.component.UIDataAdaptor$2.processComponent(UIDataAdaptor.java:136)
       at org.ajax4jsf.component.UIDataAdaptor$ComponentVisitor.process(UIDataAdaptor.java:105)
       at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1133)
       at org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1025)
       at org.ajax4jsf.component.UIDataAdaptor.processValidators(UIDataAdaptor.java:1189)
       at org.ajax4jsf.component.UIDataAdaptor.processValidators(UIDataAdaptor.java:1193)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at org.ajax4jsf.component.UIAjaxRegion.processValidators(UIAjaxRegion.java:121)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
       at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439)
       at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
       at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:455)
       at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:347)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
      


      This exception occurs in

       protected boolean isWasOpened()
       {
       return wasOpened;
       }
      


      'wasOpened' is initialy defined as

       private transient Boolean wasOpened = Boolean.FALSE;
      


      Therefore the Exception occurs during implicit retrieval of a 'boolean' value from a 'Boolean' variable, but this variable is null a this point in time.

      There is one case, where wasOpened is set to 'null':

       public void setIterationState(Object stateObject) {
       if (stateObject != null) {
       Object[] state = (Object[]) stateObject;
      
       this.value = state[0];
       this.wasOpened = (Boolean) state[1];
       } else {
       this.value = null;
       this.wasOpened = null;
       }
       }
      


      It is set to 'null' when 'stateObject' is 'null'.

      Is this a bug (setting a variable to 'null' which actually should not be set to 'null') ?

      Michael