Page 1 of 1

NPE in p:column sortBy. Version 1.0.0

Posted: 05 Mar 2010, 19:15
by mndot_lance
I created the issue in the issue tracker here:
http://code.google.com/p/primefaces/iss ... &start=100

code:

Code: Select all

<p:dataTable  var="relationship" value="#{parentHandler.allElementsInBundleSorted}" 
					style="width:925px;overflow:scroll;"
					paginator="true" 
					rows="15" 
					dynamic="true">

<p:column sortBy="#{relationship.primeElement.elementId}">
						<f:facet name="header">
							<h:outputText value="PR ID" />
						</f:facet>
						#{relationship.primeElement.elementId}
					</p:column>	

</p:dataTable>
In my data model, sometimes the relationship.primeElement will return null. Primefaces code should catch this NPE and continue sorting as if elementId is null.

Re: NPE in p:column sortBy. Version 1.0.0

Posted: 05 Mar 2010, 19:16
by mndot_lance
There seems to be two parts to this - not only can none of the getter methods in the chain return null, but neither can the last getter. The actual value finally returned cannot be null either, or a NPE results.

Code: Select all

Caused by: java.lang.NullPointerException
17:47:35,235 ERROR [STDERR] 	at org.primefaces.model.BeanPropertyComparator.compare(BeanPropertyComparator.java:65)
17:47:35,235 ERROR [STDERR] 	... 49 more

Re: NPE in p:column sortBy. Version 1.0.0

Posted: 07 Mar 2010, 14:38
by cagatay.civici
This is a known issue, I remember a similar issue in tracker, this should be fixed in upcoming release. Thanks Lance.