diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-10-12 00:13:40 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-10-12 00:13:40 +0000 |
commit | 17173387a237b2da8f61780d269e25a78f317cf5 (patch) | |
tree | 732320c904414575b4e64383dd6f9235bc571c6b /java/src/Ice/ObjectAdapterI.java | |
parent | bug fix (diff) | |
download | ice-17173387a237b2da8f61780d269e25a78f317cf5.tar.bz2 ice-17173387a237b2da8f61780d269e25a78f317cf5.tar.xz ice-17173387a237b2da8f61780d269e25a78f317cf5.zip |
validate identities
Diffstat (limited to 'java/src/Ice/ObjectAdapterI.java')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index fc9f1af84ca..6d8c8c597aa 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -173,6 +173,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter throw e; } + checkIdentity(ident); + // // Create a copy of the Identity argument, in case the caller // reuses it @@ -215,6 +217,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter throw e; } + checkIdentity(ident); + _activeServantMap.remove(ident); } @@ -264,6 +268,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter public synchronized Ice.Object identityToServant(Identity ident) { + checkIdentity(ident); + return (Ice.Object)_activeServantMap.get(ident); } @@ -284,6 +290,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter throw e; } + checkIdentity(ident); + return newProxy(ident); } @@ -297,6 +305,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter throw e; } + checkIdentity(ident); + return newDirectProxy(ident); } @@ -310,6 +320,8 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter throw e; } + checkIdentity(ident); + // // Create a reference and return a reverse proxy for this reference. // @@ -580,6 +592,29 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter return _instance.proxyFactory().referenceToProxy(reference); } + private static void + checkIdentity(Identity ident) + { + if(ident.name == null || ident.name.length() == 0) + { + IllegalIdentityException e = new IllegalIdentityException(); + try + { + e.id = (Identity)ident.clone(); + } + catch(CloneNotSupportedException ex) + { + assert(false); + } + throw e; + } + + if(ident.category == null) + { + ident.category = ""; + } + } + public boolean isLocal(ObjectPrx proxy) { |