[ 
https://issues.apache.org/jira/browse/OFBIZ-5385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13815096#comment-13815096
 ] 

Adrian Crum commented on OFBIZ-5385:
------------------------------------

There is no reason to go directly to the data source if the data exists in the 
cache.

GenericEntity instances retrieved from the cache are immutable - because those 
instances are shared among many threads. So, if you have a GenericEntity 
instance that you retrieved from the cache and you want to modify it, then you 
need to use GenericEntity.clone(), or copy it to a mutable Map, or do something 
similar.

It is likely there is existing code that throws exceptions when immutable 
GenericEntity instances are modified. That is because previous versions of 
OFBiz did not make the cached instances immutable (which was causing 
unpredictable behavior). We need to fix that code, but with the understanding 
that the thrown exceptions are the intended behavior - those exceptions are 
telling us that there is a problem in the calling code.



> Purchase order immutable/unchangeable errors when adding variant products
> -------------------------------------------------------------------------
>
>                 Key: OFBIZ-5385
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5385
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: SVN trunk
>            Reporter: Christian Carlow
>         Attachments: ProductWorker.java.diff
>
>
> This error message is generated when trying to add a variant product to a 
> purchase order cart after features have been selected:
> Error calling event: org.ofbiz.webapp.event.EventHandlerException: Problems 
> processing event: java.lang.IllegalStateException: This object has been 
> flagged as immutable (unchangeable), probably because it came from an Entity 
> Engine cache.
> To reproduce:
> 1.  Add new feature "Gold" as COLOR Feature Type to Widget Features Category
> 2.  Change WG-9943 virtual variant method to "Feature Tree Generation" on the 
> product page
> 3.  Add new "Gold" feature to WG-9943 on feature page of product app
> 4.  Create new purchase order from BigSupplier for WG-9943  
> 5.  Select the new feature "Gold" as the color
> The error is generated after trying to add the product after all features 
> have been selected.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to