[jboss-jira] [JBoss JIRA] (DROOLS-2379) DMN Validator raising false positive errors for type resolution

Edson Tirelli (JIRA) issues at jboss.org
Fri Mar 9 22:09:00 EST 2018


    [ https://issues.jboss.org/browse/DROOLS-2379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13544254#comment-13544254 ] 

Edson Tirelli commented on DROOLS-2379:
---------------------------------------

[~tzimanyi] can I ask your help please to add tests for each of the cases in the linked PR:

{code:drl}
rule TYPEREF_NOT_FEEL_NOT_DEF_p1
when
  $o: Expression( typeRef != null, typeRef.prefix == null || getNamespaceURI( typeRef.prefix ) != DMNModelInstrumentedBase.URI_FEEL, $typeRef : typeRef )
  not( ItemDefinition( name == $typeRef.getLocalPart() ) )
then
  reporter.report( DMNMessage.Severity.ERROR,  $o , Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, $o.getParentDRDElement().getIdentifierString() );
end

rule TYPEREF_NOT_FEEL_NOT_DEF_p2
when
  $o: InformationItem( typeRef != null, typeRef.prefix == null || getNamespaceURI( typeRef.prefix ) != DMNModelInstrumentedBase.URI_FEEL, $typeRef : typeRef )
  not( ItemDefinition( name == $typeRef.getLocalPart() ) )
then
  reporter.report( DMNMessage.Severity.ERROR,  $o , Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, $o.getParentDRDElement().getIdentifierString() );
end

rule TYPEREF_NOT_FEEL_NOT_DEF_p3
when
  $o: ItemDefinition( typeRef != null, typeRef.prefix == null || getNamespaceURI( typeRef.prefix ) != DMNModelInstrumentedBase.URI_FEEL, $typeRef : typeRef )
  not( ItemDefinition( name == $typeRef.getLocalPart() ) )
then
  reporter.report( DMNMessage.Severity.ERROR,  $o , Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, $o.getParentDRDElement().getIdentifierString() );
end

rule TYPEREF_NOT_FEEL_NOT_DEF_p4
when
  $o: OutputClause( typeRef != null, typeRef.prefix == null || getNamespaceURI( typeRef.prefix ) != DMNModelInstrumentedBase.URI_FEEL, $typeRef : typeRef )
  not( ItemDefinition( name == $typeRef.getLocalPart() ) )
then
  reporter.report( DMNMessage.Severity.ERROR,  $o , Msg.UNKNOWN_TYPE_REF_ON_NODE, $typeRef, $o.getParentDRDElement().getIdentifierString() );
end
{code}

> DMN Validator raising false positive errors for type resolution
> ---------------------------------------------------------------
>
>                 Key: DROOLS-2379
>                 URL: https://issues.jboss.org/browse/DROOLS-2379
>             Project: Drools
>          Issue Type: Bug
>          Components: dmn engine
>    Affects Versions: 7.6.0.Final
>            Reporter: Edson Tirelli
>            Assignee: Tibor Zimányi
>            Priority: Critical
>             Fix For: 7.7.0.Final
>
>
> DMN Validator is raising false positives for errors on type resolution. It looks like it is happening since the following commit was done:
> https://github.com/kiegroup/drools/commit/9e2fdc4b5e83bb9b5350a37fd89dab8f38cc8582
> The problem is that the .toString() call on the QName will return the full name, including the namespace:
> {http://www.trisotech.com/definitions/_6cfe7d88-6741-45d1-968c-b61a597d0964}tDailyPrice
> And that will always fail the constraint:
> ItemDefinition( name == $typeRef.toString() )
> I believe the correct would be to change the constraint to:
> ItemDefinition( name == $typeRef.getLocalPart() )
> But we might also need to check the namespace somehow.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the jboss-jira mailing list