In checkRhs, add support for the rhs being an EntityFieldValue(this is a
partial fix, rhs can actually be *any* EntityConditionValue, so this logic really needs to be revisited). git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@980642 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -260,6 +260,30 @@ public class EntityExpr extends EntityCondition {
|
||||
// eventually we should do this, but for now we'll do a "soft" failure: throw new IllegalArgumentException(errMsg);
|
||||
Debug.logWarning(e, "=-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-=-= " + errMsg, module);
|
||||
}
|
||||
} else if (value instanceof EntityFieldValue) {
|
||||
EntityFieldValue efv = (EntityFieldValue) this.lhs;
|
||||
String rhsFieldName = efv.getFieldName();
|
||||
ModelField rhsField = modelEntity.getField(fieldName);
|
||||
if (rhsField == null) {
|
||||
throw new IllegalArgumentException("FieldName " + rhsFieldName + " not found for entity: " + modelEntity.getEntityName());
|
||||
}
|
||||
ModelFieldType rhsType = null;
|
||||
try {
|
||||
rhsType = delegator.getEntityFieldType(modelEntity, rhsField.getType());
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logWarning(e, module);
|
||||
}
|
||||
try {
|
||||
if (!ObjectType.instanceOf(ObjectType.loadClass(rhsType.getJavaType()), type.getJavaType())) {
|
||||
String errMsg = "Warning using ["+ value.getClass().getName() + "] and entity field [" + modelEntity.getEntityName() + "." + curField.getName() + "]. The Java type [" + rhsType.getJavaType() + "] of rhsFieldName : [" + rhsFieldName + "] 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 [" + rhsType.getJavaType() + "] of rhsFieldName : [" + rhsFieldName + "] could not be found]";
|
||||
// eventually we should do this, but for now we'll do a "soft" failure: throw new IllegalArgumentException(errMsg);
|
||||
Debug.logWarning(e, "=-=-=-=-=-=-=-=-= Database type warning in EntityExpr =-=-=-=-=-=-=-=-= " + errMsg, module);
|
||||
}
|
||||
} else {
|
||||
// make sure the type matches the field Java type
|
||||
if (!ObjectType.instanceOf(value, type.getJavaType())) {
|
||||
|
||||
Reference in New Issue
Block a user