You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/08/25 19:49:15 UTC

svn commit: r1806220 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java

Author: jleroux
Date: Fri Aug 25 19:49:15 2017
New Revision: 1806220

URL: http://svn.apache.org/viewvc?rev=1806220&view=rev
Log:
Fixed: NullPointerException when calling EntityQuery#getFieldList
(OFBIZ-9624)

When performing EntityQuery#getFieldList without specifying distinct a 
NullPointerException is thrown, because of the condition if (this.distinct). 
It implicitly calls this.distinct.booleanValue() which throws the exception if 
distinct is null.

Thanks: Tobias Laufkötter

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java?rev=1806220&r1=1806219&r2=1806220&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java Fri Aug 25 19:49:15 2017
@@ -521,7 +521,7 @@ public class EntityQuery {
 
     public <T> List<T> getFieldList(final String fieldName) throws GenericEntityException {select(fieldName);
         try (EntityListIterator genericValueEli = queryIterator()) {
-            if (this.distinct) {
+            if (Boolean.TRUE.equals(this.distinct)) {
                 Set<T> distinctSet = new HashSet<T>();
                 GenericValue value = null;
                 while ((value = genericValueEli.next()) != null) {