ConnectionTable.run / ClassCastException with IBM Java 1.5
----------------------------------------------------------
Key: JGRP-417
URL:
https://issues.jboss.org/browse/JGRP-417
Project: JGroups
Issue Type: Bug
Environment: $ java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20061107 (iFix
111765: SR3 + 111700) )
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20061001 (JIT
enabled)
J9VM - 20060915_08260_lHdSMR
JIT - 20060908_1811_r8
GC - 20060906_AA)
JCL - 20061107
Reporter: Yves Martin
Assignee: Bela Ban
When migrating a project to IBM Java 1.5,
I get the following warning from ConnectionTable:
ConnectionTable.run(): exception is java.lang.ClassCastException: IpAddress.compareTo():
comparison between different classes
And communication times out.
The same code works perfectly well with Sun Java 1.5.0_07
The drop stack trace show it comes from Hashtable.contains.
After comparison between Sun src.zip and IBM src.jar for Hashtable,
. Sun does entry.equals(value)
. IBM does value.equals(entry)
As a result, JGroups happens to do a IpAddress.equals(Connection) with IBM JVM
and fails. Whereas Connection.equals(IpAddress) is properly handled in case of Sun JVM.
Patch is trivial but the bug analysis was difficult !!
Here is a valid IpAddress.equals method.
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof IpAddress)) return false;
return compareTo(obj) == 0 ? true : false;
}
Thank you in advance to include this patch in JGroups 2.2.9 so that JBoss 4.0.x may work
one day with IBM Java 1.5
--
This message is automatically generated by JIRA.
For more information on JIRA, see: