diff options
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/MetricsAdminI.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/GC.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 5 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/AllTests.cpp | 107 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/Test.ice | 5 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/TestAMDI.cpp | 2 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/TestI.cpp | 58 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/TestI.h | 5 | ||||
-rw-r--r-- | cs/src/Ice/BasicStream.cs | 2 | ||||
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 2 |
11 files changed, 67 insertions, 132 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 015ec76c2f8..3aff416d78b 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -1084,7 +1084,7 @@ private: public: - WriteEncaps() : encoder(0), previous(0) + WriteEncaps() : encoder(0), format(Ice::DefaultFormat), previous(0) { // Inlined for performance reasons. } diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index ecbe7483232..973768451b2 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -159,6 +159,11 @@ public: ~EntryT() { assert(_object->total > 0); + for(typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::const_iterator p = + _subMaps.begin(); p != _subMaps.end(); ++p) + { + p->second.first->destroy(); // Break cyclic reference counts. + } } void diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp index 83144936458..daf08851e72 100644 --- a/cpp/src/Ice/GC.cpp +++ b/cpp/src/Ice/GC.cpp @@ -389,7 +389,11 @@ void IceInternal::GC::updateObserver(const CommunicatorObserverPtr& observer) { Monitor<Mutex>::Lock sync(*this); - assert(observer); + if(!observer) + { + assert(!_communicatorObserver); // Communicator is destroyed. + return; + } // Only the first communicator can observe the GC thread. if(!_communicatorObserver) diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index dca161e3aeb..9b17a5ecf43 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -1375,6 +1375,11 @@ IceInternal::Instance::destroy() if(_metricsAdmin) { _metricsAdmin->destroy(); + _metricsAdmin = 0; + if(CommunicatorObserverIPtr::dynamicCast(_initData.observer)) + { + _initData.observer = 0; // Clear cyclic reference counts. + } } ThreadPoolPtr serverThreadPool; diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 6a09297b4d9..d08c104e2db 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -871,6 +871,16 @@ private: typedef IceUtil::Handle<Callback> CallbackPtr; +bool +endsWith(const string& s, const string& findme) +{ + if(s.length() > findme.length()) + { + return 0 == s.compare(s.length() - findme.length(), findme.length(), findme); + } + return false; +} + ThrowerPrx allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { @@ -918,6 +928,42 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) test(uleMsg == ule.what()); test(uleMsg == ule.what()); + + { + E ex("E"); + ostringstream os; + ex.ice_print(os); + test(os.str() == "Test::E"); + test(ex.data == "E"); + } + + // + // Test custom ice_print + // + { + F ex("F"); + ostringstream os; + ex.ice_print(os); + test(os.str() == "Test::F data:'F'"); + test(ex.data == "F"); + } + + { + G ex(__FILE__, __LINE__, "G"); + ostringstream os; + ex.ice_print(os); + test(endsWith(os.str(), "Test::G")); + test(ex.data == "G"); + } + + { + H ex(__FILE__, __LINE__, "H"); + ostringstream os; + ex.ice_print(os); + test(endsWith(os.str(), "Test::H data:'H'")); + test(ex.data == "H"); + } + } cout << "ok" << endl; @@ -1412,68 +1458,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { test(false); } - - - try - { - thrower->throwE(); - } - catch(const E& ex) - { - ostringstream os; - ex.ice_print(os); - test(os.str() == "Test::E"); - test(ex.data == "E"); - } - catch(...) - { - test(false); - } - - try - { - thrower->throwF(); - } - catch(const F& ex) - { - ostringstream os; - ex.ice_print(os); - test(os.str() == "Test::F data:'F'"); - test(ex.data == "F"); - } - catch(...) - { - test(false); - } - - try - { - thrower->throwG(); - test(false); - } - catch(const Ice::UnknownLocalException&) - { - } - catch(...) - { - test(false); - } - - try - { - thrower->throwH(); - test(false); - } - catch(const Ice::UnknownLocalException&) - { - } - catch(...) - { - test(false); - } cout << "ok" << endl; - + if(!collocated) { cout << "catching exact types with AMI... " << flush; diff --git a/cpp/test/Ice/exceptions/Test.ice b/cpp/test/Ice/exceptions/Test.ice index 0eeb1608201..610c7b6bdf6 100644 --- a/cpp/test/Ice/exceptions/Test.ice +++ b/cpp/test/Ice/exceptions/Test.ice @@ -96,11 +96,6 @@ module Mod void throwAfterResponse(); void throwAfterException() throws A; - - void throwE() throws E; - void throwF() throws F; - void throwG(); - void throwH(); }; ["ami"] interface WrongOperation diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp index 88534bc356f..266f020fc4e 100644 --- a/cpp/test/Ice/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/exceptions/TestAMDI.cpp @@ -206,7 +206,7 @@ ThrowerI::throwAfterResponse_async(const AMD_Thrower_throwAfterResponsePtr& cb, void ThrowerI::throwAfterException_async(const AMD_Thrower_throwAfterExceptionPtr& cb, const Ice::Current&) { - cb->ice_exception(A()); + cb->ice_exception(A(12345)); throw std::string(); } diff --git a/cpp/test/Ice/exceptions/TestI.cpp b/cpp/test/Ice/exceptions/TestI.cpp index 0dcad9963d0..56797a7c5c7 100644 --- a/cpp/test/Ice/exceptions/TestI.cpp +++ b/cpp/test/Ice/exceptions/TestI.cpp @@ -14,16 +14,6 @@ using namespace Test; using namespace std; -bool -endsWith(const string& s, const string& findme) -{ - if(s.length() > findme.length()) - { - return 0 == s.compare(s.length() - findme.length(), findme.length(), findme); - } - return false; -} - ThrowerI::ThrowerI() { } @@ -176,51 +166,5 @@ ThrowerI::throwAfterException(const Ice::Current&) // // Only relevant for AMD. // - throw A(); -} - -void -ThrowerI::throwE(const Ice::Current&) -{ - throw E("E"); -} - -void -ThrowerI::throwF(const Ice::Current&) -{ - throw F("F"); -} - -void -ThrowerI::throwG(const Ice::Current&) -{ - try - { - throw G(__FILE__, __LINE__, "G"); - } - catch(const G& ex) - { - ostringstream os; - ex.ice_print(os); - test(endsWith(os.str(), "Test::G")); - test(ex.data == "G"); - throw ex; - } -} - -void -ThrowerI::throwH(const Ice::Current&) -{ - try - { - throw H(__FILE__, __LINE__, "H"); - } - catch(const H& ex) - { - ostringstream os; - ex.ice_print(os); - test(endsWith(os.str(), "Test::H data:'H'")); - test(ex.data == "H"); - throw ex; - } + throw A(12345); } diff --git a/cpp/test/Ice/exceptions/TestI.h b/cpp/test/Ice/exceptions/TestI.h index ef10fbea1d6..cd8c2121a89 100644 --- a/cpp/test/Ice/exceptions/TestI.h +++ b/cpp/test/Ice/exceptions/TestI.h @@ -43,11 +43,6 @@ public: virtual void throwAfterResponse(const Ice::Current&); virtual void throwAfterException(const Ice::Current&); - - virtual void throwE(const Ice::Current&); - virtual void throwF(const Ice::Current&); - virtual void throwG(const Ice::Current&); - virtual void throwH(const Ice::Current&); }; #endif diff --git a/cs/src/Ice/BasicStream.cs b/cs/src/Ice/BasicStream.cs index acab362e947..a1cef477d20 100644 --- a/cs/src/Ice/BasicStream.cs +++ b/cs/src/Ice/BasicStream.cs @@ -4912,7 +4912,7 @@ namespace IceInternal internal int start; internal Ice.EncodingVersion encoding; internal bool encoding_1_0; - internal Ice.FormatType format; + internal Ice.FormatType format = Ice.FormatType.DefaultFormat; internal EncapsEncoder encoder; diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 7e686517e0f..9701cc41933 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -4094,7 +4094,7 @@ public class BasicStream } int start; - Ice.FormatType format; + Ice.FormatType format = Ice.FormatType.DefaultFormat; Ice.EncodingVersion encoding; boolean encoding_1_0; |