Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2316

StringIndexOutOfBoundsException when a fact is in default package

    Details

      Description

      Assuming you have a rule base for which you have defined shadow proxy excludes.
      If you insert a fact which class is in default package, a StringIndexOutOfBoundsException is raised by RuleBaseConfiguration#isShadowed()

      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1768)
      at org.drools.RuleBaseConfiguration.isShadowed(RuleBaseConfiguration.java:546)
      at org.drools.reteoo.Rete$ClassObjectTypeConf.defineShadowProxyData(Rete.java:486)
      at org.drools.reteoo.Rete$ClassObjectTypeConf.<init>(Rete.java:468)
      at org.drools.reteoo.Rete.assertObject(Rete.java:152)
      at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
      at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:704)
      ..........

      Problem comes from this line (RuleBaseConfiguration.java:546):
      String qualifiedNamespace = className.substring( 0,
      className.lastIndexOf( '.' ) ).trim(); // => default package => no '.' => exception

      This can typically happen when trying to insert JDKProxies into the working memory for test purpose (EasyMock use such proxies).

      The issue only appears if you have defined shadow proxy excludes.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mark.proctor Mark Proctor
                Reporter:
                renaud_julienne Renaud Julienne
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: