[34046] trunk/dports/devel/ice-java
blair at macports.org
blair at macports.org
Sun Feb 10 20:17:22 PST 2008
Revision: 34046
http://trac.macosforge.org/projects/macports/changeset/34046
Author: blair at macports.org
Date: 2008-02-10 20:17:22 -0800 (Sun, 10 Feb 2008)
Log Message:
-----------
New upstream patch to allow servant locators to throw exceptions.
Fix the test case to cd into the test subdirectory.
Modified Paths:
--------------
trunk/dports/devel/ice-java/Portfile
Added Paths:
-----------
trunk/dports/devel/ice-java/files/
trunk/dports/devel/ice-java/files/patch-ServantLocator.locate-can-throw-user-exceptions.diff
Modified: trunk/dports/devel/ice-java/Portfile
===================================================================
--- trunk/dports/devel/ice-java/Portfile 2008-02-11 03:56:11 UTC (rev 34045)
+++ trunk/dports/devel/ice-java/Portfile 2008-02-11 04:17:22 UTC (rev 34046)
@@ -3,6 +3,7 @@
PortSystem 1.0
name ice-java
version 3.2.1
+revision 1
categories devel java
maintainers blair
description Fast, object-oriented RPC for C++, Java, Python, Ruby, PHP
@@ -29,6 +30,7 @@
master_sites http://www.zeroc.com/download/Ice/3.2/
distfiles IceJ-${version}-java2.tar.gz \
IceJ-${version}-java5.tar.gz
+patchfiles patch-ServantLocator.locate-can-throw-user-exceptions.diff
checksums IceJ-${version}-java2.tar.gz \
md5 6d6b199608ba8947c1b5f2c8849f3cec \
sha1 cfeb9545f1baa71a04e10d45795f0cb677441e35 \
@@ -40,15 +42,42 @@
platforms darwin
-depends_run port:db45 port:ice-cpp
+depends_lib port:db45 port:ice-cpp
+depends_build port:apache-ant \
+ port:jgoodies-forms \
+ port:jgoodies-looks \
+ port:proguard
use_configure no
-build.dir ${workpath}
-build.cmd true
+patch {
+ set cmd "cd ${workpath}/IceJ-${version}-java2 && patch -p2 < ${filespath}/patch-ServantLocator.locate-can-throw-user-exceptions.diff"
+ ui_debug ${cmd}
+ system ${cmd}
+ set cmd "cd ${workpath}/IceJ-${version}-java5 && patch -p2 < ${filespath}/patch-ServantLocator.locate-can-throw-user-exceptions.diff"
+ ui_debug ${cmd}
+ system ${cmd}
+}
+
+set classpath ${prefix}/lib/db45/db.jar:${prefix}/share/java/forms.jar:${prefix}/share/java/looks.jar:${prefix}/share/java/proguard.jar
+
+build {
+ set cmd "cd ${workpath}/IceJ-${version}-java2 && JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Home CLASSPATH=${classpath} ICE_HOME=${prefix} ant clean all"
+ ui_debug ${cmd}
+ system ${cmd}
+
+ set cmd "cd ${workpath}/IceJ-${version}-java5 && JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} ICE_HOME=${prefix} ant clean all"
+ ui_debug ${cmd}
+ system ${cmd}
+}
+
test.run yes
-test.target test
+test {
+ set cmd "cd ${workpath}/IceJ-${version}-java5/test && JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} ICE_HOME=${prefix} ant clean all"
+ ui_debug ${cmd}
+ system ${cmd}
+}
destroot {
set ice-java2 ${workpath}/IceJ-${version}-java2
Added: trunk/dports/devel/ice-java/files/patch-ServantLocator.locate-can-throw-user-exceptions.diff
===================================================================
--- trunk/dports/devel/ice-java/files/patch-ServantLocator.locate-can-throw-user-exceptions.diff (rev 0)
+++ trunk/dports/devel/ice-java/files/patch-ServantLocator.locate-can-throw-user-exceptions.diff 2008-02-11 04:17:22 UTC (rev 34046)
@@ -0,0 +1,805 @@
+diff --git a/java/CHANGES b/java/CHANGES
+index 77eec49..85a3c03 100644
+--- a/java/CHANGES
++++ b/java/CHANGES
+@@ -1,3 +1,11 @@
++Changes since version 3.2.1
++---------------------------
++
++- Changed servant locators so both locate() and finished() can
++ throw user exceptions. (See the manual for details.)
++
++- Fixed the generated hashCode method to prevent NullPointerException.
++
+ Changes since version 3.2.0
+ ---------------------------
+
+diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java
+index 0d06e5b..93469e8 100644
+--- a/java/src/Ice/_ObjectDelD.java
++++ b/java/src/Ice/_ObjectDelD.java
+@@ -17,17 +17,37 @@ public class _ObjectDelD implements _ObjectDel
+ {
+ Current __current = new Current();
+ __initCurrent(__current, "ice_isA", OperationMode.Nonmutating, __context);
++ boolean __ret = false;
+ while(true)
+ {
+- IceInternal.Direct __direct = new IceInternal.Direct(__current);
+ try
+ {
+- return __direct.servant().ice_isA(__id, __current);
++ IceInternal.Direct __direct = new IceInternal.Direct(__current);
++ try
++ {
++ __ret = __direct.servant().ice_isA(__id, __current);
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ finally
++ {
++ try
++ {
++ __direct.destroy();
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ }
+ }
+- finally
++ catch(Throwable __ex)
+ {
+- __direct.destroy();
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
+ }
++ return __ret;
+ }
+ }
+
+@@ -39,16 +59,34 @@ public class _ObjectDelD implements _ObjectDel
+ __initCurrent(__current, "ice_ping", OperationMode.Nonmutating, __context);
+ while(true)
+ {
+- IceInternal.Direct __direct = new IceInternal.Direct(__current);
+ try
+ {
+- __direct.servant().ice_ping(__current);
+- return;
++ IceInternal.Direct __direct = new IceInternal.Direct(__current);
++ try
++ {
++ __direct.servant().ice_ping(__current);
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ finally
++ {
++ try
++ {
++ __direct.destroy();
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ }
+ }
+- finally
++ catch(Throwable __ex)
+ {
+- __direct.destroy();
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
+ }
++ return;
+ }
+ }
+
+@@ -58,17 +96,37 @@ public class _ObjectDelD implements _ObjectDel
+ {
+ Current __current = new Current();
+ __initCurrent(__current, "ice_ids", OperationMode.Nonmutating, __context);
++ String[] __ret = null;
+ while(true)
+ {
+- IceInternal.Direct __direct = new IceInternal.Direct(__current);
+ try
+ {
+- return __direct.servant().ice_ids(__current);
++ IceInternal.Direct __direct = new IceInternal.Direct(__current);
++ try
++ {
++ __ret = __direct.servant().ice_ids(__current);
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ finally
++ {
++ try
++ {
++ __direct.destroy();
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ }
+ }
+- finally
++ catch(Throwable __ex)
+ {
+- __direct.destroy();
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
+ }
++ return __ret;
+ }
+ }
+
+@@ -78,17 +136,37 @@ public class _ObjectDelD implements _ObjectDel
+ {
+ Current __current = new Current();
+ __initCurrent(__current, "ice_id", OperationMode.Nonmutating, __context);
++ String __ret = null;
+ while(true)
+ {
+- IceInternal.Direct __direct = new IceInternal.Direct(__current);
+ try
+ {
+- return __direct.servant().ice_id(__current);
++ IceInternal.Direct __direct = new IceInternal.Direct(__current);
++ try
++ {
++ __ret = __direct.servant().ice_id(__current);
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ finally
++ {
++ try
++ {
++ __direct.destroy();
++ }
++ catch(Throwable __ex)
++ {
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
++ }
++ }
+ }
+- finally
++ catch(Throwable __ex)
+ {
+- __direct.destroy();
++ IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);
+ }
++ return __ret;
+ }
+ }
+
+diff --git a/java/src/IceInternal/Direct.java b/java/src/IceInternal/Direct.java
+index 616c911..9a2c4de 100644
+--- a/java/src/IceInternal/Direct.java
++++ b/java/src/IceInternal/Direct.java
+@@ -12,7 +12,7 @@ package IceInternal;
+ public final class Direct
+ {
+ public
+- Direct(Ice.Current current)
++ Direct(Ice.Current current) throws Ice.UserException
+ {
+ _current = current;
+
+@@ -44,7 +44,15 @@ public final class Direct
+ if(_locator != null)
+ {
+ _cookie = new Ice.LocalObjectHolder(); // Lazy creation.
+- _servant = _locator.locate(_current, _cookie);
++ try
++ {
++ _servant = _locator.locate(_current, _cookie);
++ }
++ catch(Ice.UserException ex)
++ {
++ adapter.decDirectCount();
++ throw ex;
++ }
+ }
+ }
+ if(_servant == null)
+@@ -85,7 +93,7 @@ public final class Direct
+ }
+
+ public void
+- destroy()
++ destroy() throws Ice.UserException
+ {
+ Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)_current.adapter;
+ assert(adapter != null);
+diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java
+index 7507584..388343f 100644
+--- a/java/src/IceInternal/Incoming.java
++++ b/java/src/IceInternal/Incoming.java
+@@ -94,7 +94,6 @@ final public class Incoming extends IncomingBase
+ _os.startWriteEncaps();
+ }
+
+- // Initialize status to some value, to keep the compiler happy.
+ DispatchStatus status = DispatchStatus.DispatchOK;
+
+ //
+@@ -119,48 +118,59 @@ final public class Incoming extends IncomingBase
+ }
+ if(_locator != null)
+ {
+- _servant = _locator.locate(_current, _cookie);
++ try
++ {
++ _servant = _locator.locate(_current, _cookie);
++ }
++ catch(Ice.UserException ex)
++ {
++ _os.writeUserException(ex);
++ status = DispatchStatus.DispatchUserException;
++ }
+ }
+ }
++ }
++ if(status == DispatchStatus.DispatchOK)
++ {
+ if(_servant == null)
+ {
+- _locator = servantManager.findServantLocator("");
+- if(_locator != null)
++ if(servantManager != null && servantManager.hasServant(_current.id))
+ {
+- _servant = _locator.locate(_current, _cookie);
++ status = DispatchStatus.DispatchFacetNotExist;
++ }
++ else
++ {
++ status = DispatchStatus.DispatchObjectNotExist;
+ }
+- }
+- }
+- if(_servant == null)
+- {
+- if(servantManager != null && servantManager.hasServant(_current.id))
+- {
+- status = DispatchStatus.DispatchFacetNotExist;
+ }
+ else
+ {
+- status = DispatchStatus.DispatchObjectNotExist;
++ status = _servant.__dispatch(this, _current);
+ }
+ }
+- else
+- {
+- status = _servant.__dispatch(this, _current);
+- }
+ }
+ finally
+ {
+ if(_locator != null && _servant != null && status != DispatchStatus.DispatchAsync)
+ {
+- _locator.finished(_current, _servant, _cookie.value);
++ try
++ {
++ _locator.finished(_current, _servant, _cookie.value);
++ }
++ catch(Ice.UserException ex)
++ {
++ //
++ // The operation may have already marshaled a reply; we must overwrite that reply.
++ //
++ _os.endWriteEncaps();
++ _os.resize(Protocol.headerSize + 5, false); // Byte following reply status.
++ _os.startWriteEncaps();
++ _os.writeUserException(ex);
++ status = DispatchStatus.DispatchUserException; // Code below inserts the reply status.
++ }
+ }
+ }
+ }
+- /* Not possible in Java - UserExceptions are checked exceptions
+- catch(Ice.UserException ex)
+- {
+- // ...
+- }
+- */
+ catch(java.lang.Exception ex)
+ {
+ _is.endReadEncaps();
+diff --git a/java/src/IceInternal/IncomingAsync.java b/java/src/IceInternal/IncomingAsync.java
+index d985797..69bde1a 100644
+--- a/java/src/IceInternal/IncomingAsync.java
++++ b/java/src/IceInternal/IncomingAsync.java
+@@ -83,7 +83,30 @@ public class IncomingAsync extends IncomingBase
+ {
+ if(_locator != null && _servant != null)
+ {
+- _locator.finished(_current, _servant, _cookie.value);
++ try
++ {
++ _locator.finished(_current, _servant, _cookie.value);
++ }
++ catch(Ice.UserException ex)
++ {
++ // The operation may have already marshaled a reply; we must overwrite that reply.
++ //
++ if(_response)
++ {
++ _os.endWriteEncaps();
++ _os.resize(Protocol.headerSize + 4, false); // Reply status position.
++ _os.writeByte((byte)DispatchStatus._DispatchUserException);
++ _os.startWriteEncaps();
++ _os.writeUserException(ex);
++ _os.endWriteEncaps();
++ _connection.sendResponse(_os, _compress);
++ }
++ else
++ {
++ _connection.sendNoResponse();
++ }
++ return false;
++ }
+ }
+ return true;
+ }
+diff --git a/java/src/IceInternal/LocalExceptionWrapper.java b/java/src/IceInternal/LocalExceptionWrapper.java
+index 8c9fbf9..4e078b3 100644
+--- a/java/src/IceInternal/LocalExceptionWrapper.java
++++ b/java/src/IceInternal/LocalExceptionWrapper.java
+@@ -44,6 +44,34 @@ public class LocalExceptionWrapper extends Exception
+ return _retry;
+ }
+
++ public static void
++ throwUnknownWrapper(java.lang.Throwable ex) throws LocalExceptionWrapper
++ {
++ if(ex instanceof Ice.UserException)
++ {
++ throw new LocalExceptionWrapper(new Ice.UnknownUserException(ex.toString()), false);
++ }
++ if(ex instanceof Ice.LocalException)
++ {
++ /*
++ //
++ // Commented-out code makes local exceptions fully location transparent,
++ // but the Freeze evictor relies on them not being transparent.
++ //
++ if(ex instanceof Ice.UnknownException ||
++ ex instanceof Ice.ObjectNotExistException ||
++ ex instanceof Ice.OperationNotExistException ||
++ ex instanceof Ice.FacetNotExistException)
++ {
++ throw new LocalExceptionWrapper((Ice.LocalException)ex, false);
++ }
++ throw new LocalExceptionWrapper(new Ice.UnknownLocalException(ex.toString()), false);
++ */
++ throw new LocalExceptionWrapper((Ice.LocalException)ex, false);
++ }
++ throw new LocalExceptionWrapper(new Ice.UnknownException(ex.toString()), false);
++ }
++
+ private Ice.LocalException _ex;
+ private boolean _retry;
+ }
+diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java
+index efc02e2..21d324f 100644
+--- a/java/test/Ice/exceptions/AllTests.java
++++ b/java/test/Ice/exceptions/AllTests.java
+@@ -1068,7 +1068,7 @@ public class AllTests
+ thrower.throwAssertException();
+ test(false);
+ }
+- catch(java.lang.AssertionError ex)
++ catch(Ice.UnknownException ex)
+ {
+ assert(collocated);
+ }
+@@ -1196,19 +1196,10 @@ public class AllTests
+ }
+ catch(Ice.UnknownException ex)
+ {
+- //
+- // We get the an unknown exception without collocation
+- // optimization.
+- //
+- test(!collocated);
+ }
+ catch(RuntimeException ex)
+ {
+- //
+- // We get the original exception with collocation
+- // optimization.
+- //
+- test(collocated);
++ test(false);
+ }
+
+ System.out.println("ok");
+diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java
+index b631527..c94bad8 100644
+--- a/java/test/Ice/servantLocator/AllTests.java
++++ b/java/test/Ice/servantLocator/AllTests.java
+@@ -112,12 +112,87 @@ public class AllTests
+ catch(UnknownException ex)
+ {
+ //System.err.println(ex.unknown);
+- test(!collocated);
+ test(ex.unknown.indexOf("java.lang.RuntimeException: message") >= 0);
+ }
+ catch(java.lang.RuntimeException ex)
+ {
+- test(collocated);
++ test(false);
++ }
++
++ try
++ {
++ obj.impossibleException(false);
++ test(false);
++ }
++ catch(TestImpossibleException ex)
++ {
++ test(false);
++ }
++ catch(UnknownUserException ex)
++ {
++ // Operation doesn't throw, but locate() and finished() throw TestIntfUserException.
++ }
++ catch(RuntimeException ex)
++ {
++ //System.err.println(ex);
++ test(false);
++ }
++
++ try
++ {
++ obj.impossibleException(true);
++ test(false);
++ }
++ catch(TestImpossibleException ex)
++ {
++ test(false);
++ }
++ catch(UnknownUserException ex)
++ {
++ // Operation throws TestImpossibleException, but locate() and finished() throw TestIntfUserException.
++ }
++ catch(RuntimeException ex)
++ {
++ //System.err.println(ex);
++ test(false);
++ }
++
++ try
++ {
++ obj.intfUserException(false);
++ test(false);
++ }
++ catch(TestImpossibleException ex)
++ {
++ // Operation doesn't throw, but locate() and finished() throw TestImpossibleException.
++ }
++ catch(TestIntfUserException ex)
++ {
++ test(false);
++ }
++ catch(RuntimeException ex)
++ {
++ //System.err.println(ex);
++ test(false);
++ }
++
++ try
++ {
++ obj.intfUserException(true);
++ test(false);
++ }
++ catch(TestImpossibleException ex)
++ {
++ // Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException.
++ }
++ catch(TestIntfUserException ex)
++ {
++ test(false);
++ }
++ catch(RuntimeException ex)
++ {
++ //System.err.println(ex);
++ test(false);
+ }
+ }
+
+diff --git a/java/test/Ice/servantLocator/ServantLocatorI.java b/java/test/Ice/servantLocator/ServantLocatorI.java
+index 279d9cf..7edc238 100644
+--- a/java/test/Ice/servantLocator/ServantLocatorI.java
++++ b/java/test/Ice/servantLocator/ServantLocatorI.java
+@@ -36,7 +36,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ public Ice.Object
+- locate(Ice.Current current, Ice.LocalObjectHolder cookie)
++ locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+@@ -62,7 +62,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ public void
+- finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie)
++ finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+@@ -93,7 +93,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ private void
+- exception(Ice.Current current)
++ exception(Ice.Current current) throws Ice.UserException
+ {
+ if(current.operation.equals("requestFailedException"))
+ {
+@@ -127,6 +127,14 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ {
+ throw new java.lang.RuntimeException("message");
+ }
++ else if(current.operation.equals("impossibleException"))
++ {
++ throw new TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
++ }
++ else if(current.operation.equals("intfUserException"))
++ {
++ throw new TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
++ }
+ }
+
+ private boolean _deactivated;
+diff --git a/java/test/Ice/servantLocator/Test.ice b/java/test/Ice/servantLocator/Test.ice
+index cabf0ce..a4777fa 100644
+--- a/java/test/Ice/servantLocator/Test.ice
++++ b/java/test/Ice/servantLocator/Test.ice
+@@ -17,6 +17,10 @@ exception TestIntfUserException
+ {
+ };
+
++exception TestImpossibleException
++{
++};
++
+ interface TestIntf
+ {
+ void requestFailedException();
+@@ -27,6 +31,9 @@ interface TestIntf
+ //void userException();
+ void javaException();
+
++ string impossibleException(bool throw) throws TestImpossibleException;
++ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
++
+ void shutdown();
+ };
+
+diff --git a/java/test/Ice/servantLocator/TestI.java b/java/test/Ice/servantLocator/TestI.java
+index df96472..033a7e2 100644
+--- a/java/test/Ice/servantLocator/TestI.java
++++ b/java/test/Ice/servantLocator/TestI.java
+@@ -45,6 +45,36 @@ public final class TestI extends _TestIntfDisp
+ javaException(Ice.Current current)
+ {
+ }
++
++ public String
++ impossibleException(boolean _throw, Ice.Current current) throws TestImpossibleException
++ {
++ if(_throw)
++ {
++ throw new TestImpossibleException();
++ }
++
++ //
++ // Return a value so we can be sure that the stream position
++ // is reset correctly if finished() throws.
++ //
++ return "Hello";
++ }
++
++ public String
++ intfUserException(boolean _throw, Ice.Current current) throws TestIntfUserException, TestImpossibleException
++ {
++ if(_throw)
++ {
++ throw new TestIntfUserException();
++ }
++
++ //
++ // Return a value so we can be sure that the stream position
++ // is reset correctly if finished() throws.
++ //
++ return "Hello";
++ }
+
+ public void
+ shutdown(Ice.Current current)
+diff --git a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java b/java/test/Ice/servantLocatorAMD/ServantLocatorI.java
+index 279d9cf..7edc238 100644
+--- a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java
++++ b/java/test/Ice/servantLocatorAMD/ServantLocatorI.java
+@@ -36,7 +36,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ public Ice.Object
+- locate(Ice.Current current, Ice.LocalObjectHolder cookie)
++ locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+@@ -62,7 +62,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ public void
+- finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie)
++ finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+@@ -93,7 +93,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ }
+
+ private void
+- exception(Ice.Current current)
++ exception(Ice.Current current) throws Ice.UserException
+ {
+ if(current.operation.equals("requestFailedException"))
+ {
+@@ -127,6 +127,14 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se
+ {
+ throw new java.lang.RuntimeException("message");
+ }
++ else if(current.operation.equals("impossibleException"))
++ {
++ throw new TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
++ }
++ else if(current.operation.equals("intfUserException"))
++ {
++ throw new TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
++ }
+ }
+
+ private boolean _deactivated;
+diff --git a/java/test/Ice/servantLocatorAMD/TestAMD.ice b/java/test/Ice/servantLocatorAMD/TestAMD.ice
+index bae702b..be1694f 100644
+--- a/java/test/Ice/servantLocatorAMD/TestAMD.ice
++++ b/java/test/Ice/servantLocatorAMD/TestAMD.ice
+@@ -17,6 +17,10 @@ exception TestIntfUserException
+ {
+ };
+
++exception TestImpossibleException
++{
++};
++
+ ["amd"] interface TestIntf
+ {
+ void requestFailedException();
+@@ -27,6 +31,9 @@ exception TestIntfUserException
+ //void userException();
+ void javaException();
+
++ string impossibleException(bool throw) throws TestImpossibleException;
++ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
++
+ void shutdown();
+ };
+
+diff --git a/java/test/Ice/servantLocatorAMD/TestI.java b/java/test/Ice/servantLocatorAMD/TestI.java
+index fcccc0a..68bdf64 100644
+--- a/java/test/Ice/servantLocatorAMD/TestI.java
++++ b/java/test/Ice/servantLocatorAMD/TestI.java
+@@ -52,6 +52,40 @@ public final class TestI extends _TestIntfDisp
+ {
+ cb.ice_response();
+ }
++
++ public void
++ impossibleException_async(AMD_TestIntf_impossibleException cb, boolean _throw, Ice.Current current)
++ {
++ if(_throw)
++ {
++ cb.ice_exception(new TestImpossibleException());
++ }
++ else
++ {
++ //
++ // Return a value so we can be sure that the stream position
++ // is reset correctly if finished() throws.
++ //
++ cb.ice_response("Hello");
++ }
++ }
++
++ public void
++ intfUserException_async(AMD_TestIntf_intfUserException cb, boolean _throw, Ice.Current current)
++ {
++ if(_throw)
++ {
++ cb.ice_exception(new TestIntfUserException());
++ }
++ else
++ {
++ //
++ // Return a value so we can be sure that the stream position
++ // is reset correctly if finished() throws.
++ //
++ cb.ice_response("Hello");
++ }
++ }
+
+ public void
+ shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+diff --git a/cpp/slice/Ice/ServantLocator.ice b/cpp/slice/Ice/ServantLocator.ice
+index ce21192..6654fd7 100644
+--- a/cpp/slice/Ice/ServantLocator.ice
++++ b/cpp/slice/Ice/ServantLocator.ice
+@@ -36,6 +36,15 @@ local interface ServantLocator
+ * the returned servant into its active servant map. This must be
+ * done by the servant locator implementation, if this is desired.
+ *
++ * [locate] can throw any user exception. If it does, that exception
++ * is marshaled back to the client. If the Slice definition for the
++ * corresponding operation includes that user exception, the client
++ * receives that user exception; otherwise, the client receives
++ * [UnknownUserException].
++ *
++ * If [locate] throws any exception, the Ice run time does <EM>not</EM>
++ * call [finished].
++ *
+ * <p class="Note">If you call [locate] from your own code, you
+ * must also call [finished] when you have finished using the
+ * servant, provided that [locate] returned a non-null servant;
+@@ -55,7 +64,7 @@ local interface ServantLocator
+ * @see finished
+ *
+ **/
+- Object locate(Current curr, out LocalObject cookie);
++ ["UserException"] Object locate(Current curr, out LocalObject cookie);
+
+ /**
+ *
+@@ -64,6 +73,15 @@ local interface ServantLocator
+ * prior to the request and returned a non-null servant. This
+ * operation can be used for cleanup purposes after a request.
+ *
++ * [finished] can throw any user exception. If it does, that exception
++ * is marshaled back to the client. If the Slice definition for the
++ * corresponding operation includes that user exception, the client
++ * receives that user exception; otherwise, the client receives
++ * [UnknownUserException].
++ *
++ * If both the operation and [finished] throw an exception, the
++ * exception thrown by [finished] is marshaled back to the client.
++ *
+ * @param curr Information about the current operation call for
+ * which a servant was located by [locate].
+ *
+@@ -76,7 +94,7 @@ local interface ServantLocator
+ * @see locate
+ *
+ **/
+- void finished(Current curr, Object servant, LocalObject cookie);
++ ["UserException"] void finished(Current curr, Object servant, LocalObject cookie);
+
+ /**
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080210/fd79ce21/attachment-0001.html
More information about the macports-changes
mailing list