Author: sichen
Date: Mon Sep 24 09:39:40 2007
New Revision: 578874
URL:
http://svn.apache.org/viewvc?rev=578874&view=revLog:
Fix some potential NPEs from Oleg Andreyev OFBIZ-1244
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=578874&r1=578873&r2=578874&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Mon Sep 24 09:39:40 2007
@@ -469,13 +469,15 @@
while (genericValueIter.hasNext()) {
GenericValue value = (GenericValue) genericValueIter.next();
Object fieldValue = value.get(fieldName);
- if (distinct) {
- if (!distinctSet.contains(fieldValue)) {
+ if (fieldValue != null) {
+ if (distinct) {
+ if (!distinctSet.contains(fieldValue)) {
+ fieldList.add(fieldValue);
+ distinctSet.add(fieldValue);
+ }
+ } else {
fieldList.add(fieldValue);
- distinctSet.add(fieldValue);
}
- } else {
- fieldList.add(fieldValue);
}
}
@@ -495,13 +497,15 @@
GenericValue value = null;
while ((value = (GenericValue) genericValueEli.next()) != null) {
Object fieldValue = value.get(fieldName);
- if (distinct) {
- if (!distinctSet.contains(fieldValue)) {
+ if (fieldValue != null) {
+ if (distinct) {
+ if (!distinctSet.contains(fieldValue)) {
+ fieldList.add(fieldValue);
+ distinctSet.add(fieldValue);
+ }
+ } else {
fieldList.add(fieldValue);
- distinctSet.add(fieldValue);
}
- } else {
- fieldList.add(fieldValue);
}
}