[
http://jira.jboss.com/jira/browse/JGRP-417?page=comments#action_12353322 ]
Yves Martin commented on JGRP-417:
----------------------------------
Of course the instanceof check is done in compareTo... but it results into throwing a
ClassCastException.
So the equals method does not return false but throw the exception.
Sorry I have not kept the stack trace.
When my old 2.2.0 version, it comes from ConnectionTable.run when doing
conns.contais(peer_addr)
synchronized(conns) {
if(conns.contains(peer_addr)) {
if(Trace.trace)
Trace.warn("ConnectionTable.run()", peer_addr +
" is already there, will terminate
connection");
It seems that the "conns" hashtable contains both IpAddress and Connection
objects as values.
ConnectionTable.run / ClassCastException with IBM Java 1.5
----------------------------------------------------------
Key: JGRP-417
URL:
http://jira.jboss.com/jira/browse/JGRP-417
Project: JGroups
Issue Type: Bug
Affects Versions: 2.2.9 SP4
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
Assigned To: Bela Ban
Fix For: 2.5
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.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira