You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Pritam Kute (JIRA)" <ji...@apache.org> on 2018/09/23 14:11:00 UTC
[jira] [Commented] (OFBIZ-10325) EntityOne.java doesn't throw
proper exception if field is not available in entity
[ https://issues.apache.org/jira/browse/OFBIZ-10325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625114#comment-16625114 ]
Pritam Kute commented on OFBIZ-10325:
-------------------------------------
Hello Suraj,
I have verified this issue and I think this improvement has been already done in the codebase. I have checked it at "Attributes" screen on party profile. Please check the following code snippet:
{code:xml}
<screen name="Attributes">
<section>
<actions>
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
<set field="partyId" from-field="parameters.partyId" default-value="${userLogin.partyId}"/>
<entity-one entity-name="Party" value-field="party">
<field-map field-name="partyIdTo" from-field="partyIdTo"/>
</entity-one>
<entity-and entity-name="PartyAttribute" list="attributes">
<field-map field-name="partyId" from-field="partyId"/>
</entity-and>
</actions>
<widgets>
<platform-specific>
<html>
<html-template location="component://party/template/party/profileblocks/Attributes.ftl"/>
</html>
</platform-specific>
</widgets>
</section>
</screen>
{code}
I have got a proper exception on the console like following:
{code:java}
2018-09-22 17:51:24,331 |jsse-nio-8443-exec-1 |ControlServlet |E| Error in request handler:
java.lang.IllegalArgumentException: [GenericEntity.set] "partyIdTo" is not a field of Party, must be one of: partyId, partyTypeId, externalId, preferredCurrencyUomId, description, statusId, createdDate, createdByUserLogin, lastModifiedDate, lastModifiedByUserLogin, dataSourceId, isUnread, lastUpdatedStamp, lastUpdatedTxStamp, createdStamp, createdTxStamp
at org.apache.ofbiz.entity.GenericEntity.set(GenericEntity.java:463) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.GenericEntity.setFields(GenericEntity.java:1057) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.GenericEntity.init(GenericEntity.java:199) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.GenericPK.create(GenericPK.java:45) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.GenericDelegator.makePK(GenericDelegator.java:695) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.finder.PrimaryKeyFinder.runFind(PrimaryKeyFinder.java:145) ~[ofbiz.jar:?]
at org.apache.ofbiz.entity.finder.PrimaryKeyFinder.runFind(PrimaryKeyFinder.java:90) ~[ofbiz.jar:?]
at org.apache.ofbiz.widget.model.AbstractModelAction$EntityOne.runAction(AbstractModelAction.java:278) ~[ofbiz.jar:?]
at org.apache.ofbiz.widget.model.AbstractModelAction.runSubActions(AbstractModelAction.java:143) ~[ofbiz.jar:?]
at org.apache.ofbiz.widget.model.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:277) ~[ofbiz.jar:?]
{code}
Also, see the error displayed on the party profile screen. I have attached the screenshot of the same. Please let me if I am missing something or you expect it in some other way,
> EntityOne.java doesn't throw proper exception if field is not available in entity
> ---------------------------------------------------------------------------------
>
> Key: OFBIZ-10325
> URL: https://issues.apache.org/jira/browse/OFBIZ-10325
> Project: OFBiz
> Issue Type: Improvement
> Reporter: Suraj Khurana
> Priority: Major
> Attachments: PartyProfile.png
>
>
> Using entity-one tag in xml services, if field is not a part of entity, proper exception message should be thrown with returned error service response.
> Suppose:
> <entity-one entity-name="ProductFacility" value-field="productFacility">
> <field-map field-name="productId" from-field="parameters.productId"/>
> <field-map field-name="facilityId" from-field="parameters.facilityId"/>
> <field-map field-name="partyId" from-field="parameters.partyId"/>
> </entity-one>
> partyId is not part of ProductFacility entity, if such code is used inside any xml service, than proper exception should be thrown from EntityOne.java
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)