[OFBiz] SVN: r4969 - trunk/framework/entity/src/org/ofbiz/entity

jonesde at svn.ofbiz.org jonesde at svn.ofbiz.org
Fri May 6 06:39:01 EDT 2005


Author: jonesde
Date: 2005-05-06 05:38:57 -0500 (Fri, 06 May 2005)
New Revision: 4969

Modified:
   trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
Log:
Now throws exceptions if null values are passed in for certain things; change recommended by Lynne Brown; Jira #OFBIZ-93

Modified: trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
===================================================================
--- trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java	2005-05-06 06:38:08 UTC (rev 4968)
+++ trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java	2005-05-06 10:38:57 UTC (rev 4969)
@@ -117,6 +117,10 @@
     
     /** Creates new GenericEntity */
     public static GenericEntity createGenericEntity(ModelEntity modelEntity) {
+        if (modelEntity == null) {
+            throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter");
+        }
+        
         GenericEntity newEntity = new GenericEntity();
         newEntity.init(modelEntity);
         return newEntity;
@@ -124,6 +128,10 @@
 
     /** Creates new GenericEntity from existing Map */
     public static GenericEntity createGenericEntity(ModelEntity modelEntity, Map fields) {
+        if (modelEntity == null) {
+            throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter");
+        }
+        
         GenericEntity newEntity = new GenericEntity();
         newEntity.init(modelEntity, fields);
         return newEntity;
@@ -131,6 +139,10 @@
 
     /** Copy Factory Method: Creates new GenericEntity from existing GenericEntity */
     public static GenericEntity createGenericEntity(GenericEntity value) {
+        if (value == null) {
+            throw new IllegalArgumentException("Cannot create a GenericEntity with a null value parameter");
+        }
+        
         GenericEntity newEntity = new GenericEntity();
         newEntity.init(value);
         return newEntity;



More information about the Svn mailing list