[
https://issues.apache.org/jira/browse/OFBIZ-5925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14260113#comment-14260113
]
Divesh Dutta commented on OFBIZ-5925:
-------------------------------------
HI [~jacopoc]
You are right that OrderItemShipGroupAssoc entity does not have size field, so
this code breaks. Also as you suggested, we should check Generic value type
and then get appropriate field, which is done in many places at OFBiz.
Just so you know, this code was working fine before and your recent changes in
commit number: 1646666 (OFBIZ-5004) caused this issue. I also read discussion
on OFBIZ-5004. What I can conclude is that it is suggested that developer use
GenericEntity.getEntityName() or
(GenericEntity.getModelEntity().isField(String) to be sure if field exists and
then get the field from GenericValue.
So when you are writing new code, developer should check type of GenericValues
and check if field exists and then write the code. What do you think is right
way to fix the existing code ? This issue is one of the example where code
broke due to this change. So should we wait for such issues to come and then we
go and fix these issues?
OR we should change the code so that, get method simply return null if field is
not appropriate (Similar to java map which just return null silently.) ? Don't
throw warning as well as exception if field is not appropriate, simply return
null silently .
> Pack order flow is broken
> -------------------------
>
> Key: OFBIZ-5925
> URL: https://issues.apache.org/jira/browse/OFBIZ-5925
> Project: OFBiz
> Issue Type: Bug
> Components: order
> Reporter: Deepak Dixit
> Priority: Blocker
>
> Pack order flow is broken, its throwing error
> {code}
> [java] org.ofbiz.widget.screen.ScreenRenderException: Error rendering
> screen [component://product/widget/facility/ShipmentScreens.xml#PackOrder]:
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://product/widget/facility/CommonScreens.xml#main-decorator]:
> org.ofbiz.entity.transaction.GenericTransactionException: The current
> transaction is marked for rollback, not beginning a new transaction and
> aborting current operation; the rollbackOnly was caused by: Service
> [calcShipmentCostEstimate] threw an unexpected
> exception/errororg.ofbiz.service.GenericServiceException: Service
> [calcShipmentCostEstimate] target threw an unexpected exception (The field
> name (or key) [size] is not valid for entity [OrderItemAndShipGroupAssoc].)
> (Service [calcShipmentCostEstimate] target threw an unexpected exception (The
> field name (or key) [size] is not valid for entity
> [OrderItemAndShipGroupAssoc].)) (The current transaction is marked for
> rollback, not beginning a new transaction and aborting current operation; the
> rollbackOnly was caused by: Service [calcShipmentCostEstimate] threw an
> unexpected exception/errororg.ofbiz.service.GenericServiceException: Service
> [calcShipmentCostEstimate] target threw an unexpected exception (The field
> name (or key) [size] is not valid for entity [OrderItemAndShipGroupAssoc].)
> (Service [calcShipmentCostEstimate] target threw an unexpected exception (The
> field name (or key) [size] is not valid for entity
> [OrderItemAndShipGroupAssoc].))) (Error rendering screen
> [component://product/widget/facility/CommonScreens.xml#main-decorator]:
> org.ofbiz.entity.transaction.GenericTransactionException: The current
> transaction is marked for rollback, not beginning a new transaction and
> aborting current operation; the rollbackOnly was caused by: Service
> [calcShipmentCostEstimate] threw an unexpected
> exception/errororg.ofbiz.service.GenericServiceException: Service
> [calcShipmentCostEstimate] target threw an unexpected exception (The field
> name (or key) [size] is not valid for entity [OrderItemAndShipGroupAssoc].)
> (Service [calcShipmentCostEstimate] target threw an unexpected exception (The
> field name (or key) [size] is not valid for entity
> [OrderItemAndShipGroupAssoc].)) (The current transaction is marked for
> rollback, not beginning a new transaction and aborting current operation; the
> rollbackOnly was caused by: Service [calcShipmentCostEstimate] threw an
> unexpected exception/errororg.ofbiz.service.GenericServiceException: Service
> [calcShipmentCostEstimate] target threw an unexpected exception (The field
> name (or key) [size] is not valid for entity [OrderItemAndShipGroupAssoc].)
> (Service [calcShipmentCostEstimate] target threw an unexpected exception (The
> field name (or key) [size] is not valid for entity
> [OrderItemAndShipGroupAssoc].))))
> {code}
> This error occured due to recent fix in GenericEntity.get(). Need to fix the
> pack order flow.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)