This is an automated email from the ASF dual-hosted git repository.
nmalin pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/trunk by this push:
new 13ee4cc Fixed: Unable to view entity row record in webtools if PK contains timestamp field (OFBIZ-11426)
13ee4cc is described below
commit 13ee4cc263126d464b65eaebb842810647b5d1e6
Author: Nicolas Malin <
[hidden email]>
AuthorDate: Thu Mar 19 14:44:07 2020 +0100
Fixed: Unable to view entity row record in webtools if PK contains timestamp field
(OFBIZ-11426)
This problem came from when the GenericEntity try to store fields value on the map,
If the java type didn't match with the current value type, the function failed and
didn't try to convert it on the wanted type.
Thanks to Pawan Verma and Pierre Smits to raise this issue
---
.../src/main/java/org/apache/ofbiz/entity/GenericEntity.java | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
index 6688e38..aa0df35 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
@@ -484,17 +484,12 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
}
} else if (value != null && !(value instanceof NULL)) {
// make sure the type matches the field Java type
- if (value instanceof TimeDuration) {
+ if (value instanceof String && "byte[]".equals(type.getJavaType())) {
+ value = ((String) value).getBytes(StandardCharsets.UTF_8);
+ } else if (!ObjectType.instanceOf(value, type.getJavaType())) {
try {
value = ObjectType.simpleTypeOrObjectConvert(value, type.getJavaType(), null, null);
} catch (GeneralException e) {
- Debug.logError(e, module);
- }
- } else if ((value instanceof String) && "byte[]".equals(type.getJavaType())) {
- value = ((String) value).getBytes(StandardCharsets.UTF_8);
- }
- if (!ObjectType.instanceOf(value, type.getJavaType())) {
- if (!("java.sql.Blob".equals(type.getJavaType()) && (value instanceof byte[] || value == null || ByteBuffer.class.isInstance(value)))) {
String errMsg = "In entity field [" + this.getEntityName() + "." + name + "] set the value passed in [" + value.getClass().getName() + "] 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 GenericEntity.set =-=-=-=-=-=-=-=-= " + errMsg, module);