diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-25 23:29:39 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-25 23:29:39 +0000 |
commit | 9a5b8decaffd5b7276d571d2d1cf7dc527c9cd3d (patch) | |
tree | 919b333472a90ca5977e3c2786ad32a834e1fc5c /cpp/src | |
parent | fixes (diff) | |
download | ice-9a5b8decaffd5b7276d571d2d1cf7dc527c9cd3d.tar.bz2 ice-9a5b8decaffd5b7276d571d2d1cf7dc527c9cd3d.tar.xz ice-9a5b8decaffd5b7276d571d2d1cf7dc527c9cd3d.zip |
many, many freeze and other fixes
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/.depend | 9 | ||||
-rw-r--r-- | cpp/src/Freeze/DBI.cpp | 27 | ||||
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Freeze/Makefile | 11 | ||||
-rw-r--r-- | cpp/src/Freeze/freeze.dsp | 53 | ||||
-rw-r--r-- | cpp/src/Ice/Collector.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 39 | ||||
-rw-r--r-- | cpp/src/Ice/LocalException.cpp | 36 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 16 | ||||
-rw-r--r-- | cpp/src/Ice/TraceUtil.cpp | 14 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 20 | ||||
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 2 |
12 files changed, 185 insertions, 54 deletions
diff --git a/cpp/src/Freeze/.depend b/cpp/src/Freeze/.depend index b2187ca180c..53077d687af 100644 --- a/cpp/src/Freeze/.depend +++ b/cpp/src/Freeze/.depend @@ -1,4 +1,5 @@ -DB.o: DB.cpp ../../include/Freeze/DB.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h -DBI.o: DBI.cpp ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Buffer.h ../Freeze/DBI.h ../../include/IceUtil/IceUtil.h ../../include/IceUtil/Functional.h ../../include/IceUtil/Shared.h ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ServantFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ServantFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ../../include/Freeze/DB.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../Freeze/EvictorI.h ../../include/Freeze/Evictor.h ../../include/Freeze/Initialize.h -Evictor.o: Evictor.cpp ../../include/Freeze/Evictor.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Freeze/DBF.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h -EvictorI.o: EvictorI.cpp ../../include/Ice/Object.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../Freeze/EvictorI.h ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ServantFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ServantFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ../../include/Ice/InstanceF.h ../../include/Freeze/DB.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../../include/Freeze/Evictor.h +DB.o: DB.cpp ../../include/Freeze/DB.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/IceUtil/Shared.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h ../../include/Ice/CommunicatorF.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h +DBException.o: DBException.cpp ../../include/Freeze/DBException.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/IceUtil/Shared.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h +Evictor.o: Evictor.cpp ../../include/Freeze/Evictor.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Config.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/IceUtil/Shared.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h +DBI.o: DBI.cpp ../../include/Ice/Stream.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/Buffer.h ../../include/Freeze/DBException.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/Proxy.h ../../include/IceUtil/Shared.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/Ice/Incoming.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/LocalObject.h ../../include/Ice/LocalException.h ../Freeze/DBI.h ../../include/IceUtil/IceUtil.h ../../include/IceUtil/Functional.h ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/LoggerF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ServantFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ServantFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ../../include/Freeze/DB.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../Freeze/EvictorI.h ../../include/Freeze/Evictor.h ../../include/Freeze/Initialize.h +EvictorI.o: EvictorI.cpp ../../include/Ice/Object.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/Ice/Config.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../Freeze/EvictorI.h ../../include/Ice/Ice.h ../../include/Ice/Communicator.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Native.h ../../include/Ice/LocalObject.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PicklerF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ServantFactoryF.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/ServantFactory.h ../../include/Ice/Pickler.h ../../include/Ice/Initialize.h ../../include/Ice/InstanceF.h ../../include/Freeze/DB.h ../../include/Ice/Outgoing.h ../../include/Ice/Stream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../../include/Freeze/Evictor.h diff --git a/cpp/src/Freeze/DBI.cpp b/cpp/src/Freeze/DBI.cpp index f20e62ac201..22615619d70 100644 --- a/cpp/src/Freeze/DBI.cpp +++ b/cpp/src/Freeze/DBI.cpp @@ -9,6 +9,7 @@ // ********************************************************************** #include <Ice/Stream.h> // Not included in Ice/Ice.h +#include <Freeze/DBException.h> #include <Freeze/DBI.h> #include <Freeze/EvictorI.h> #include <Freeze/Initialize.h> @@ -90,14 +91,13 @@ Freeze::DBEnvironmentI::DBEnvironmentI(const CommunicatorPtr& communicator, cons } checkBerkeleyDBReturn(_dbEnv->open(_dbEnv, _name.c_str(), - DB_CREATE | - DB_INIT_LOCK | - DB_INIT_LOG | - DB_INIT_MPOOL | - DB_INIT_TXN | - DB_RECOVER | - DB_THREAD, - FREEZE_DB_MODE), _errorPrefix, "DB_ENV->open"); + DB_CREATE | + DB_INIT_LOCK | + DB_INIT_LOG | + DB_INIT_MPOOL | + DB_INIT_TXN | + DB_RECOVER, + FREEZE_DB_MODE), _errorPrefix, "DB_ENV->open"); } Freeze::DBEnvironmentI::~DBEnvironmentI() @@ -324,8 +324,10 @@ Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& d _logger->trace("DB", s.str()); } - checkBerkeleyDBReturn(_db->open(_db, name.c_str(), 0, DB_BTREE, DB_CREATE, FREEZE_DB_MODE), _errorPrefix, + checkBerkeleyDBReturn(_db->open(_db, _name.c_str(), 0, DB_BTREE, DB_CREATE, FREEZE_DB_MODE), _errorPrefix, "DB->open"); + + _dbEnvObj->add(_name, this); } Freeze::DBI::~DBI() @@ -413,10 +415,7 @@ Freeze::DBI::get(const Key& key) checkBerkeleyDBReturn(_db->get(_db, 0, &dbKey, &dbData, 0), _errorPrefix, "DB->get"); - Value value; - value.resize(dbData.size); - memcpy(value.begin(), dbData.data, dbData.size); - return value; + return Value(static_cast<Byte*>(dbData.data), static_cast<Byte*>(dbData.data) + dbData.size); } void @@ -521,8 +520,8 @@ Freeze::DBI::getServant(const string& identity) IceInternal::InstancePtr instance = IceInternal::getInstance(_communicator); IceInternal::Stream stream(instance); stream.b.resize(dbData.size); + copy(static_cast<Byte*>(dbData.data), static_cast<Byte*>(dbData.data) + dbData.size, stream.b.begin()); stream.i = stream.b.begin(); - memcpy(stream.b.begin(), dbData.data, dbData.size); ObjectPtr servant; stream.read(servant, "::Ice::Object"); diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index 74332675f6b..3104e8b3d2a 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -18,7 +18,7 @@ using namespace Freeze; Freeze::EvictorI::EvictorI(const DBPtr& db, const CommunicatorPtr& communicator) : _db(db), - _evictorSize(static_cast<map<string, EvictorElement>::size_type>(10)), + _evictorSize(10), _persistenceMode(SaveUponEviction), _logger(communicator->getLogger()), _trace(0) diff --git a/cpp/src/Freeze/Makefile b/cpp/src/Freeze/Makefile index 787a8aee7eb..609a2f65f9c 100644 --- a/cpp/src/Freeze/Makefile +++ b/cpp/src/Freeze/Makefile @@ -19,8 +19,9 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) TARGETS = $(NAME) $(VERSIONED_NAME) OBJS = DB.o \ - DBI.o \ + DBException.o \ Evictor.o \ + DBI.o \ EvictorI.o SRCS = $(OBJS:.o=.cpp) @@ -59,6 +60,14 @@ $(HDIR)/DBF.h: $(IDIR)/DBF.ice $(SLICE2CPP) clean:: rm -f $(HDIR)/DBF.h +$(HDIR)/DBException.h DBException.cpp: $(IDIR)/DBException.ice $(SLICE2CPP) + rm -f $(HDIR)/DBException.h DBException.cpp + $(SLICECMD) $(IDIR)/DBException.ice + mv DBException.h $(HDIR) + +clean:: + rm -f $(HDIR)/DBException.h DBException.cpp + $(HDIR)/Evictor.h Evictor.cpp: $(IDIR)/Evictor.ice $(SLICE2CPP) rm -f $(HDIR)/Evictor.h Evictor.cpp $(SLICECMD) $(IDIR)/Evictor.ice diff --git a/cpp/src/Freeze/freeze.dsp b/cpp/src/Freeze/freeze.dsp index f451d224ce5..0b476f8e1c7 100644 --- a/cpp/src/Freeze/freeze.dsp +++ b/cpp/src/Freeze/freeze.dsp @@ -108,6 +108,10 @@ SOURCE=.\DB.cpp # End Source File
# Begin Source File
+SOURCE=.\DBException.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DBI.cpp
# End Source File
# Begin Source File
@@ -132,6 +136,10 @@ SOURCE=..\..\include\Freeze\DBF.h # End Source File
# Begin Source File
+SOURCE=..\..\include\Freeze\DBException.h
+# End Source File
+# Begin Source File
+
SOURCE=.\DBI.h
# End Source File
# Begin Source File
@@ -240,6 +248,51 @@ InputPath=..\..\slice\Freeze\DBF.ice # End Source File
# Begin Source File
+SOURCE=..\..\slice\Freeze\DBException.ice
+
+!IF "$(CFG)" == "Freeze - Win32 Release"
+
+USERDEP__DB_IC="..\..\bin\slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Freeze\DBException.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export FREEZE_API --include-dir Freeze -I../../slice ../../slice/Freeze/DBException.ice \
+ move DBException.h ..\..\include\Freeze \
+
+
+"..\..\include\Freeze\DBException.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"DBException.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Freeze - Win32 Debug"
+
+USERDEP__DB_IC="..\..\bin\slice2cpp.exe"
+# Begin Custom Build
+InputPath=..\..\slice\Freeze\DBException.ice
+
+BuildCmds= \
+ set PATH=%PATH%;..\..\lib \
+ ..\..\bin\slice2cpp.exe --dll-export FREEZE_API --include-dir Freeze -I../../slice ../../slice/Freeze/DBException.ice \
+ move DBException.h ..\..\include\Freeze \
+
+
+"..\..\include\Freeze\DBException.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"DBException.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=..\..\slice\Freeze\Evictor.ice
!IF "$(CFG)" == "Freeze - Win32 Release"
diff --git a/cpp/src/Ice/Collector.cpp b/cpp/src/Ice/Collector.cpp index faed3a338a1..97d09ec7d73 100644 --- a/cpp/src/Ice/Collector.cpp +++ b/cpp/src/Ice/Collector.cpp @@ -216,16 +216,6 @@ IceInternal::Collector::message(Stream& stream) { JTCSyncT<JTCRecursiveMutex> sync(*this); warning(ex); - setState(StateClosed); - } - catch(...) - { - JTCSyncT<JTCRecursiveMutex> sync(*this); - string s("server exception:\n"); - s += "unknown exception (no further information available)\n"; - s += _transceiver->toString(); - _logger->warning(s); - setState(StateClosed); } } while (batch && stream.i < stream.b.end()); diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 4d9b0c2cc8b..64209f0b867 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -37,8 +37,7 @@ IceInternal::Incoming::invoke(Stream& is) string operation; _is.read(operation); - int statusPos = _os.b.size(); - _os.write(Byte(0)); + Stream::Container::size_type statusPos = _os.b.size(); ObjectPtr servant = _adapter->identityToServant(identity); ServantLocatorPtr locator; @@ -57,36 +56,50 @@ IceInternal::Incoming::invoke(Stream& is) if(!servant) { - *(_os.b.begin() + statusPos) = static_cast<Byte>(DispatchObjectNotExist); + _os.write(static_cast<Byte>(DispatchObjectNotExist)); } else { + _os.write(static_cast<Byte>(DispatchOK)); DispatchStatus status = servant->__dispatch(*this, operation); - if (status != DispatchOK && status != DispatchException && status != DispatchOperationNotExist) - { - throw UnknownReplyStatusException(__FILE__, __LINE__); - } - *(_os.b.begin() + statusPos) = static_cast<Byte>(status); } + + if (locator && servant) + { + locator->finished(_adapter, identity, servant, operation, cookie); + } } catch(const LocationForward& p) { - *(_os.b.begin() + statusPos) = static_cast<Byte>(DispatchLocationForward); + if (locator && servant) + { + locator->finished(_adapter, identity, servant, operation, cookie); + } + _os.b.resize(statusPos); + _os.write(static_cast<Byte>(DispatchLocationForward)); _os.write(p._prx); + return; } - catch(...) + catch(const LocalException& ex) { if (locator && servant) { locator->finished(_adapter, identity, servant, operation, cookie); } + _os.b.resize(statusPos); + _os.write(static_cast<Byte>(DispatchLocalException)); throw; } - - if (locator && servant) + catch(...) { - locator->finished(_adapter, identity, servant, operation, cookie); + if (locator && servant) + { + locator->finished(_adapter, identity, servant, operation, cookie); + } + _os.b.resize(statusPos); + _os.write(static_cast<Byte>(DispatchUnknownException)); + throw UnknownException(__FILE__, __LINE__); } } diff --git a/cpp/src/Ice/LocalException.cpp b/cpp/src/Ice/LocalException.cpp index 976ede001e7..80d487d5c1a 100644 --- a/cpp/src/Ice/LocalException.cpp +++ b/cpp/src/Ice/LocalException.cpp @@ -77,6 +77,42 @@ Ice::operator<<(ostream& out, const LocalException& ex) return out << s; } +Ice::UnknownException::UnknownException(const char* file, int line) : + LocalException(file, line) +{ +} + +Ice::UnknownException::UnknownException(const UnknownException& ex) : + LocalException(ex) +{ +} + +UnknownException& +Ice::UnknownException::operator=(const UnknownException& ex) +{ + LocalException::operator=(ex); + return *this; +} + +string +Ice::UnknownException::toString() const +{ + string s = debugInfo() + "unknown exception"; + return s; +} + +LocalException* +Ice::UnknownException::clone() const +{ + return new UnknownException(*this); +} + +void +Ice::UnknownException::raise() const +{ + throw *this; +} + Ice::UnknownUserException::UnknownUserException(const char* file, int line) : LocalException(file, line) { diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index b2d7aa9e2b3..f4b3ea8b088 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -199,7 +199,7 @@ IceInternal::Outgoing::finished(Stream& is) break; } - case DispatchException: + case DispatchUserException: { _state = StateException; break; @@ -225,6 +225,20 @@ IceInternal::Outgoing::finished(Stream& is) break; } + case DispatchLocalException: + { + _state = StateLocalException; + _exception = auto_ptr<LocalException>(new LocalException(__FILE__, __LINE__)); + break; + } + + case DispatchUnknownException: + { + _state = StateLocalException; + _exception = auto_ptr<LocalException>(new UnknownException(__FILE__, __LINE__)); + break; + } + default: { _state = StateLocalException; diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp index 22f35ff1b90..cc6aaaa0203 100644 --- a/cpp/src/Ice/TraceUtil.cpp +++ b/cpp/src/Ice/TraceUtil.cpp @@ -154,9 +154,9 @@ IceInternal::traceReply(const char* heading, const Stream& str, const ::Ice::Log s << "(ok)"; break; } - case DispatchException: + case DispatchUserException: { - s << "(exception)"; + s << "(user exception)"; break; } case DispatchLocationForward: @@ -174,6 +174,16 @@ IceInternal::traceReply(const char* heading, const Stream& str, const ::Ice::Log s << "(operation not exist)"; break; } + case DispatchLocalException: + { + s << "(local exception)"; + break; + } + case DispatchUnknownException: + { + s << "(unknown exception)"; + break; + } default: { s << "(unknown)"; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index c590d22f688..618cfab0c71 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1777,6 +1777,8 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << retS << " __ret = "; } C << name << args << ';'; + writeMarshalCode(C, outParams, ret); + C << nl << "return ::IceInternal::DispatchOK;"; if (!throws.empty()) { C << eb; @@ -1798,12 +1800,10 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) { writeMarshalUnmarshalCode(C, *r, "__ex", true); } - C << nl << "return ::IceInternal::DispatchException;"; + C << nl << "return ::IceInternal::DispatchUserException;"; C << eb; } } - writeMarshalCode(C, outParams, ret); - C << nl << "return ::IceInternal::DispatchOK;"; C << eb; } } @@ -1868,19 +1868,25 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p) string scoped = p->scoped(); C << sp; - C << nl << "void IceInternal::incRef(" << scoped << "* p) { p->__incRef(); }"; - C << nl << "void IceInternal::decRef(" << scoped << "* p) { p->__decRef(); }"; + C << nl << "void" << nl << "IceInternal::incRef(" << scoped << "* p)"; + C << sb; + C << nl << "p->__incRef();"; + C << eb; + C << nl << "void" << nl << "IceInternal::decRef(" << scoped << "* p)"; + C << sb; + C << nl << "p->__decRef();"; + C << eb; if (!p->isLocal()) { C << sp; C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)"; C << sb; - C << "p->__incRef();"; + C << nl << "p->__incRef();"; C << eb; C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)"; C << sb; - C << "p->__decRef();"; + C << nl << "p->__decRef();"; C << eb; C << sp; C << nl << "void" << nl << "IceInternal::checkedCast(::IceProxy::Ice::Object* b, ::IceProxy" << scoped diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index a419d90b56e..5e5d9d51a17 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -214,7 +214,7 @@ writeDict(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output& C C << nl << "IceInternal::Stream keyStream(instance);"; writeMarshalUnmarshalCode(C, keyType, "key", "keyStream", true); C << nl << "IceInternal::Stream valueStream(instance);"; - writeMarshalUnmarshalCode(C, keyType, "key", "valueStream", true); + writeMarshalUnmarshalCode(C, keyType, "value", "valueStream", true); C << nl << "_db->put(keyStream.b, valueStream.b);"; C << eb; C << sp << nl << typeToString(valueType) << nl << absolute << "::get(" << inputTypeToString(keyType) |