[ https://issues.apache.org/jira/browse/OFBIZ-4331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14043649#comment-14043649 ]
Adam Heath commented on OFBIZ-4331: ----------------------------------- More details on this bug. In entitymodel.xsd, the entity-alias attribute for condition-type elements is not required. This means that when the value is not specified, it'll be returned as an empty string, not a null. Then, when ViewConditionExpr is used against the primary entity(not in a view-link), to restrict the view, the empty string gets passed to EntityFieldValue.makeFieldValue(). Eventually, the code-path above will be hit, and the wrong branch will be taken. Namely, that the empty string will be passed to getMemberModelEntity. > trival update to EntityFieldValue.java in case the entityAlias is empty > ----------------------------------------------------------------------- > > Key: OFBIZ-4331 > URL: https://issues.apache.org/jira/browse/OFBIZ-4331 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Leon > Assignee: Adam Heath > Priority: Trivial > Fix For: SVN trunk > > Attachments: EntityFieldValue.patch > > > Sometimes, there's only one member entity in a view. In such case, you can > omit the "entity-alias" in entity condition setting. In this situation, the > entityAlias is not "null" but an emtpty string. > =================================================================== > --- framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java > (revision 1513) > +++ framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java > (working copy) > @@ -124,7 +124,7 @@ > @Override > public ModelField getModelField(ModelEntity modelEntity) { > if (this.modelViewEntity != null) { > - if (this.entityAlias != null) { > + if (UtilValidate.isNotEmpty(this.entityAlias)) { > ModelEntity memberModelEntity = > modelViewEntity.getMemberModelEntity(entityAlias); > return getField(memberModelEntity, fieldName); > } else { -- This message was sent by Atlassian JIRA (v6.2#6252)