You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Tobias Herbert (Jira)" <de...@myfaces.apache.org> on 2020/01/01 21:21:00 UTC

[jira] [Created] (TOBAGO-2019) NPE tobago-core-2.4.1 NPE Sorter.java

Tobias Herbert created TOBAGO-2019:
--------------------------------------

             Summary: NPE tobago-core-2.4.1 NPE Sorter.java 
                 Key: TOBAGO-2019
                 URL: https://issues.apache.org/jira/browse/TOBAGO-2019
             Project: MyFaces Tobago
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.4.1
         Environment: jboss 6 
            Reporter: Tobias Herbert
         Attachments: Sorter.java

Hello Tobago maintainer,

during migration of an existing project I have a problem with an NPE in Sorter.java 
line 153. 

With the below fix, the application seems to be ok...

Patch proposal:

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
index f2f0451832..2a37f2c343 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
@@ -150,6 +150,7 @@ public class Sorter {

// memorize selected rows
 List<Object> selectedDataRows = null;
+ if ( (sheetState !=null) && ( sheetState.getSelectedRows() !=null)) {
 if (sheetState.getSelectedRows().size() > 0) {
 selectedDataRows = new ArrayList<Object>(sheetState.getSelectedRows().size());
 Object dataRow;
@@ -162,6 +163,7 @@ public class Sorter {
 selectedDataRows.add(dataRow);
 }
 }
+ }

// do sorting
 if (value instanceof List) {

 

NPE:

------------------------------------------------------------------------

019-11-22 16:44:41,837 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/vvgebuehren].[FacesServlet]] (http-0.0.0.0:9593-2) (/) JBWEB000236: Servlet.service() for servlet FacesServlet threw exception: java.lang.NullPointerException

        at org.apache.myfaces.tobago.component.Sorter.perform(Sorter.java:153) [tobago-core-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.internal.component.AbstractUISheet.sort(AbstractUISheet.java:477) [tobago-core-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.internal.component.AbstractUISheet.processEvent(AbstractUISheet.java:458) [tobago-core-2.4.1.jar:2.4.1]

        at javax.faces.component.UIComponent$EventListenerWrapper.processEvent(UIComponent.java:1627) [myfaces-api-2.2.12.jar:2.2.12]

        at javax.faces.event.SystemEvent.processListener(SystemEvent.java:40) [myfaces-api-2.2.12.jar:2.2.12]

        at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:51) [myfaces-api-2.2.12.jar:2.2.12]

        at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2595) [myfaces-impl-2.2.12.jar:2.2.12]

        at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:595) [myfaces-impl-2.2.12.jar:2.2.12]

        at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:590) [myfaces-api-2.2.12.jar:2.2.12]

        at javax.faces.component.UIData.encodeBegin(UIData.java:1751) [myfaces-api-2.2.12.jar:2.2.12]

        at org.apache.myfaces.tobago.internal.component.AbstractUIData.encodeBegin(AbstractUIData.java:128) [tobago-core-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.internal.component.AbstractUISheet.encodeBegin(AbstractUISheet.java:120) [tobago-core-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encode(RenderUtils.java:114) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encode(RenderUtils.java:98) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encodeChildren(RenderUtils.java:93) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.html.standard.standard.tag.GridLayoutRenderer.encodeChildren(GridLayoutRenderer.java:43) [tobag

o-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.AbstractRendererBaseWrapper.encodeChildren(AbstractRendererBaseWrapper.java:100) [tobago-core-2

.4.1.jar:2.4.1]

        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:644) [myfaces-api-2.2.12.jar:2.2.12]

        at org.apache.myfaces.tobago.internal.component.AbstractUIPanel.encodeChildren(AbstractUIPanel.java:51) [tobago-core-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encode(RenderUtils.java:116) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encode(RenderUtils.java:119) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encode(RenderUtils.java:98) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.util.RenderUtils.encodeChildren(RenderUtils.java:93) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.html.standard.standard.tag.GridLayoutRenderer.encodeChildren(GridLayoutRenderer.java:43) [tobago-theme-standard-2.4.1.jar:2.4.1]

        at org.apache.myfaces.tobago.renderkit.AbstractRendererBaseWrapper.encodeChildren(AbstractRendererBaseWrapper.java:100) [tobago-core-2.4.1.jar:2.4.1]

        at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:644) [myfaces-api-2.2.12.jar:2.2.12]

 

 

Greetings

Tobias

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)