[jboss-jira] [JBoss JIRA] (DROOLS-92) NPE when removing a rule using a Java object with Drools annotations

Davide Sottara (JIRA) jira-events at lists.jboss.org
Sat Mar 30 22:48:42 EDT 2013


Davide Sottara created DROOLS-92:
------------------------------------

             Summary: NPE when removing a rule using a Java object with Drools annotations
                 Key: DROOLS-92
                 URL: https://issues.jboss.org/browse/DROOLS-92
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 5.5
            Reporter: Davide Sottara
            Assignee: Mark Proctor
            Priority: Critical
             Fix For: 5.6, 6.0.0.Alpha1


- Drools 5.5.x still has Accessors : field readers and writers. They are created consistently (reader+writer) for declared types, but in case of non-declared types (java objects), only readers are created, and only when
a field is involved in a constraint.

- when a rule is added (dynamically) during an incremental construction process, the packagebuilder creates "redeclarations" (TypeDeclarations with
NATURE == DECLARATION) of involved classes, in order to process annotations
such as @Position or @Modifies.

- if a rule triggers the removal/update of a rule in its own KB, AbstractRuleBase.executeQueuedActions() is called, which tries to rewire the accessors

Problem: if the modified rule's package contains a TypeDeclaration for
an annotated java object, only the reader will exist and the rewiring
process will throw a NPE as it tries to rewire the writer.

Possible solutions?
a) make the rewiring process check that an accessor exists before trying to rewire it

OR

b) change AbstractRuleBase.executeQueuedActions() - the code seems to have
been removed in 6.x (master)

OR

c) limit the rewiring to TypeDeclarations with Nature == DEFINITION

OR

d) always create the writer together with the reader


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list