[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2223) ArrayIndexOutOfBoundsException in AbstractRuleBase.getStatefulSessions()

Assen Todorov (JIRA) jira-events at lists.jboss.org
Fri Jul 31 04:56:29 EDT 2009


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

Assen Todorov updated JBRULES-2223:
-----------------------------------

    Description: 
The following exception was thrown on a clustered application, based on Terracotta & JBoss Drools (4.0.7).

{code}
java.lang.ArrayIndexOutOfBoundsException: 0
        at org.drools.util.ObjectHashSet.toArray(ObjectHashSet.java:152)
        at org.drools.common.AbstractRuleBase.getStatefulSessions(AbstractRuleBase.java:724)
        .......
{code}

The code :

{code}
   /**
    * Creates a new rule base if necesarry.
    * @param aRuleSet the rule set for the new rule base.
    * @throws RuleConversionException if the rule engine has a problem with rule set compilation and loading.
    */
   private void createRuleBase(final RuleSet aRuleSet) throws RuleConversionException
   {
      Check.notNull(aRuleSet, "aRuleSet");
      final String code = aRuleSet.getCode();
      Check.notNull(code, "aRuleSet.getCode()");
      Check.notEmpty(code, "aRuleSet.getCode()");

      final ECRC ecrc = new ECRC();
      ecrc.update(code);
      final long crc = ecrc.getValue();

      synchronized(ruleBaseCache)
      {
         ruleBase = ruleBaseCache.get(crc);
         if(ruleBase == null)
         {
            ruleBase = loadRuleBaseFromCode(code);
            ruleBaseCache.put(crc, ruleBase);
         }
         else {
            // rulebase already exist
            final StatefulSession[] sessions = ruleBase.getStatefulSessions();
            if(sessions.length > 0) {
               // old sessions (working memories exist)
               for(StatefulSession session: sessions) {
                  // clear the working memory
                  session.dispose();
               }
            }
         }
      }
   }
{code}

The class where this method is defined, is declared as _instrumented-classes_  in the Terracotta configuration.

Hope this helps !

  was:
The following exception is thrown on a clustered application, based on Terracotta & JBoss Drools (4.0.7).

{code}
java.lang.ArrayIndexOutOfBoundsException: 0
        at org.drools.util.ObjectHashSet.toArray(ObjectHashSet.java:152)
        at org.drools.common.AbstractRuleBase.getStatefulSessions(AbstractRuleBase.java:724)
        .......
{code}

The code :

{code}
   /**
    * Creates a new rule base if necesarry.
    * @param aRuleSet the rule set for the new rule base.
    * @throws RuleConversionException if the rule engine has a problem with rule set compilation and loading.
    */
   private void createRuleBase(final RuleSet aRuleSet) throws RuleConversionException
   {
      Check.notNull(aRuleSet, "aRuleSet");
      final String code = aRuleSet.getCode();
      Check.notNull(code, "aRuleSet.getCode()");
      Check.notEmpty(code, "aRuleSet.getCode()");

      final ECRC ecrc = new ECRC();
      ecrc.update(code);
      final long crc = ecrc.getValue();

      synchronized(ruleBaseCache)
      {
         ruleBase = ruleBaseCache.get(crc);
         if(ruleBase == null)
         {
            ruleBase = loadRuleBaseFromCode(code);
            ruleBaseCache.put(crc, ruleBase);
         }
         else {
            // rulebase already exist
            final StatefulSession[] sessions = ruleBase.getStatefulSessions();
            if(sessions.length > 0) {
               // old sessions (working memories exist)
               for(StatefulSession session: sessions) {
                  // clear the working memory
                  session.dispose();
               }
            }
         }
      }
   }
{code}

The class where this method is defined, is declared as _instrumented-classes_  in the Terracotta configuration.

Hope this helps !



> ArrayIndexOutOfBoundsException in AbstractRuleBase.getStatefulSessions()
> ------------------------------------------------------------------------
>
>                 Key: JBRULES-2223
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2223
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.0.7
>            Reporter: Assen Todorov
>            Assignee: Mark Proctor
>
> The following exception was thrown on a clustered application, based on Terracotta & JBoss Drools (4.0.7).
> {code}
> java.lang.ArrayIndexOutOfBoundsException: 0
>         at org.drools.util.ObjectHashSet.toArray(ObjectHashSet.java:152)
>         at org.drools.common.AbstractRuleBase.getStatefulSessions(AbstractRuleBase.java:724)
>         .......
> {code}
> The code :
> {code}
>    /**
>     * Creates a new rule base if necesarry.
>     * @param aRuleSet the rule set for the new rule base.
>     * @throws RuleConversionException if the rule engine has a problem with rule set compilation and loading.
>     */
>    private void createRuleBase(final RuleSet aRuleSet) throws RuleConversionException
>    {
>       Check.notNull(aRuleSet, "aRuleSet");
>       final String code = aRuleSet.getCode();
>       Check.notNull(code, "aRuleSet.getCode()");
>       Check.notEmpty(code, "aRuleSet.getCode()");
>       final ECRC ecrc = new ECRC();
>       ecrc.update(code);
>       final long crc = ecrc.getValue();
>       synchronized(ruleBaseCache)
>       {
>          ruleBase = ruleBaseCache.get(crc);
>          if(ruleBase == null)
>          {
>             ruleBase = loadRuleBaseFromCode(code);
>             ruleBaseCache.put(crc, ruleBase);
>          }
>          else {
>             // rulebase already exist
>             final StatefulSession[] sessions = ruleBase.getStatefulSessions();
>             if(sessions.length > 0) {
>                // old sessions (working memories exist)
>                for(StatefulSession session: sessions) {
>                   // clear the working memory
>                   session.dispose();
>                }
>             }
>          }
>       }
>    }
> {code}
> The class where this method is defined, is declared as _instrumented-classes_  in the Terracotta configuration.
> Hope this helps !

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

        



More information about the jboss-jira mailing list