This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 7b29658165 Allow copying a GenericValue that was deserialized
7b29658165 is described below

commit 7b2965816550bf92afd381736d17bd15d29f80f5
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 30 16:12:06 2026 +0530

    Allow copying a GenericValue that was deserialized
    
    GenericEntity keeps its Observable in a transient field, so it is null once 
the entity has been deserialized. The copy constructor path used by 
GenericValue.create and refreshFromValue built the new Observable from that 
field directly and failed with "observable cannot be null" when the source 
value came from a restored session. Both now read it through the existing lazy 
getObservable().
---
 .../entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 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 50a5ed227d..a2a46fdbdc 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
@@ -248,7 +248,7 @@ public class GenericEntity implements Map<String, Object>, 
LocalizedMap<Object>,
         }
         this.delegatorName = value.delegatorName;
         this.internalDelegator = value.internalDelegator;
-        this.observable = new Observable(value.observable);
+        this.observable = new Observable(value.getObservable());
     }
 
     /**
@@ -290,7 +290,7 @@ public class GenericEntity implements Map<String, Object>, 
LocalizedMap<Object>,
         this.setDelegator(newValue.getDelegator());
         this.generateHashCode = newValue.generateHashCode;
         this.cachedHashCode = newValue.cachedHashCode;
-        this.observable = new Observable(newValue.observable);
+        this.observable = new Observable(newValue.getObservable());
     }
 
     /**

Reply via email to