ICEfaces
  1. ICEfaces
  2. ICE-4393

Exception when using selectManyCheckbox with SelectItemGroup and lineDirection layout

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      linux

      Description

      Exception when using selectManyCheckbox with SelectItemGroup and lineDirection layout:


      SEVERE: Problem encountered during View.servePage
      javax.faces.FacesException: java.lang.NullPointerException
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:128)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
              at com.icesoft.faces.context.View$2$1.respond(View.java:47)
              at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:197)
              at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
              at com.icesoft.faces.context.View$2.serve(View.java:72)
              at com.icesoft.faces.context.View.servePage(View.java:133)
              at com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:52)
              at com.icesoft.faces.webapp.http.common.ServerProxy.service(ServerProxy.java:11)
              at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet$4.service(MainSessionBoundServlet.java:114)
              at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
              at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
              at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:42)
              at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
              at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
              at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:62)
              at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
              at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:153)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
              at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:696)
              at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:667)
              at org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
              at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
              at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
              at com.icesoft.faces.renderkit.dom_html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:137)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:848)
              at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:528)
              at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:522)
              at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:522)
              at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:481)
              at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              ... 46 more

        Activity

        Hide
        Ken Fyten added a comment -

        Suggested fix patch from contributed by Michal Bouska:

        Index: icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java
        ===================================================================
        — icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java (revision 18792)
        +++ icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java (working copy)
        @@ -40,14 +40,16 @@
        import org.w3c.dom.Node;

        import javax.faces.component.UIComponent;
        -import javax.faces.component.UIInput;
        import javax.faces.component.UISelectMany;
        import javax.faces.context.FacesContext;
        -import javax.faces.context.ResponseWriter;
        import javax.faces.model.SelectItem;
        import javax.faces.model.SelectItemGroup;
        import java.io.IOException;
        -import java.util.*;
        +import java.util.ArrayList;
        +import java.util.HashSet;
        +import java.util.Iterator;
        +import java.util.List;
        +import java.util.Set;

        import com.icesoft.util.pooling.ClientIdPool;

        @@ -125,12 +127,11 @@
        // render a SelectItemGroup in a nested table
        if (nextSelectItem instanceof SelectItemGroup) {

        • Element nextTR = null;
          + Element nextTR = domContext.createElement("tr");
          Element nextTD = null;

        if (nextSelectItem.getLabel() != null) {
        if (renderVertically)

        { - nextTR = domContext.createElement("tr"); rootTable.appendChild(nextTR); }

        nextTD = domContext.createElement("td");
        @@ -142,6 +143,8 @@
        if (renderVertically)

        { nextTR = domContext.createElement("tr"); rootTable.appendChild(nextTR); + }

        else

        { + rootTable.appendChild(nextTR); }

        nextTD = domContext.createElement("td");
        nextTR.appendChild(nextTD);
        @@ -391,4 +394,4 @@
        return (Element) domContext.createRootElement("table");
        }

        -}
        \ No newline at end of file
        +}

        Show
        Ken Fyten added a comment - Suggested fix patch from contributed by Michal Bouska: Index: icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java =================================================================== — icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java (revision 18792) +++ icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java (working copy) @@ -40,14 +40,16 @@ import org.w3c.dom.Node; import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; import javax.faces.component.UISelectMany; import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; import javax.faces.model.SelectItem; import javax.faces.model.SelectItemGroup; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import com.icesoft.util.pooling.ClientIdPool; @@ -125,12 +127,11 @@ // render a SelectItemGroup in a nested table if (nextSelectItem instanceof SelectItemGroup) { Element nextTR = null; + Element nextTR = domContext.createElement("tr"); Element nextTD = null; if (nextSelectItem.getLabel() != null) { if (renderVertically) { - nextTR = domContext.createElement("tr"); rootTable.appendChild(nextTR); } nextTD = domContext.createElement("td"); @@ -142,6 +143,8 @@ if (renderVertically) { nextTR = domContext.createElement("tr"); rootTable.appendChild(nextTR); + } else { + rootTable.appendChild(nextTR); } nextTD = domContext.createElement("td"); nextTR.appendChild(nextTD); @@ -391,4 +394,4 @@ return (Element) domContext.createRootElement("table"); } -} \ No newline at end of file +}
        Hide
        Ken Fyten added a comment -

        Please evaluate the patch and commit with any necessary changes, etc.

        Show
        Ken Fyten added a comment - Please evaluate the patch and commit with any necessary changes, etc.
        Hide
        yip.ng added a comment -

        Patch applied and tested.

        Show
        yip.ng added a comment - Patch applied and tested.

          People

          • Assignee:
            yip.ng
            Reporter:
            Michal Bouska
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: