diff options
author | Benoit Foucher <benoit@zeroc.com> | 2002-10-01 03:15:57 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2002-10-01 03:15:57 +0000 |
commit | 8138f14b803970f858deb07c9303629fe1e364e8 (patch) | |
tree | a0563d02ff93cfcdc2040863f404cdcdacaa8226 /java/src | |
parent | Improved few local exceptions and evictor fix. (diff) | |
download | ice-8138f14b803970f858deb07c9303629fe1e364e8.tar.bz2 ice-8138f14b803970f858deb07c9303629fe1e364e8.tar.xz ice-8138f14b803970f858deb07c9303629fe1e364e8.zip |
Improved few local exception + evictor fix.
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Freeze/EvictorI.java | 10 | ||||
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 56 | ||||
-rw-r--r-- | java/src/Ice/_ObjectDelM.java | 8 | ||||
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 10 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointFactoryManager.java | 8 | ||||
-rw-r--r-- | java/src/IceInternal/ReferenceFactory.java | 76 | ||||
-rw-r--r-- | java/src/IceInternal/TcpEndpoint.java | 28 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpoint.java | 24 | ||||
-rw-r--r-- | java/src/IceXML/StreamI.java | 5 |
9 files changed, 165 insertions, 60 deletions
diff --git a/java/src/Freeze/EvictorI.java b/java/src/Freeze/EvictorI.java index 5c9bd531c65..4ab7c5bb49c 100644 --- a/java/src/Freeze/EvictorI.java +++ b/java/src/Freeze/EvictorI.java @@ -157,14 +157,10 @@ class EvictorI extends Ice.LocalObjectImpl implements Evictor assert(_db != null); // - // TODO: HACK: It's possible that locate is called on a - // deactivated servant locator. There's currently no nice way to - // handle this case so we just through an UnknownLocatoException. + // If this operation is called on a deactivated servant locator, + // it's a bug in Ice. // - if(_deactivated) - { - throw new Ice.UnknownLocalException(); - } + assert(!_deactivated); // // First copy current.identity. This is necessary since this diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 126a3a17d1d..0dd1d66b429 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -23,7 +23,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } return _communicator; @@ -34,7 +36,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } if(!_printAdapterReadyDone) @@ -94,7 +98,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } final int sz = _incomingConnectionFactories.size(); @@ -162,7 +168,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } // @@ -182,7 +190,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } long now = System.currentTimeMillis(); @@ -200,7 +210,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } _activeServantMap.remove(ident); @@ -211,7 +223,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } _locatorMap.put(prefix, locator); @@ -222,7 +236,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } ServantLocator locator = (ServantLocator)_locatorMap.remove(prefix); @@ -237,7 +253,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } return (ServantLocator)_locatorMap.get(prefix); @@ -261,7 +279,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } return newProxy(ident); @@ -272,7 +292,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } return newDirectProxy(ident); @@ -283,7 +305,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } // @@ -302,7 +326,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } IceInternal.RouterInfo routerInfo = _instance.routerManager().get(router); @@ -350,7 +376,9 @@ public class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapter { if(_instance == null) { - throw new ObjectAdapterDeactivatedException(); + ObjectAdapterDeactivatedException e = new ObjectAdapterDeactivatedException(); + e.name = _name; + throw e; } _locatorInfo = _instance.locatorManager().get(locator); diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java index 1772a7f53f3..c69113f68fa 100644 --- a/java/src/Ice/_ObjectDelM.java +++ b/java/src/Ice/_ObjectDelM.java @@ -194,7 +194,9 @@ public class _ObjectDelM implements _ObjectDel if(endpoints.length == 0) { - throw new NoEndpointException(); + NoEndpointException e = new NoEndpointException(); + e.proxy = __reference.toString(); + throw e; } int j; @@ -242,7 +244,9 @@ public class _ObjectDelM implements _ObjectDel } if(filteredEndpoints == null || filteredEndpoints.length == 0) { - throw new NoEndpointException(); + NoEndpointException e = new NoEndpointException(); + e.proxy = __reference.toString(); + throw e; } try diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index d5f79678e81..50d66727a35 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -952,7 +952,9 @@ public class BasicStream if(v == null) { - throw new Ice.NoObjectFactoryException(); + Ice.NoObjectFactoryException ex = new Ice.NoObjectFactoryException(); + ex.type = id; + throw ex; } } if(_readEncapsStack.objectsRead == null) // Lazy creation @@ -1016,7 +1018,9 @@ public class BasicStream } } - throw new Ice.NoUserExceptionFactoryException(); + Ice.NoUserExceptionFactoryException ex = new Ice.NoUserExceptionFactoryException(); + ex.type = id; + throw ex; } int @@ -1121,6 +1125,7 @@ public class BasicStream catch(Exception ex) { Ice.NoObjectFactoryException e = new Ice.NoObjectFactoryException(); + e.type = id; e.initCause(ex); throw e; } @@ -1189,6 +1194,7 @@ public class BasicStream catch(Exception ex) { Ice.NoUserExceptionFactoryException e = new Ice.NoUserExceptionFactoryException(); + e.type = id; e.initCause(ex); throw e; } diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index eda98033594..c75b82ea1fc 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -51,7 +51,9 @@ public final class EndpointFactoryManager String s = str.trim(); if(s.length() == 0) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = str; + throw e; } java.util.regex.Pattern p = java.util.regex.Pattern.compile("([ \t\n\r]+)|$"); @@ -75,7 +77,9 @@ public final class EndpointFactoryManager } } - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = str; + throw e; } public synchronized Endpoint diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 0024ea73a9d..7815d149b0d 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -88,7 +88,9 @@ public final class ReferenceFactory beg = StringUtil.findFirstNotOf(s, delim, end); if(beg == -1) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } // @@ -99,7 +101,9 @@ public final class ReferenceFactory end = StringUtil.checkQuote(s, beg); if(end == -1) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } else if(end == 0) { @@ -119,7 +123,9 @@ public final class ReferenceFactory if(beg == end) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } Ice.Identity ident = Ice.Util.stringToIdentity(idstr); @@ -161,7 +167,9 @@ public final class ReferenceFactory String option = s.substring(beg, end); if(option.length() != 2 || option.charAt(0) != '-') { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } // @@ -180,7 +188,9 @@ public final class ReferenceFactory end = StringUtil.checkQuote(s, beg); if(end == -1) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } else if(end == 0) { @@ -210,7 +220,9 @@ public final class ReferenceFactory { if(argument == null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } final int argLen = argument.length(); @@ -248,7 +260,9 @@ public final class ReferenceFactory if(!IceInternal.StringUtil.decodeString(argument, argBeg, argEnd, token)) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } facet.add(token.value); argBeg = argEnd + 1; @@ -256,7 +270,9 @@ public final class ReferenceFactory if(facet.size() == 0) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } break; @@ -266,7 +282,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } mode = Reference.ModeTwoway; break; @@ -276,7 +294,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } mode = Reference.ModeOneway; break; @@ -286,7 +306,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } mode = Reference.ModeBatchOneway; break; @@ -296,7 +318,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } mode = Reference.ModeDatagram; break; @@ -306,7 +330,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } mode = Reference.ModeBatchDatagram; break; @@ -316,7 +342,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } secure = true; break; @@ -326,7 +354,9 @@ public final class ReferenceFactory { if(argument != null) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } compress = true; break; @@ -334,7 +364,9 @@ public final class ReferenceFactory default: { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } } } @@ -366,13 +398,17 @@ public final class ReferenceFactory beg = StringUtil.findFirstNotOf(s, delim, beg + 1); if(beg == -1) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } end = StringUtil.checkQuote(s, beg); if(end == -1) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } else if(end == 0) { @@ -390,7 +426,9 @@ public final class ReferenceFactory Ice.StringHolder token = new Ice.StringHolder(); if(!IceInternal.StringUtil.decodeString(s, beg, end, token) || token.value.length() == 0) { - throw new Ice.ProxyParseException(); + Ice.ProxyParseException e = new Ice.ProxyParseException(); + e.str = s; + throw e; } adapter = token.value; } diff --git a/java/src/IceInternal/TcpEndpoint.java b/java/src/IceInternal/TcpEndpoint.java index d90882691fa..34e1db359de 100644 --- a/java/src/IceInternal/TcpEndpoint.java +++ b/java/src/IceInternal/TcpEndpoint.java @@ -46,7 +46,9 @@ final class TcpEndpoint implements Endpoint String option = arr[i++]; if(option.length() != 2 || option.charAt(0) != '-') { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } String argument = null; @@ -61,7 +63,9 @@ final class TcpEndpoint implements Endpoint { if(argument == null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } _host = argument; @@ -72,7 +76,9 @@ final class TcpEndpoint implements Endpoint { if(argument == null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } try @@ -81,7 +87,9 @@ final class TcpEndpoint implements Endpoint } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } break; @@ -91,7 +99,9 @@ final class TcpEndpoint implements Endpoint { if(argument == null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } try @@ -100,7 +110,9 @@ final class TcpEndpoint implements Endpoint } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } break; @@ -108,7 +120,9 @@ final class TcpEndpoint implements Endpoint default: { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "tcp " + str; + throw e; } } } diff --git a/java/src/IceInternal/UdpEndpoint.java b/java/src/IceInternal/UdpEndpoint.java index 8b2e74569cf..1392d20d908 100644 --- a/java/src/IceInternal/UdpEndpoint.java +++ b/java/src/IceInternal/UdpEndpoint.java @@ -46,7 +46,9 @@ final class UdpEndpoint implements Endpoint String option = arr[i++]; if(option.length() != 2 || option.charAt(0) != '-') { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } String argument = null; @@ -61,7 +63,9 @@ final class UdpEndpoint implements Endpoint { if(argument == null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } _host = argument; @@ -72,7 +76,9 @@ final class UdpEndpoint implements Endpoint { if(argument == null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } try @@ -81,7 +87,9 @@ final class UdpEndpoint implements Endpoint } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } break; @@ -91,7 +99,9 @@ final class UdpEndpoint implements Endpoint { if(argument != null) { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } _connect = true; @@ -100,7 +110,9 @@ final class UdpEndpoint implements Endpoint default: { - throw new Ice.EndpointParseException(); + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = "udp " + str; + throw e; } } } diff --git a/java/src/IceXML/StreamI.java b/java/src/IceXML/StreamI.java index 6f4a7c745d6..01413c450ca 100644 --- a/java/src/IceXML/StreamI.java +++ b/java/src/IceXML/StreamI.java @@ -1074,7 +1074,9 @@ public class StreamI extends Ice.LocalObjectImpl implements Ice.Stream if(value == null) { - throw new Ice.NoObjectFactoryException(); + Ice.NoObjectFactoryException e = new Ice.NoObjectFactoryException(); + e.type = type.value; + throw e; } } @@ -1391,6 +1393,7 @@ public class StreamI extends Ice.LocalObjectImpl implements Ice.Stream catch(Exception ex) { Ice.NoObjectFactoryException e = new Ice.NoObjectFactoryException(); + e.type = id; e.initCause(ex); throw e; } |