Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1348 Incorrect hash code calculation for character attributes in alpha hashing optimization
  3. JBRULES-2466

Exception in hash code calculation for character attributes in alpha hashing optimization

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Major Major
    • 5.2.0.CR1
    • 5.1.0.M1
    • drools-core (expert)
    • None

      JBRULES-1348 introduces a bug in interaction between CompositeObjectSinkAdapter$HashKey and BaseObjectClassFieldReader
      be following code change

      • } else if ( vtype.isIntegerNumber() ) { + }

        else if ( vtype.isIntegerNumber() || vtype.isChar() ) {
        this.type = LONG;
        if ( !isNull ) {
        this.lvalue = extractor.getLongValue( null, value );

      because BaseObjectClassFieldReader.getLongValue() doesn't handle properties of Character type,
      and RuntimeDroolsException is thrown with message "Conversion to double not supported from java.lang.Character".

      In case BaseObjectClassFieldReader.getLongValue() returns ((Character) value).charValue() instead of throwing exception,
      exception in the following form will be thrown be CompositeObjectSinkAdapter$HashKey
      on equality check if other HashKey gained type OBJECT instead of LONG:

      java.lang.NumberFormatException: For input string: "R"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
      at java.lang.Long.parseLong(Long.java:403)
      at java.lang.Long.parseLong(Long.java:461)
      at org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.getLongValue(CompositeObjectSinkAdapter.java:628)
      at org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.equals(CompositeObjectSinkAdapter.java:692)
      at org.drools.util.AbstractHashTable$EqualityEquals.equal(AbstractHashTable.java:446)
      at org.drools.util.ObjectHashMap.get(ObjectHashMap.java:90)
      at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:326)

            mproctor@redhat.com Mark Proctor
            odemura Oleksandr Demura (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

              Created:
              Updated:
              Resolved:
              Archived: