[32227] trunk/dports/devel/ice-cpp

blair at macports.org blair at macports.org
Thu Dec 20 12:53:08 PST 2007


Revision: 32227
          http://trac.macosforge.org/projects/macports/changeset/32227
Author:   blair at macports.org
Date:     2007-12-20 12:53:05 -0800 (Thu, 20 Dec 2007)

Log Message:
-----------
New patch from upstream that allows the ServantLocator's locate() and
finished() methods throw user exceptions that are properly returned to
the client.

Modified Paths:
--------------
    trunk/dports/devel/ice-cpp/Portfile

Added Paths:
-----------
    trunk/dports/devel/ice-cpp/files/patch-ServantLocator.locate-can-throw-user-exceptions

Modified: trunk/dports/devel/ice-cpp/Portfile
===================================================================
--- trunk/dports/devel/ice-cpp/Portfile	2007-12-20 20:49:26 UTC (rev 32226)
+++ trunk/dports/devel/ice-cpp/Portfile	2007-12-20 20:53:05 UTC (rev 32227)
@@ -3,6 +3,7 @@
 PortSystem 1.0
 name		ice-cpp
 version		3.2.1
+revision	1
 categories	devel
 maintainers	blair
 description	Fast, object-oriented RPC for C++, Java, Python, Ruby, PHP
@@ -41,7 +42,8 @@
 		port:readline
 
 patchfiles	patch-config.Make.rules \
-		patch-config.Make.rules.Darwin
+		patch-config.Make.rules.Darwin \
+		patch-ServantLocator.locate-can-throw-user-exceptions
 
 use_configure	no
 

Added: trunk/dports/devel/ice-cpp/files/patch-ServantLocator.locate-can-throw-user-exceptions
===================================================================
--- trunk/dports/devel/ice-cpp/files/patch-ServantLocator.locate-can-throw-user-exceptions	                        (rev 0)
+++ trunk/dports/devel/ice-cpp/files/patch-ServantLocator.locate-can-throw-user-exceptions	2007-12-20 20:53:05 UTC (rev 32227)
@@ -0,0 +1,1984 @@
+diff -ru ../Ice-3.2.1.orig/include/Ice/Outgoing.h ./include/Ice/Outgoing.h
+--- ../Ice-3.2.1.orig/include/Ice/Outgoing.h	2007-08-08 12:00:54.000000000 -0700
++++ ./include/Ice/Outgoing.h	2007-12-20 12:16:29.000000000 -0800
+@@ -49,6 +49,8 @@
+     //
+     bool retry() const;
+ 
++    static void throwUnknownWrapper(const ::std::exception&);
++
+ private:
+ 
+     const LocalExceptionWrapper& operator=(const LocalExceptionWrapper&);
+diff -ru ../Ice-3.2.1.orig/include/Slice/CsUtil.h ./include/Slice/CsUtil.h
+--- ../Ice-3.2.1.orig/include/Slice/CsUtil.h	2007-08-08 12:00:54.000000000 -0700
++++ ./include/Slice/CsUtil.h	2007-12-20 12:16:29.000000000 -0800
+@@ -34,6 +34,7 @@
+ 
+ protected:
+     static std::string fixId(const std::string&, int = 0, bool = false);
++    static std::string fixId(const ContainedPtr&, int = 0, bool = false);
+     static std::string typeToString(const TypePtr&);
+     static bool isValueType(const TypePtr&);
+ 
+diff -ru ../Ice-3.2.1.orig/slice/Ice/ServantLocator.ice ./slice/Ice/ServantLocator.ice
+--- ../Ice-3.2.1.orig/slice/Ice/ServantLocator.ice	2007-08-08 12:00:54.000000000 -0700
++++ ./slice/Ice/ServantLocator.ice	2007-12-20 12:16:29.000000000 -0800
+@@ -36,6 +36,15 @@
+      * 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 @@
+      * @see finished
+      *
+      **/
+-    Object locate(Current curr, out LocalObject cookie);
++    ["UserException"] Object locate(Current curr, out LocalObject cookie);
+ 
+     /**
+      *
+@@ -64,6 +73,15 @@
+      * 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 @@
+      * @see locate
+      *
+      **/
+-    void finished(Current curr, Object servant, LocalObject cookie);
++    ["UserException"] void finished(Current curr, Object servant, LocalObject cookie);
+ 
+     /**
+      *
+diff -ru ../Ice-3.2.1.orig/src/Freeze/MapI.cpp ./src/Freeze/MapI.cpp
+--- ../Ice-3.2.1.orig/src/Freeze/MapI.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Freeze/MapI.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1317,13 +1317,10 @@
+     }
+     _db = 0;
+     
+-    for(IndexMap::iterator p = _indices.begin(); p != _indices.end(); ++p)
+-    {
+-        MapIndexBasePtr& indexBase = p->second;
+-
+-        indexBase->_impl = 0;
+-        indexBase->_map = 0;
+-    }
++    //
++    // We can't clear the indexBase as MapIndexI is using
++    // the first map's indexBase objects
++    //
+     _indices.clear();
+ }
+ 
+diff -ru ../Ice-3.2.1.orig/src/Ice/Incoming.cpp ./src/Ice/Incoming.cpp
+--- ../Ice-3.2.1.orig/src/Ice/Incoming.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Ice/Incoming.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -387,6 +387,7 @@
+ 
+     try
+     {
++        bool finishedException = false;
+         try
+         {
+             if(servantManager)
+@@ -401,39 +402,83 @@
+                     }
+                     if(_locator)
+                     {
+-                        _servant = _locator->locate(_current, _cookie);
++                        try
++                        {
++                            _servant = _locator->locate(_current, _cookie);
++                        }
++                        catch(const UserException& ex)
++                        {
++                            _os.write(ex);
++                            status = DispatchUserException;
++                        }
+                     }
+                 }
+             }
+-            if(!_servant)
++            if(status == DispatchOK)
+             {
+-                if(servantManager && servantManager->hasServant(_current.id))
++                if(!_servant)
+                 {
+-                    status = DispatchFacetNotExist;
++                    if(servantManager && servantManager->hasServant(_current.id))
++                    {
++                        status = DispatchFacetNotExist;
++                    }
++                    else
++                    {
++                        status = DispatchObjectNotExist;
++                    }
+                 }
+                 else
+                 {
+-                    status = DispatchObjectNotExist;
++                    status = _servant->__dispatch(*this, _current);
+                 }
+             }
+-            else
+-            {
+-                status = _servant->__dispatch(*this, _current);
+-            }
+         }
+         catch(...)
+         {
+             if(_locator && _servant && status != DispatchAsync)
+             {
+-                _locator->finished(_current, _servant, _cookie);
++                try
++                {
++                    _locator->finished(_current, _servant, _cookie);
++                }
++                catch(const UserException& ex)
++                {
++                    //
++                    // The operation may ahve already marshaled a reply; we must overwrite that reply.
++                    //
++                    _os.endWriteEncaps();
++                    _os.b.resize(headerSize + 5); // Byte following reply status.
++                    _os.startWriteEncaps();
++                    _os.write(ex);
++                    status = DispatchUserException; // Code below inserts the reply status.
++                    finishedException = true;
++                }
++                catch(...)
++                {
++                    throw;
++                }
+             }
+ 
+             throw;
+         }
+         
+-        if(_locator && _servant && status != DispatchAsync)
++        if(!finishedException && _locator && _servant && status != DispatchAsync)
+         {
+-            _locator->finished(_current, _servant, _cookie);
++            try
++            {
++                _locator->finished(_current, _servant, _cookie);
++            }
++            catch(const UserException& ex)
++            {
++                //
++                // The operation may ahve already marshaled a reply; we must overwrite that reply.
++                //
++                _os.endWriteEncaps();
++                _os.b.resize(headerSize + 5); // Byte following reply status.
++                _os.startWriteEncaps();
++                _os.write(ex);
++                status = DispatchUserException; // Code below inserts the reply status.
++            }
+         }
+     }
+     catch(const Exception& ex)
+diff -ru ../Ice-3.2.1.orig/src/Ice/IncomingAsync.cpp ./src/Ice/IncomingAsync.cpp
+--- ../Ice-3.2.1.orig/src/Ice/IncomingAsync.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Ice/IncomingAsync.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -133,7 +133,31 @@
+     {
+         if(_locator && _servant)
+         {
+-            _locator->finished(_current, _servant, _cookie);
++            try
++            {
++                _locator->finished(_current, _servant, _cookie);
++            }
++            catch(const UserException& ex)
++            {
++                //
++                // The operation may have already marshaled a reply; we must overwrite that reply.
++                //
++                if(_response)
++                {
++                    _os.endWriteEncaps();
++                    _os.b.resize(headerSize + 4); // Reply status position.
++                    _os.write(static_cast<Byte>(DispatchUserException));
++                    _os.startWriteEncaps();
++                    _os.write(ex);
++                    _os.endWriteEncaps();
++                    _connection->sendResponse(&_os, _compress);
++                }
++                else
++                {
++                    _connection->sendNoResponse();
++                }
++                return false;
++            }
+         }
+         return true;
+     }
+diff -ru ../Ice-3.2.1.orig/src/Ice/Outgoing.cpp ./src/Ice/Outgoing.cpp
+--- ../Ice-3.2.1.orig/src/Ice/Outgoing.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Ice/Outgoing.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -32,6 +32,44 @@
+     _ex.reset(dynamic_cast<LocalException*>(ex.get()->ice_clone()));
+ }
+ 
++void
++IceInternal::LocalExceptionWrapper::throwUnknownWrapper(const std::exception& ex)
++{
++
++    const UserException* ue = dynamic_cast<const UserException*>(&ex);
++    if(ue)
++    {
++        stringstream s;
++        s << *ue;
++        throw LocalExceptionWrapper(UnknownUserException(__FILE__, __LINE__, s.str()), false);
++    }
++
++    const LocalException* le = dynamic_cast<const LocalException*>(&ex);
++    if(le)
++    {
++#if 0
++        //
++        // Commented-out code makes local exceptions fully location transparent,
++        // but the Freeze evictor relies on them not being transparent.
++        //
++        if(dynamic_cast<const UnknownException*>(le) ||
++           dynamic_cast<const ObjectNotExistException*>(le) ||
++           dynamic_cast<const OperationNotExistException*>(le) ||
++           dynamic_cast<const FacetNotExistException*>(le))
++        {
++            throw LocalExceptionWrapper(*le, false);
++        }
++        stringstream s;
++        s << *le;
++        throw LocalExceptionWrapper(UnknownLocalException(__FILE__, __LINE__, s.str()), false);
++#else
++        throw LocalExceptionWrapper(*le, false);
++#endif
++    }
++    string msg = "std::exception: ";
++    throw LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, msg + ex.what()), false);
++}
++
+ const LocalException*
+ IceInternal::LocalExceptionWrapper::get() const
+ {
+diff -ru ../Ice-3.2.1.orig/src/Ice/Proxy.cpp ./src/Ice/Proxy.cpp
+--- ../Ice-3.2.1.orig/src/Ice/Proxy.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Ice/Proxy.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1329,21 +1329,40 @@
+     __initCurrent(__current, "ice_isA", ::Ice::Nonmutating, context);
+     while(true)
+     {
+-        Direct __direct(__current);
+         bool __ret;
+         try
+         {
+-            __ret = __direct.servant()->ice_isA(__id, __current);
++            Direct __direct(__current);
++            try
++            {
++                __ret = __direct.servant()->ice_isA(__id, __current);
++            }
++            catch(const ::std::exception& __ex)
++            {
++                __direct.destroy();
++                LocalExceptionWrapper::throwUnknownWrapper(__ex);
++            }
++            catch(...)
++            {
++                __direct.destroy();
++                throw;
++            }
++            __direct.destroy();
+         }
+-        catch(...)
++        catch(const LocalExceptionWrapper&)
+         {
+-            __direct.destroy();
+             throw;
+         }
+-        __direct.destroy();
++        catch(const ::std::exception& __ex)
++        {
++            LocalExceptionWrapper::throwUnknownWrapper(__ex);
++        }
++        catch(...)
++        {
++            LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
++        }
+         return __ret;    
+     }
+-    return false; // To keep the Visual C++ compiler happy.
+ }
+ 
+ void
+@@ -1353,18 +1372,38 @@
+     __initCurrent(__current, "ice_ping", ::Ice::Nonmutating, context);
+     while(true)
+     {
+-        Direct __direct(__current);
+         try
+         {
+-            __direct.servant()->ice_ping(__current);
++            Direct __direct(__current);
++            try
++            {
++                __direct.servant()->ice_ping(__current);
++            }
++            catch(const ::std::exception& __ex)
++            {
++                __direct.destroy();
++                LocalExceptionWrapper::throwUnknownWrapper(__ex);
++            }
++            catch(...)
++            {
++                __direct.destroy();
++                throw;
++            }
++            __direct.destroy();
+         }
+-        catch(...)
++        catch(const LocalExceptionWrapper&)
+         {
+-            __direct.destroy();
+             throw;
+         }
+-        __direct.destroy();
+-        return; 
++        catch(const ::std::exception& __ex)
++        {
++            LocalExceptionWrapper::throwUnknownWrapper(__ex);
++        }
++        catch(...)
++        {
++            LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
++        }
++        return;
+     }
+ }
+ 
+@@ -1373,23 +1412,42 @@
+ {
+     Current __current;
+     __initCurrent(__current, "ice_ids", ::Ice::Nonmutating, context);
++    vector<string> __ret;
+     while(true)
+     {
+-        Direct __direct(__current);
+-        vector<string> __ret;
+         try
+         {
+-            __ret = __direct.servant()->ice_ids(__current);
++            Direct __direct(__current);
++            try
++            {
++                __ret = __direct.servant()->ice_ids(__current);
++            }
++            catch(const ::std::exception& __ex)
++            {
++                __direct.destroy();
++                LocalExceptionWrapper::throwUnknownWrapper(__ex);
++            }
++            catch(...)
++            {
++                __direct.destroy();
++                throw;
++            }
++            __direct.destroy();
+         }
+-        catch(...)
++        catch(const LocalExceptionWrapper&)
+         {
+-            __direct.destroy();
+             throw;
+         }
+-        __direct.destroy();
++        catch(const ::std::exception& __ex)
++        {
++            LocalExceptionWrapper::throwUnknownWrapper(__ex);
++        }
++        catch(...)
++        {
++            LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
++        }
+         return __ret;
+     }
+-    return vector<string>(); // To keep the Visual C++ compiler happy.
+ }
+ 
+ string
+@@ -1399,21 +1457,40 @@
+     __initCurrent(__current, "ice_id", ::Ice::Nonmutating, context);
+     while(true)
+     {
+-        Direct __direct(__current);
+         string __ret;
+         try
+         {
+-            __ret = __direct.servant()->ice_id(__current);
++            Direct __direct(__current);
++            try
++            {
++                __ret = __direct.servant()->ice_id(__current);
++            }
++            catch(const ::std::exception& __ex)
++            {
++                __direct.destroy();
++                LocalExceptionWrapper::throwUnknownWrapper(__ex);
++            }
++            catch(...)
++            {
++                __direct.destroy();
++                throw;
++            }
++            __direct.destroy();
+         }
+-        catch(...)
++        catch(const LocalExceptionWrapper&)
+         {
+-            __direct.destroy();
+             throw;
+         }
+-        __direct.destroy();
++        catch(const ::std::exception& __ex)
++        {
++            LocalExceptionWrapper::throwUnknownWrapper(__ex);
++        }
++        catch(...)
++        {
++            LocalExceptionWrapper(UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
++        }
+         return __ret;    
+     }
+-    return string(); // To keep the Visual C++ compiler happy.
+ }
+ 
+ bool
+diff -ru ../Ice-3.2.1.orig/src/Slice/CsUtil.cpp ./src/Slice/CsUtil.cpp
+--- ../Ice-3.2.1.orig/src/Slice/CsUtil.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Slice/CsUtil.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -130,6 +130,21 @@
+ }
+ 
+ string
++Slice::CsGenerator::fixId(const ContainedPtr& cont, int baseTypes, bool mangleCasts)
++{
++    ContainerPtr container = cont->container();
++    ContainedPtr contained = ContainedPtr::dynamicCast(container);
++    if(contained && contained->hasMetaData("clr:property"))
++    {
++        return cont->name() + "_prop";
++    }
++    else
++    {
++        return fixId(cont->name(), baseTypes, mangleCasts);
++    }
++}
++
++string
+ Slice::CsGenerator::typeToString(const TypePtr& type)
+ {
+     if(!type)
+@@ -464,19 +479,41 @@
+     {
+         if(marshal)
+         {
+-            if(streamingAPI)
++            if(!isValueType(st))
+             {
+-                out << nl << param << ".ice_write(" << stream << ");";
++                out << nl << "if(" << param << " == null)";
++                out << sb;
++                string typeS = typeToString(st);
++                out << nl << typeS << " " << "tmp__ = new " << typeS << "();";
++                out << nl << "tmp__.";
++                out << (streamingAPI ? "ice_write" : "write__") << "(" << stream << ");";
++                out << eb;
++                out << nl << "else";
++                out << sb;
++                out << nl << param << "." << (streamingAPI ? "ice_write" : "write__") << "(" << stream << ");";
++                out << eb;
+             }
+             else
+             {
+-                out << nl << param << ".write__(" << stream << ");";
++                if(streamingAPI)
++                {
++                    out << nl << param << ".ice_write(" << stream << ");";
++                }
++                else
++                {
++                    out << nl << param << ".write__(" << stream << ");";
++                }
+             }
+         }
+         else
+         {
+-            string typeS = typeToString(type);
+-            out << nl << param << " = new " << typeS << "();";
++            if(!isValueType(st))
++            {
++                out << nl << "if(" << param << " == null)";
++                out << sb;
++                out << nl << param << " = new " << typeToString(type) << "();";
++                out << eb;
++            }
+             if(streamingAPI)
+             {
+                 out << nl << param << ".ice_read(" << stream << ");";
+diff -ru ../Ice-3.2.1.orig/src/Slice/JavaUtil.cpp ./src/Slice/JavaUtil.cpp
+--- ../Ice-3.2.1.orig/src/Slice/JavaUtil.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/Slice/JavaUtil.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -3442,6 +3442,17 @@
+ void
+ Slice::JavaGenerator::MetaDataVisitor::visitOperation(const OperationPtr& p)
+ {
++    if(p->hasMetaData("UserException"))
++    {
++        ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
++        if(!cl->isLocal())
++        {
++            cout << p->definitionContext()->filename() << ":" << p->line()
++                 << ": warning: metadata directive `UserException' applies only to local operations "
++                 << "but enclosing " << (cl->isInterface() ? "interface" : "class") << "`" << cl->name()
++                 << "' is not local" << endl;
++        }
++    }
+     StringList metaData = getMetaData(p);
+     TypePtr returnType = p->returnType();
+     if(!metaData.empty())
+diff -ru ../Ice-3.2.1.orig/src/slice2cpp/Gen.cpp ./src/slice2cpp/Gen.cpp
+--- ../Ice-3.2.1.orig/src/slice2cpp/Gen.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/slice2cpp/Gen.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -2527,6 +2527,15 @@
+     vector<string> paramsDecl;
+     vector<string> args;
+ 
++    ExceptionList throws = p->throws();
++    throws.sort();
++    throws.unique();
++#if defined(__SUNPRO_CC)
++    throws.sort(derivedToBaseCompare);
++#else
++    throws.sort(Slice::DerivedToBaseCompare());
++#endif
++
+     ParamDeclList paramList = p->parameters();
+     for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+     {
+@@ -2586,23 +2595,18 @@
+         C << nl << "::Ice::Current __current;";
+         C << nl << "__initCurrent(__current, " << p->flattenedScope() + p->name() + "_name, "
+           << operationModeToString(p->sendMode()) << ", __context);";
+-        C << nl << "while(true)";
+-        C << sb;
+-        C << nl << "::IceInternal::Direct __direct(__current);";
+         if(ret)
+         {
+             C << nl << retS << " __ret;";
+         }
+         C << nl << "try";
+         C << sb;
++        C << nl << "::IceInternal::Direct __direct(__current);";
+         C << nl << thisPointer << " __servant = dynamic_cast< " << thisPointer << ">(__direct.servant().get());";
+         C << nl << "if(!__servant)";
+         C << sb;
+-        C << nl << "::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);";
+-        C << nl << "__opEx.id = __current.id;";
+-        C << nl << "__opEx.facet = __current.facet;";
+-        C << nl << "__opEx.operation = __current.operation;";
+-        C << nl << "throw __opEx;";
++        C << nl << "__direct.destroy();";
++        C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, __current.id, __current.facet, __current.operation);";
+         C << eb;
+         C << nl << "try";
+         C << sb;
+@@ -2611,28 +2615,51 @@
+         {
+             C << "__ret = ";
+         }
+-        C << "__servant->" << name << spar << args << epar << ';';
++        C << "__servant->" << name << spar << args << epar << ";";
+         C << eb;
+-        C << nl << "catch(const ::Ice::LocalException& __ex)";
++        C << nl << "catch(const ::Ice::UserException&)";
+         C << sb;
+-        C << nl << "throw ::IceInternal::LocalExceptionWrapper(__ex, false);";
++        C << nl << "__direct.destroy();";
++        C << nl << "throw;";
+         C << eb;
++        C << nl << "catch(const ::std::exception& __ex)";
++        C << sb;
++        C << nl << "__direct.destroy();";
++        C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);";
+         C << eb;
+         C << nl << "catch(...)";
+         C << sb;
+         C << nl << "__direct.destroy();";
+-        C << nl << "throw;";
++        C << nl << "throw ::Ice::UnknownException(__FILE__, __LINE__, \"unknown c++ exception\");";
+         C << eb;
+         C << nl << "__direct.destroy();";
+-        if(ret)
++        C << eb;
++        for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
+         {
+-            C << nl << "return __ret;";
++            C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)";
++            C << sb;
++            C << nl << "throw;";
++            C << eb;
+         }
+-        else
++        C << nl << "catch(const ::IceInternal::LocalExceptionWrapper&)";
++        C << sb;
++        C << nl << "throw;";
++        C << eb;
++        C << nl << "catch(const ::std::exception& __ex)";
++        C << sb;
++        C << nl << "::IceInternal::LocalExceptionWrapper::throwUnknownWrapper(__ex);";
++        C << eb;
++        C << nl << "catch(...)";
++        C << sb;
++        C << nl << "throw ::IceInternal::LocalExceptionWrapper("
++          << "::Ice::UnknownException(__FILE__, __LINE__, \"unknown c++ exception\"), false);";
++        C << eb;
++        C << nl << "return";
++        if(ret)
+         {
+-            C << nl << "return;";
++            C << " __ret";
+         }
+-        C << eb;
++        C << ";";
+         C << eb;
+     }
+ }
+@@ -5286,6 +5313,18 @@
+     {
+         ami = true;
+     }
++
++    if(p->hasMetaData("UserException"))
++    {
++        if(!cl->isLocal())
++        {
++            cout << p->definitionContext()->filename() << ":" << p->line()
++                 << ": warning: metadata directive `UserException' applies only to local operations "
++                 << "but enclosing " << (cl->isInterface() ? "interface" : "class") << "`" << cl->name()
++                 << "' is not local" << endl;
++        }
++    }
++
+     StringList metaData = p->getMetaData();
+     metaData.remove("cpp:const");
+ 
+diff -ru ../Ice-3.2.1.orig/src/slice2cs/Gen.cpp ./src/slice2cs/Gen.cpp
+--- ../Ice-3.2.1.orig/src/slice2cs/Gen.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/slice2cs/Gen.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -386,6 +386,18 @@
+                 if(!isClass)
+                 {
+                     _out << nl << typeS << ' ' << param << ';';
++                    StructPtr st = StructPtr::dynamicCast(q->first);
++                    if(st)
++                    {
++                        if(isValueType(q->first))
++                        {
++                            _out << nl << param << " = new " << typeS << "();";
++                        }
++                        else
++                        {
++                            _out << nl << param << " = null;";
++                        }
++                    }
+                 }
+                 writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
+             }
+@@ -501,12 +513,26 @@
+             //
+             for(q = inParams.begin(); q != inParams.end(); ++q)
+             {
++                string param = fixId(q->second);
++                string typeS = typeToString(q->first);
+                 BuiltinPtr builtin = BuiltinPtr::dynamicCast(q->first);
+                 bool isClass = (builtin && builtin->kind() == Builtin::KindObject)
+                                || ClassDeclPtr::dynamicCast(q->first);
+                 if(!isClass)
+                 {
+-                    _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
++                    _out << nl << typeS << ' ' << param << ';';
++                    StructPtr st = StructPtr::dynamicCast(q->first);
++                    if(st)
++                    {
++                        if(isValueType(q->first))
++                        {
++                            _out << nl << param << " = new " << typeS << "();";
++                        }
++                        else
++                        {
++                            _out << nl << param << " = null;";
++                        }
++                    }
+                 }
+                 writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+             }
+@@ -728,8 +754,7 @@
+     _out << nl << "os__.startWriteSlice();";
+     for(d = members.begin(); d != members.end(); ++d)
+     {
+-        writeMarshalUnmarshalCode(_out, (*d)->type(),
+-                                  fixId((*d)->name(), DotNet::ICloneable, true),
++        writeMarshalUnmarshalCode(_out, (*d)->type(), fixId(*d, DotNet::ICloneable, true),
+                                   true, false, false);
+     }
+     _out << nl << "os__.endWriteSlice();";
+@@ -831,8 +856,7 @@
+                 patchParams << ", " << classMemberCount++;
+             }
+         }
+-        writeMarshalUnmarshalCode(_out, (*d)->type(),
+-                                  fixId((*d)->name(), DotNet::ICloneable, true),
++        writeMarshalUnmarshalCode(_out, (*d)->type(), fixId(*d, DotNet::ICloneable, true),
+                                   false, false, false, patchParams.str());
+     }
+     _out << nl << "is__.endReadSlice();";
+@@ -850,8 +874,7 @@
+         _out << nl << "outS__.startSlice();";
+         for(d = members.begin(); d != members.end(); ++d)
+         {
+-            writeMarshalUnmarshalCode(_out, (*d)->type(),
+-                                      fixId((*d)->name(), DotNet::ICloneable, true),
++            writeMarshalUnmarshalCode(_out, (*d)->type(), fixId(*d, DotNet::ICloneable, true),
+                                       true, true, false);
+         }
+         _out << nl << "outS__.endSlice();";
+@@ -877,8 +900,7 @@
+                     patchParams << ", " << classMemberCount++;
+                 }
+             }
+-            writeMarshalUnmarshalCode(_out, (*d)->type(),
+-                                      fixId((*d)->name(), DotNet::ICloneable, true),
++            writeMarshalUnmarshalCode(_out, (*d)->type(), fixId(*d, DotNet::ICloneable, true),
+                                       false, true, false, patchParams.str());
+         }
+         _out << nl << "inS__.endSlice();";
+@@ -2054,7 +2076,8 @@
+             _out << sb;
+             for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+             {
+-                _out << nl << "this." << fixId((*q)->name()) << " = " << fixId((*q)->name()) << ';';
++                string name = fixId((*q)->name(), DotNet::ApplicationException, false);
++                _out << nl << "this." << name << " = " << fixId((*q)->name()) << ';';
+             }
+             _out << eb;
+         }
+@@ -2186,8 +2209,7 @@
+         _out << nl << "os__.startWriteSlice();";
+         for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+         {
+-            writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                      fixId((*q)->name(), DotNet::ApplicationException),
++            writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, DotNet::ApplicationException),
+                                       true, false, false);
+         }
+         _out << nl << "os__.endWriteSlice();";
+@@ -2294,8 +2316,7 @@
+                     patchParams << ", " << classMemberCount++;
+                 }
+             }
+-            writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                      fixId((*q)->name(), DotNet::ApplicationException),
++            writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException),
+                                       false, false, false, patchParams.str());
+         }
+         _out << nl << "is__.endReadSlice();";
+@@ -2313,8 +2334,7 @@
+             _out << nl << "outS__.startSlice();";
+             for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+             {
+-                writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                          fixId((*q)->name(), DotNet::ApplicationException),
++                writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException),
+                                           true, true, false);
+             }
+             _out << nl << "outS__.endSlice();";
+@@ -2344,8 +2364,7 @@
+                         patchParams << ", " << classMemberCount++;
+                     }
+                 }
+-                writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                          fixId((*q)->name(), DotNet::ApplicationException),
++                writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException),
+                                           false, true, false, patchParams.str());
+             }
+             _out << nl << "inS__.endSlice();";
+@@ -2443,6 +2462,8 @@
+     DataMemberList dataMembers = p->dataMembers();
+     DataMemberList::const_iterator q;
+ 
++    bool propertyMapping = p->hasMetaData("clr:property");
++
+     _out << sp << nl << "#endregion"; // Slice data members
+ 
+     bool isClass = !isValueType(p);
+@@ -2453,6 +2474,25 @@
+         _out << "s";
+         _out << sp << nl << "public " << name << "()";
+         _out << sb;
++        /*
++        if(!p->isLocal())
++        {
++            for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
++            {
++                if(!isValueType((*q)->type()))
++                {
++                    string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
++                    string memberType = typeToString((*q)->type());
++                    _out << nl << "this." << memberName;
++                    if(propertyMapping)
++                    {
++                        _out << "_prop";
++                    }
++                    _out << " = new " << memberType << "();";
++                }
++            }
++        }
++        */
+         _out << eb;
+     }
+ 
+@@ -2461,7 +2501,7 @@
+     vector<string> paramNames;
+     for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+     {
+-        string memberName = fixId((*q)->name());
++        string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
+         string memberType = typeToString((*q)->type());
+         paramDecl.push_back(memberType + " " + memberName);
+         paramNames.push_back(memberName);
+@@ -2470,7 +2510,12 @@
+     _out << sb;
+     for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+     {
+-        _out << nl << "this." << *i << " = " << *i << ';';
++        _out << nl << "this." << *i;
++        if(propertyMapping)
++        {
++            _out << "_prop";
++        }
++        _out << " = " << *i << ';';
+     }
+     _out << eb;
+ 
+@@ -2594,8 +2639,7 @@
+         _out << sb;
+         for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+         {
+-            writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                      fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
++            writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, isClass ? DotNet::ICloneable : 0),
+                                       true, false, false);
+         }
+         _out << eb;
+@@ -2687,8 +2731,7 @@
+                     patchParams << ", " << classMemberCount++;
+                 }
+             }
+-            writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                      fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
++            writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, isClass ? DotNet::ICloneable : 0 ),
+                                       false, false, false, patchParams.str());
+         }
+         _out << eb;
+@@ -2699,8 +2742,7 @@
+             _out << sb;
+             for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+             {
+-                writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                          fixId((*q)->name(), isClass ? DotNet::ICloneable : 0),
++                writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, isClass ? DotNet::ICloneable : 0),
+                                           true, true, false);
+             }
+             _out << eb;
+@@ -2720,8 +2762,7 @@
+                         patchParams << ", " << classMemberCount++;
+                     }
+                 }
+-                writeMarshalUnmarshalCode(_out, (*q)->type(),
+-                                          fixId((*q)->name(), isClass ? DotNet::ICloneable : 0 ),
++                writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, isClass ? DotNet::ICloneable : 0 ),
+                                           false, true, false, patchParams.str());
+             }
+             _out << eb;
+@@ -3920,10 +3961,35 @@
+     _out << nl << "for(int i__ = 0; i__ < sz__; ++i__)";
+     _out << sb;
+     _out << nl << keyS << " k__;";
++    StructPtr st = StructPtr::dynamicCast(key);
++    if(st)
++    {
++        if(isValueType(key))
++        {
++            _out << nl << "v__ = new " << typeToString(key) << "();";
++        }
++        else
++        {
++            _out << nl << "k__ = null;";
++        }
++    }
+     writeMarshalUnmarshalCode(_out, key, "k__", false, false, false);
+     if(!hasClassValue)
+     {
+         _out << nl << valueS << " v__;";
++
++        StructPtr st = StructPtr::dynamicCast(value);
++        if(st)
++        {
++            if(isValueType(value))
++            {
++                _out << nl << "v__ = new " << typeToString(value) << "();";
++            }
++            else
++            {
++                _out << nl << "v__ = null;";
++            }
++        }
+     }
+     writeMarshalUnmarshalCode(_out, value, "v__", false, false, false, "r__, k__");
+     if(!hasClassValue)
+@@ -3960,10 +4026,34 @@
+         _out << nl << "for(int i__ = 0; i__ < sz__; ++i__)";
+         _out << sb;
+         _out << nl << keyS << " k__;";
++        StructPtr st = StructPtr::dynamicCast(key);
++        if(st)
++        {
++            if(isValueType(key))
++            {
++                _out << nl << "v__ = new " << typeToString(key) << "();";
++            }
++            else
++            {
++                _out << nl << "k__ = null;";
++            }
++        }
+         writeMarshalUnmarshalCode(_out, key, "k__", false, true, false);
+         if(!hasClassValue)
+         {
+             _out << nl << valueS << " v__;";
++            StructPtr st = StructPtr::dynamicCast(value);
++            if(st)
++            {
++                if(isValueType(value))
++                {
++                    _out << nl << "v__ = new " << typeToString(value) << "();";
++                }
++                else
++                {
++                    _out << nl << "v__ = null;";
++                }
++            }
+         }
+         writeMarshalUnmarshalCode(_out, value, "v__", false, true, false, "r__, k__");
+         if(!hasClassValue)
+@@ -4196,7 +4286,20 @@
+         _out << eb;
+         for(q = outParams.begin(); q != outParams.end(); ++q)
+         {
+-            writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true, "");
++            string param = fixId(q->second);
++            StructPtr st = StructPtr::dynamicCast(q->first);
++            if(st)
++            {
++                if(isValueType(q->first))
++                {
++                    _out << nl << param << " = new " << typeToString(q->first) << "();";
++                }
++                else
++                {
++                    _out << nl << param << " = null;";
++                }
++            }
++            writeMarshalUnmarshalCode(_out, q->first, param, false, false, true, "");
+         }
+         if(ret)
+         {
+@@ -4212,6 +4315,18 @@
+             else
+             {
+                 _out << nl << retS << " ret__;";
++                StructPtr st = StructPtr::dynamicCast(ret);
++                if(st)
++                {
++                    if(isValueType(st))
++                    {
++                        _out << nl << "ret__ = new " << retS << "();";
++                    }
++                    else
++                    {
++                        _out << nl << "ret__ = null;";
++                    }
++                }
+                 writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true, "");
+             }
+         }
+@@ -4622,7 +4737,9 @@
+         _out << sb;
+         for(q = outParams.begin(); q != outParams.end(); ++q)
+         {
+-            _out << nl << typeToString(q->first) << ' ' << fixId(q->second) << ';';
++            string param = fixId(q->second);
++            string typeS = typeToString(q->first);
++            _out << nl << typeS << ' ' << param << ';';
+         }
+         if(ret)
+         {
+@@ -4650,10 +4767,33 @@
+         _out << eb;
+         for(q = outParams.begin(); q != outParams.end(); ++q)
+         {
++            string param = fixId(q->second);
++            StructPtr st = StructPtr::dynamicCast(q->first);
++            if(st)
++            if(isValueType(st))
++            {
++                _out << nl << param << " = new " << typeToString(q->first) << "();";
++            }
++            else
++            {
++                _out << nl << param << " = null;";
++            }
+             writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);
+         }
+         if(ret)
+         {
++            StructPtr st = StructPtr::dynamicCast(ret);
++            if(st)
++            {
++                if(isValueType(ret))
++                {
++                    _out << nl << "ret__ = new " << retS << "();";
++                }
++                else
++                {
++                    _out << nl << "ret__ = null;";
++                }
++            }
+             writeMarshalUnmarshalCode(_out, ret, "ret__", false, false, true);
+         }
+         if(p->returnsClasses())
+diff -ru ../Ice-3.2.1.orig/src/slice2java/Gen.cpp ./src/slice2java/Gen.cpp
+--- ../Ice-3.2.1.orig/src/slice2java/Gen.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./src/slice2java/Gen.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -368,7 +368,10 @@
+ 
+     ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
+     assert(constructed);
++    out << nl << "if(" << name << " != null)";
++    out << sb;
+     out << nl << "__h = 5 * __h + " << name << ".hashCode();";
++    out << eb;
+ }
+ 
+ void
+@@ -533,7 +536,16 @@
+         {
+             out << sp << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData())
+                 << nl << opName << spar << params << epar;
+-            writeThrowsClause(package, throws);
++            if(op->hasMetaData("UserException"))
++            {
++                out.inc();
++                out << nl << "throws Ice.UserException";
++                out.dec();
++            }
++            else
++            {
++                writeThrowsClause(package, throws);
++            }
+             out << sb << nl;
+             if(ret)
+             {
+@@ -1418,7 +1430,16 @@
+             out << "Ice.Current __current";
+         }
+         out << epar;
+-        writeThrowsClause(package, throws);
++        if(op->hasMetaData("UserException"))
++        {
++            out.inc();
++            out << nl << "throws Ice.UserException";
++            out.dec();
++        }
++        else
++        {
++            writeThrowsClause(package, throws);
++        }
+         out << ';';
+     }
+ 
+@@ -1583,10 +1604,19 @@
+         }
+         out << epar;
+ 
+-        ExceptionList throws = (*r)->throws();
+-        throws.sort();
+-        throws.unique();
+-        writeThrowsClause(package, throws);
++        if((*r)->hasMetaData("UserException"))
++        {
++            out.inc();
++            out << nl << "throws Ice.UserException";
++            out.dec();
++        }
++        else
++        {
++            ExceptionList throws = (*r)->throws();
++            throws.sort();
++            throws.unique();
++            writeThrowsClause(package, throws);
++        }
+         out << sb;
+         out << nl;
+         if(ret && !hasAMD)
+@@ -4284,6 +4314,11 @@
+         ExceptionList throws = op->throws();
+         throws.sort();
+         throws.unique();
++#if defined(__SUNPRO_CC)
++        throws.sort(derivedToBaseCompare);
++#else
++        throws.sort(Slice::DerivedToBaseCompare());
++#endif
+ 
+         vector<string> params = getParams(op, package);
+         vector<string> args = getArgs(op);
+@@ -4303,15 +4338,26 @@
+             out << nl << "__initCurrent(__current, \"" << op->name() << "\", " 
+                 << sliceModeToIceMode(op->sendMode())
+                 << ", __ctx);";
++            if(ret)
++            {
++                string resultTypeHolder = typeToString(ret, TypeModeOut, package, op->getMetaData());
++                out << nl << "final " << resultTypeHolder << " __ret = new " << resultTypeHolder << "();";
++            }
+             out << nl << "while(true)";
+             out << sb;
+-            out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
+             out << nl << "try";
+             out << sb;
+-            out << nl << fixKwd(name) << " __servant = null;";
++            out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
+             out << nl << "try";
+             out << sb;
++            out << nl << fixKwd(name) << " __servant = null;";
+             out << nl << "__servant = (" << fixKwd(name) << ")__direct.servant();";
++            out << nl;
++            if(ret)
++            {
++                out << "__ret.value = ";
++            }
++            out << "__servant." << opName << spar << args << "__current" << epar << ';';
+             out << eb;
+             out << nl << "catch(ClassCastException __ex)";
+             out << sb;
+@@ -4321,28 +4367,57 @@
+             out << nl << "__opEx.operation = __current.operation;";
+             out << nl << "throw __opEx;";
+             out << eb;
++            for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
++            {
++                out << nl << "catch(" << getAbsolute(*i, package) << " __ex)";
++                out << sb;
++                out << nl << "throw __ex;";
++                out << eb;
++            }
++            out << nl << "catch(Throwable __ex)";
++            out << sb;
++            out << nl << "throw __ex;";
++            out << eb;
++            out << nl << "finally";
++            out << sb;
+             out << nl << "try";
+             out << sb;
+-            out << nl;
+-            if(ret)
++            out << nl << "__direct.destroy();";
++            out << eb;
++            for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
+             {
+-                out << "return ";
++                out << nl << "catch(" << getAbsolute(*i, package) << " __ex)";
++                out << sb;
++                out << nl << "throw __ex;";
++                out << eb;
+             }
+-            out << "__servant." << opName << spar << args << "__current" << epar << ';';
+-            if(!ret)
++            out << nl << "catch(Throwable __ex)";
++            out << sb;
++            out << nl << "throw __ex;";
++            out << eb;
++            out << eb;
++            out << eb;
++            for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
+             {
+-                out << nl << "return;";
++                out << nl << "catch(" << getAbsolute(*i, package) << " __ex)";
++                out << sb;
++                out << nl << "throw __ex;";
++                out << eb;
+             }
+-            out << eb;
+-            out << nl << "catch(Ice.LocalException __ex)";
++            out << nl << "catch(IceInternal.LocalExceptionWrapper __ex)";
+             out << sb;
+-            out << nl << "throw new IceInternal.LocalExceptionWrapper(__ex, false);";
+-            out << eb;
++            out << nl << "throw __ex;";
+             out << eb;
+-            out << nl << "finally";
++            out << nl << "catch(Throwable __ex)";
+             out << sb;
+-            out << nl << "__direct.destroy();";
++            out << nl << "IceInternal.LocalExceptionWrapper.throwUnknownWrapper(__ex);";
+             out << eb;
++            out << nl << "return";
++            if(ret)
++            {
++                out << " __ret.value";
++            }
++            out << ";";
+             out << eb;
+         }
+         out << eb;
+@@ -4620,11 +4695,19 @@
+         }
+         out << epar;
+ 
+-        ExceptionList throws = op->throws();
+-        throws.sort();
+-        throws.unique();
+-
+-        writeThrowsClause(package, throws);
++        if(op->hasMetaData("UserException"))
++        {
++            out.inc();
++            out << nl << "throws Ice.UserException";
++            out.dec();
++        }
++        else
++        {
++            ExceptionList throws = op->throws();
++            throws.sort();
++            throws.unique();
++            writeThrowsClause(package, throws);
++        }
+ 
+         out << sb;
+ 
+diff -ru ../Ice-3.2.1.orig/test/Ice/exceptions/AllTests.cpp ./test/Ice/exceptions/AllTests.cpp
+--- ../Ice-3.2.1.orig/test/Ice/exceptions/AllTests.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/exceptions/AllTests.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -914,22 +914,8 @@
+             thrower->throwUndeclaredA(1);
+             test(false);
+         }
+-        catch(const A& ex)
+-        {
+-            //
+-            // We get the original exception with collocation
+-            // optimization.
+-            //
+-            test(collocated);
+-            test(ex.aMem == 1);
+-        }
+         catch(const Ice::UnknownUserException&)
+         {
+-            //
+-            // We get an unknown user exception without collocation
+-            // optimization.
+-            //
+-            test(!collocated);
+         }
+         catch(...)
+         {
+@@ -941,23 +927,8 @@
+             thrower->throwUndeclaredB(1, 2);
+             test(false);
+         }
+-        catch(const B& ex)
+-        {
+-            //
+-            // We get the original exception with collocation
+-            // optimization.
+-            //
+-            test(collocated);
+-            test(ex.aMem == 1);
+-            test(ex.bMem == 2);
+-        }
+         catch(const Ice::UnknownUserException&)
+         {
+-            //
+-            // We get an unknown user exception without collocation
+-            // optimization.
+-            //
+-            test(!collocated);
+         }
+         catch(...)
+         {
+@@ -969,24 +940,8 @@
+             thrower->throwUndeclaredC(1, 2, 3);
+             test(false);
+         }
+-        catch(const C& ex)
+-        {
+-            //
+-            // We get the original exception with collocation
+-            // optimization.
+-            //
+-            test(collocated);
+-            test(ex.aMem == 1);
+-            test(ex.bMem == 2);
+-            test(ex.cMem == 3);
+-        }
+         catch(const Ice::UnknownUserException&)
+         {
+-            //
+-            // We get an unknown user exception without
+-            // collocation optimization.
+-            //
+-            test(!collocated);
+         }
+         catch(...)
+         {
+@@ -1065,22 +1020,14 @@
+         thrower->throwLocalException();
+         test(false);
+     }
+-    catch(const Ice::TimeoutException&)
+-    {
+-        //
+-        // We get the original exception with collocation
+-        // optimization.
+-        //
+-        test(collocated);
+-    }
+     catch(const Ice::UnknownLocalException&)
+     {
+-        //
+-        // We get an unknown local exception without collocation
+-        // optimization.
+-        //
+         test(!collocated);
+     }
++    catch(const Ice::TimeoutException&)
++    {
++        test(collocated);
++    }
+     catch(...)
+     {
+         test(false);
+@@ -1097,19 +1044,10 @@
+     }
+     catch(const Ice::UnknownException&)
+     {
+-        //
+-        // We get an unknown exception without collocation
+-        // optimization.
+-        //
+-        assert(!collocated);
+     }
+     catch(...)
+     {
+-        //
+-        // We get the original exception with collocation
+-        // optimization.
+-        //
+-        assert(collocated);
++        test(false);
+     }
+     
+     cout << "ok" << endl;
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/AllTests.cpp ./test/Ice/servantLocator/AllTests.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/AllTests.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/AllTests.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -33,6 +33,10 @@
+             test(ex.operation == "requestFailedException");
+         }
+     }
++    catch(...)
++    {
++        test(false);
++    }
+ 
+     try
+     {
+@@ -43,6 +47,10 @@
+     {
+         test(ex.unknown == "reason");
+     }
++    catch(...)
++    {
++        test(false);
++    }
+ 
+     try
+     {
+@@ -71,13 +79,11 @@
+     }
+     catch(const UnknownUserException& ex)
+     {
+-        //cerr << ex.unknown << endl;
+-        test(!collocated);
+         test(ex.unknown == "Test::TestIntfUserException");
+     }
+-    catch(const TestIntfUserException&)
++    catch(...)
+     {
+-        test(collocated);
++        test(false);
+     }
+ 
+     try
+@@ -87,7 +93,6 @@
+     }
+     catch(const UnknownLocalException& ex)
+     {
+-        //cerr << ex.unknown << endl;
+         test(!collocated);
+         test(ex.unknown.find("Ice::SocketException:\nsocket exception: unknown error") != string::npos);
+     }
+@@ -95,6 +100,10 @@
+     {
+         test(collocated);
+     }
++    catch(...)
++    {
++        test(false);
++    }
+ 
+     try
+     {
+@@ -103,13 +112,11 @@
+     }
+     catch(const UnknownException& ex)
+     {
+-        //cerr << ex.unknown << endl;
+-        test(!collocated);
+         test(ex.unknown == "std::exception: Hello");
+     }
+-    catch(const std::runtime_error&)
++    catch(...)
+     {
+-        test(collocated);
++        test(false);
+     }
+ 
+     try
+@@ -119,13 +126,11 @@
+     }
+     catch(const UnknownException& ex)
+     {
+-        //cerr << ex.unknown << endl;
+-        test(!collocated);
+         test(ex.unknown == "unknown c++ exception");
+     }
+-    catch(const int&)
++    catch(...)
+     {
+-        test(collocated);
++        test(false);
+     }
+     
+     try
+@@ -137,6 +142,66 @@
+     {
+         test(ex.unknown == "reason");
+     }
++    catch(...)
++    {
++        test(false);
++    }
++
++    try
++    {
++        obj->impossibleException(false);
++        test(false);
++    }
++    catch(const UnknownUserException&)
++    {
++        // Operation doesn't throw, but locate() and finshed() throw TestIntfUserException.
++    }
++    catch(...)
++    {
++        test(false);
++    }
++
++    try
++    {
++        obj->impossibleException(true);
++        test(false);
++    }
++    catch(const UnknownUserException&)
++    {
++        // Operation doesn't throw, but locate() and finshed() throw TestIntfUserException.
++    }
++    catch(...)
++    {
++        test(false);
++    }
++
++    try
++    {
++        obj->intfUserException(false);
++        test(false);
++    }
++    catch(const TestImpossibleException&)
++    {
++        // Operation doesn't throw, but locate() and finished() throw TestImpossibleException.
++    }
++    catch(...)
++    {
++        test(false);
++    }
++
++    try
++    {
++        obj->intfUserException(true);
++        test(false);
++    }
++    catch(const TestImpossibleException&)
++    {
++        // Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException.
++    }
++    catch(...)
++    {
++        test(false);
++    }
+ }
+ 
+ TestIntfPrx
+@@ -151,6 +216,39 @@
+     TestIntfPrx obj = TestIntfPrx::checkedCast(base);
+     test(obj);
+     test(obj == base);
++
++    cout << "ok" << endl;
++
++    cout << "testing ice_ids... " << flush;
++    try
++    {
++        ObjectPrx obj = communicator->stringToProxy("category/locate:default -p 12010 -t 10000");
++        obj->ice_ids();
++        test(false);
++    }
++    catch(const UnknownUserException& ex)
++    {
++        test(ex.unknown == "Test::TestIntfUserException");
++    }
++    catch(...)
++    {
++        test(false);
++    }
++
++    try
++    {
++        ObjectPrx obj = communicator->stringToProxy("category/finished:default -p 12010 -t 10000");
++        obj->ice_ids();
++        test(false);
++    }
++    catch(const UnknownUserException& ex)
++    {
++        test(ex.unknown == "Test::TestIntfUserException");
++    }
++    catch(...)
++    {
++        test(false);
++    }
+     cout << "ok" << endl;
+ 
+     cout << "testing servant locator..." << flush;
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/Client.cpp ./test/Ice/servantLocator/Client.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/Client.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Client.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/Collocated.cpp ./test/Ice/servantLocator/Collocated.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/Collocated.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Collocated.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/Makefile ./test/Ice/servantLocator/Makefile
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/Makefile	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Makefile	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ # **********************************************************************
+ #
+-# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ #
+ # This copy of Ice is licensed to you under the terms described in the
+ # ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/ServantLocatorI.cpp ./test/Ice/servantLocator/ServantLocatorI.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/ServantLocatorI.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/ServantLocatorI.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -8,6 +8,7 @@
+ // **********************************************************************
+ 
+ #include <ServantLocatorI.h>
++#include <Test.h>
+ #include <TestCommon.h>
+ 
+ #include <stdexcept>
+@@ -74,7 +75,11 @@
+ void
+ ServantLocatorI::exception(const Ice::Current& current)
+ {
+-    if(current.operation == "requestFailedException")
++    if(current.operation == "ice_ids")
++    {
++        throw TestIntfUserException();
++    }
++    else if(current.operation == "requestFailedException")
+     {
+         throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+     }
+@@ -110,4 +115,12 @@
+     {
+         throw UnknownException(__FILE__, __LINE__, "reason");
+     }
++    else if(current.operation == "impossibleException")
++    {
++        throw TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
++    }
++    else if(current.operation == "intfUserException")
++    {
++        throw TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
++    }
+ }
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/ServantLocatorI.h ./test/Ice/servantLocator/ServantLocatorI.h
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/ServantLocatorI.h	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/ServantLocatorI.h	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/Server.cpp ./test/Ice/servantLocator/Server.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/Server.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Server.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/ServerAMD.cpp ./test/Ice/servantLocator/ServerAMD.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/ServerAMD.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/ServerAMD.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/Test.ice ./test/Ice/servantLocator/Test.ice
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/Test.ice	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Test.ice	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -17,6 +17,10 @@
+ {
+ };
+ 
++exception TestImpossibleException
++{
++};
++
+ interface TestIntf
+ {
+     void requestFailedException();
+@@ -29,6 +33,9 @@
+     void cppException();
+ 
+     void unknownExceptionWithServantException();
++
++    string impossibleException(bool throw) throws TestImpossibleException;
++    string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
+     
+     void shutdown();
+ };
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMD.ice ./test/Ice/servantLocator/TestAMD.ice
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMD.ice	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestAMD.ice	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -17,6 +17,10 @@
+ {
+ };
+ 
++exception TestImpossibleException
++{
++};
++
+ ["amd"] interface TestIntf
+ {
+     void requestFailedException();
+@@ -27,9 +31,12 @@
+     void userException();
+     void stdException();
+     void cppException();
+-    
++
+     void unknownExceptionWithServantException();
+ 
++    string impossibleException(bool throw) throws TestImpossibleException;
++    string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
++
+     void shutdown();
+ };
+ 
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMDI.cpp ./test/Ice/servantLocator/TestAMDI.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMDI.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestAMDI.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -69,6 +69,41 @@
+ }
+ 
+ void
++TestAMDI::impossibleException_async(const Test::AMD_TestIntf_impossibleExceptionPtr& cb, bool _cpp_throw,
++                                    const Current&)
++{
++    if(_cpp_throw)
++    {
++        cb->ice_exception(Test::TestImpossibleException());
++    }
++    else
++    {
++        //
++        // Return a value so we can be sure that the stream position
++        // is reset correctly if finished() throws.
++        //
++        cb->ice_response("Hello");
++    }
++}
++
++void
++TestAMDI::intfUserException_async(const Test::AMD_TestIntf_intfUserExceptionPtr& cb, bool _cpp_throw, const Current&)
++{
++    if(_cpp_throw)
++    {
++        cb->ice_exception(Test::TestIntfUserException());
++    }
++    else
++    {
++        //
++        // Return a value so we can be sure that the stream position
++        // is reset correctly if finished() throws.
++        //
++        cb->ice_response("Hello");
++    }
++}
++
++void
+ TestAMDI::shutdown_async(const Test::AMD_TestIntf_shutdownPtr& cb, const Current& current)
+ {
+     current.adapter->deactivate();
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMDI.h ./test/Ice/servantLocator/TestAMDI.h
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/TestAMDI.h	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestAMDI.h	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -25,7 +25,11 @@
+     virtual void stdException_async(const Test::AMD_TestIntf_stdExceptionPtr&, const Ice::Current&);
+     virtual void cppException_async(const Test::AMD_TestIntf_cppExceptionPtr&, const Ice::Current&);
+ 
+-    virtual void unknownExceptionWithServantException_async(const Test::AMD_TestIntf_unknownExceptionWithServantExceptionPtr&, const Ice::Current&);
++    virtual void unknownExceptionWithServantException_async(
++                            const Test::AMD_TestIntf_unknownExceptionWithServantExceptionPtr&, const Ice::Current&);
++
++    virtual void impossibleException_async(const Test::AMD_TestIntf_impossibleExceptionPtr&, bool, const Ice::Current&);
++    virtual void intfUserException_async(const Test::AMD_TestIntf_intfUserExceptionPtr&, bool, const Ice::Current&);
+ 
+     virtual void shutdown_async(const Test::AMD_TestIntf_shutdownPtr&, const Ice::Current&);
+ };
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/TestI.cpp ./test/Ice/servantLocator/TestI.cpp
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/TestI.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestI.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -60,6 +60,34 @@
+     throw Ice::ObjectNotExistException(__FILE__, __LINE__);
+ }
+ 
++string
++TestI::impossibleException(bool _cpp_throw, const Current&)
++{
++    if(_cpp_throw)
++    {
++        throw Test::TestImpossibleException();
++    }
++    //
++    // Return a value so we can be sure that the stream position
++    // is reset correctly if finished() throws.
++    //
++    return "Hello";
++}
++
++string
++TestI::intfUserException(bool _cpp_throw, const Current&)
++{
++    if(_cpp_throw)
++    {
++        throw Test::TestIntfUserException();
++    }
++    //
++    // Return a value so we can be sure that the stream position
++    // is reset correctly if finished() throws.
++    //
++    return "Hello";
++}
++
+ void
+ TestI::shutdown(const Current& current)
+ {
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/TestI.h ./test/Ice/servantLocator/TestI.h
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/TestI.h	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestI.h	2007-12-20 12:16:29.000000000 -0800
+@@ -1,6 +1,6 @@
+ // **********************************************************************
+ //
+-// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ //
+ // This copy of Ice is licensed to you under the terms described in the
+ // ICE_LICENSE file included in this distribution.
+@@ -27,6 +27,9 @@
+ 
+     virtual void unknownExceptionWithServantException(const Ice::Current&);
+ 
++    virtual ::std::string impossibleException(bool, const Ice::Current&);
++    virtual ::std::string intfUserException(bool, const Ice::Current&);
++
+     virtual void shutdown(const Ice::Current&);
+ };
+ 
+diff -ru ../Ice-3.2.1.orig/test/Ice/servantLocator/run.py ./test/Ice/servantLocator/run.py
+--- ../Ice-3.2.1.orig/test/Ice/servantLocator/run.py	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/run.py	2007-12-20 12:16:29.000000000 -0800
+@@ -1,7 +1,7 @@
+ #!/usr/bin/env python
+ # **********************************************************************
+ #
+-# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
++# Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+ #
+ # This copy of Ice is licensed to you under the terms described in the
+ # ICE_LICENSE file included in this distribution.
+diff -ru ../Ice-3.2.1.orig/test/Ice/threads/TestI.cpp ./test/Ice/threads/TestI.cpp
+--- ../Ice-3.2.1.orig/test/Ice/threads/TestI.cpp	2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/threads/TestI.cpp	2007-12-20 12:16:29.000000000 -0800
+@@ -167,6 +167,11 @@
+     {
+         // Expected.
+     }
++    catch(const Ice::Exception& ex)
++    {
++        cerr << ex << endl;
++        test(false);
++    }
+ 
+     Test::AdapterPrx proxy2 =
+         Test::AdapterPrx::uncheckedCast(proxy->ice_threadPerConnection(!proxy->ice_isThreadPerConnection()));

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071220/7296a8e4/attachment-0001.html


More information about the macports-changes mailing list