Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-92

NPE when removing a rule using a Java object with Drools annotations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 5.5.0.Final
    • Fix Version/s: 5.5.1.Final
    • Component/s: None
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Test case submitted as PR

      Show
      Test case submitted as PR

      Description

      • 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

        Attachments

          Activity

            People

            Assignee:
            mfusco Mario Fusco
            Reporter:
            dsotty Davide Sottara (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: