summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/CHANGES21
-rw-r--r--java/src/Ice/LocalObjectImpl.java14
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java13
-rw-r--r--java/src/Ice/ProxyIdentityFacetKey.java14
-rw-r--r--java/src/Ice/ProxyIdentityKey.java14
-rw-r--r--java/src/IceInternal/LocatorInfo.java20
-rw-r--r--java/src/IceInternal/RouterInfo.java20
7 files changed, 57 insertions, 59 deletions
diff --git a/java/CHANGES b/java/CHANGES
index 0f33aa244f4..189b0128816 100644
--- a/java/CHANGES
+++ b/java/CHANGES
@@ -1,17 +1,20 @@
Changes since version 3.0.0
---------------------------
-- Fixed a bug in endpoint comparisons that would cause new
- connections to be created needlessly. This would occur when
- the representation of the host differed between the proxy and
- endpoint configuration, with one containing the hostname and
- the other the numeric host address.
+- Changed the ObjectPrx.equals() method to eliminate the possibility
+ of a ClassCastException.
-- Fixed a bug in the Slice parser that caused problems if an
- included file contained white space in the file name.
+- Fixed a bug in endpoint comparisons that would cause new connections
+ to be created needlessly. This would occur when the representation
+ of the host differed between the proxy and endpoint configuration,
+ with one containing the hostname and the other the numeric host
+ address.
-- Fixed bug where ObjectAdapter.createProxy() didn't create
- indirect proxies with the object adapter replica group id.
+- Fixed a bug in the Slice parser that caused problems if an included
+ file contained white space in the file name.
+
+- Fixed bug where ObjectAdapter.createProxy() didn't create indirect
+ proxies with the object adapter replica group id.
Changes since version 2.1.2
---------------------------
diff --git a/java/src/Ice/LocalObjectImpl.java b/java/src/Ice/LocalObjectImpl.java
index 94e2c9230e2..abbd1119858 100644
--- a/java/src/Ice/LocalObjectImpl.java
+++ b/java/src/Ice/LocalObjectImpl.java
@@ -11,20 +11,6 @@ package Ice;
public abstract class LocalObjectImpl implements LocalObject, java.lang.Cloneable
{
- public boolean
- equals(java.lang.Object rhs)
- {
- try
- {
- LocalObject r = (LocalObject)rhs;
- return this == r;
- }
- catch(ClassCastException ex)
- {
- }
- return false;
- }
-
public java.lang.Object
clone()
throws java.lang.CloneNotSupportedException
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index 7c7406a6f7c..1ba89f7c060 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -559,8 +559,17 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
equals(java.lang.Object r)
{
- ObjectPrxHelperBase rhs = (ObjectPrxHelperBase)r;
- return _reference.equals(rhs._reference);
+ if(this == r)
+ {
+ return true;
+ }
+
+ if(r instanceof ObjectPrxHelperBase)
+ {
+ return _reference.equals(((ObjectPrxHelperBase)r)._reference);
+ }
+
+ return false;
}
public final IceInternal.Reference
diff --git a/java/src/Ice/ProxyIdentityFacetKey.java b/java/src/Ice/ProxyIdentityFacetKey.java
index 1d77df3b82b..18fd132ce53 100644
--- a/java/src/Ice/ProxyIdentityFacetKey.java
+++ b/java/src/Ice/ProxyIdentityFacetKey.java
@@ -40,8 +40,18 @@ public class ProxyIdentityFacetKey
public boolean
equals(java.lang.Object obj)
{
- ProxyIdentityFacetKey other = (ProxyIdentityFacetKey)obj;
- return (_hashCode == other._hashCode) && _identity.equals(other._identity) && _facet.equals(other._facet);
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof ProxyIdentityFacetKey)
+ {
+ ProxyIdentityFacetKey other = (ProxyIdentityFacetKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity) && _facet.equals(other._facet);
+ }
+
+ return false;
}
public Ice.ObjectPrx
diff --git a/java/src/Ice/ProxyIdentityKey.java b/java/src/Ice/ProxyIdentityKey.java
index 316bbefd7c1..e3e394091f9 100644
--- a/java/src/Ice/ProxyIdentityKey.java
+++ b/java/src/Ice/ProxyIdentityKey.java
@@ -37,8 +37,18 @@ public class ProxyIdentityKey
public boolean
equals(java.lang.Object obj)
{
- ProxyIdentityKey other = (ProxyIdentityKey)obj;
- return (_hashCode == other._hashCode) && _identity.equals(other._identity);
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof ProxyIdentityKey)
+ {
+ ProxyIdentityKey other = (ProxyIdentityKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity);
+ }
+
+ return false;
}
public Ice.ObjectPrx
diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java
index 42581e6ce9b..63bac9b401d 100644
--- a/java/src/IceInternal/LocatorInfo.java
+++ b/java/src/IceInternal/LocatorInfo.java
@@ -27,27 +27,17 @@ public final class LocatorInfo
public boolean
equals(java.lang.Object obj)
{
- if(obj == null)
+ if(this == obj)
{
- return false;
+ return true;
}
- if(obj == this)
+ if(obj instanceof LocatorInfo)
{
- return true;
+ return _locator.equals(((LocatorInfo)obj)._locator);
}
- LocatorInfo rhs = null;
- try
- {
- rhs = (LocatorInfo)obj;
- }
- catch (ClassCastException ex)
- {
- return false;
- }
-
- return _locator.equals(rhs._locator);
+ return false;
}
public Ice.LocatorPrx
diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java
index e5e2f91ac05..a83ccbc78f8 100644
--- a/java/src/IceInternal/RouterInfo.java
+++ b/java/src/IceInternal/RouterInfo.java
@@ -31,27 +31,17 @@ public final class RouterInfo
public boolean
equals(java.lang.Object obj)
{
- if(obj == null)
+ if(this == obj)
{
- return false;
+ return true;
}
- if(obj == this)
+ if(obj instanceof RouterInfo)
{
- return true;
+ return _router.equals(((RouterInfo)obj)._router);
}
- RouterInfo rhs = null;
- try
- {
- rhs = (RouterInfo)obj;
- }
- catch(ClassCastException ex)
- {
- return false;
- }
-
- return _router.equals(rhs._router);
+ return false;
}
public Ice.RouterPrx