[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2672) Error while parsing xml with <and-constraint-connective> within <pattern>

Veit Guna (JIRA) jira-events at lists.jboss.org
Tue Oct 26 07:50:54 EDT 2010


     [ https://jira.jboss.org/browse/JBRULES-2672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Veit Guna updated JBRULES-2672:
-------------------------------

    Attachment: drools-compiler.patch


Updated patch to also add <and-constraint-connective> support to <from> like this:

 <dro:pattern object-type="String">
  <dro:and-constraint-connective>
    <dro:field-constraint field-name="this">
      <dro:literal-restriction evaluator="!=" value="null"/>
    </dro:field-constraint>
    <dro:field-constraint field-name="this.toLowerCase">
      <dro:literal-restriction evaluator="==" value="true"/>
    </dro:field-constraint>
  </dro:and-constraint-connective>
  <dro:from>
     <dro:expression>fctv_17263.getHeaderValues("X-My-Header");
     </dro:expression>
  </dro:from>
 </dro:pattern>



> Error while parsing xml with <and-constraint-connective> within <pattern>
> -------------------------------------------------------------------------
>
>                 Key: JBRULES-2672
>                 URL: https://jira.jboss.org/browse/JBRULES-2672
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler
>    Affects Versions: 5.1.0.FINAL
>         Environment: Jboss 5.1.0, Drools 5.1.0, Jdk 1.6.0_14
>            Reporter: Veit Guna
>            Assignee: Mark Proctor
>         Attachments: drools-compiler.patch, drools-compiler.patch, drools-compiler.patch
>
>
> Hi.
> I'm using drools 5.1.0 together with .xdrl files. I encountered a possible bug in the AndHandler class when
> parsing the following .xdrl file:
> --cut here--
> {code:xml}    
>                 <dro:pattern object-type="EMail">
>                     <dro:and-constraint-connective>
>                         <dro:field-constraint field-name="foo">
>                             <dro:literal-restriction evaluator="!=" value="null"/>
>                         </dro:field-constraint>
>                         <dro:field-constraint field-name="foo.toLowerCase">
>                             <dro:literal-restriction evaluator="==" value="test"/>
>                         </dro:field-constraint>
>                     </dro:and-constraint-connective>
>                 </dro:pattern>
> {code}
> --cut here--
> Parsing this seems to fail when adding the package from xml:
> {code}
> Caused by: org.drools.compiler.DroolsParserException: org.xml.sax.SAXParseException: <and-constraint-connective> has an invalid parent element [[Pattern: id=null; objectType=EMail]]
>         at org.drools.compiler.PackageBuilder.addPackageFromXml(PackageBuilder.java:304)
>         at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>         ... 142 more
> {code}
> According to the .xsd (4.0) this should be no problem. Looking at the OrHandler it seems that simply the 
> PatternDescr is missing from the validParents.
> Also tried to disable xml validation with:
> {code}
> System.setProperty("drools.schema.validating","false");
> {code}
> but with no luck. So find attached the _very_ complex patch that adds PackageDescr to the AndHandler :).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list