Author: doogie
Date: Fri Jul 30 03:28:04 2010
New Revision: 980641

URL: http://svn.apache.org/viewvc?rev=980641&view=rev
Log:
Fix checkRhs logic when comparing the value type to the field type.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=980641&r1=980640&r2=980641&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java 
Fri Jul 30 03:28:04 2010
@@ -249,10 +249,16 @@ public class EntityExpr extends EntityCo
                 Debug.logWarning(e, module);
             }
           // make sure the type of keyFieldName of EntityConditionSubSelect  
matches the field Java type
-            if (!ObjectType.instanceOf(valueType.getJavaType(), 
type.getJavaType())) {
-                String errMsg = "Warning using ["+ value.getClass().getName() 
+ "] and entity field [" + modelEntity.getEntityName() + "." + 
curField.getName() + "]. The Java type of keyFieldName : [" + 
valueType.getJavaType()+ "] is not compatible with the Java type of the field 
[" + type.getJavaType() + "]";
+            try {
+                if 
(!ObjectType.instanceOf(ObjectType.loadClass(valueType.getJavaType()), 
type.getJavaType())) {
+                    String errMsg = "Warning using ["+ 
value.getClass().getName() + "] and entity field [" + 
modelEntity.getEntityName() + "." + curField.getName() + "]. The Java type of 
keyFieldName : [" + valueType.getJavaType()+ "] is not compatible with the Java 
type of the field [" + type.getJavaType() + "]";
+                    // eventually we should do this, but for now we'll do a 
"soft" failure: throw new IllegalArgumentException(errMsg);
+                    Debug.logWarning(new Exception("Location of database type 
warning"), "=-=-=-=-=-=-=-=-= Database type warning in EntityExpr 
=-=-=-=-=-=-=-=-= " + errMsg, module);
+                }
+            } catch (ClassNotFoundException e) {
+                String errMsg = "Warning using ["+ value.getClass().getName() 
+ "] and entity field [" + modelEntity.getEntityName() + "." + 
curField.getName() + "]. The Java type of keyFieldName : [" + 
valueType.getJavaType()+ "] could not be found]";
                 // eventually we should do this, but for now we'll do a "soft" 
failure: throw new IllegalArgumentException(errMsg);
-                Debug.logWarning(new Exception("Location of database type 
warning"), "=-=-=-=-=-=-=-=-= Database type warning in EntityExpr 
=-=-=-=-=-=-=-=-= " + errMsg, module);
+                Debug.logWarning(e, "=-=-=-=-=-=-=-=-= Database type warning 
in EntityExpr =-=-=-=-=-=-=-=-= " + errMsg, module);
              }
         } else {
         // make sure the type matches the field Java type


Reply via email to