Exception in hash code calculation for character attributes in alpha hashing optimization
-----------------------------------------------------------------------------------------
Key: JBRULES-2466
URL:
https://jira.jboss.org/jira/browse/JBRULES-2466
Project: Drools
Issue Type: Sub-task
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.0.M1
Reporter: Olexandr Demura
Assignee: Mark Proctor
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)
--
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