summaryrefslogtreecommitdiff
path: root/cppe
diff options
context:
space:
mode:
authorBrent Eagles <brent@zeroc.com>2005-09-07 16:14:20 +0000
committerBrent Eagles <brent@zeroc.com>2005-09-07 16:14:20 +0000
commit4e631700d66c51a96210e2bcbd8b3f63d8b0b9f4 (patch)
tree5b0d75ebdea90cbdfb6c3955b601ece88ccbceee /cppe
parentBug 371: closeSocket can hide real errors (diff)
downloadice-4e631700d66c51a96210e2bcbd8b3f63d8b0b9f4.tar.bz2
ice-4e631700d66c51a96210e2bcbd8b3f63d8b0b9f4.tar.xz
ice-4e631700d66c51a96210e2bcbd8b3f63d8b0b9f4.zip
revising fixes for bug 431
Diffstat (limited to 'cppe')
-rwxr-xr-xcppe/include/IceE/ObjectAdapter.h2
-rwxr-xr-xcppe/src/IceE/Communicator.cpp15
-rw-r--r--cppe/src/IceE/ObjectAdapter.cpp7
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.cpp4
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.h2
-rw-r--r--cppe/test/IceE/exceptions/AllTests.cpp16
6 files changed, 25 insertions, 21 deletions
diff --git a/cppe/include/IceE/ObjectAdapter.h b/cppe/include/IceE/ObjectAdapter.h
index 7d2c0ca6a62..1e7b1411ec7 100755
--- a/cppe/include/IceE/ObjectAdapter.h
+++ b/cppe/include/IceE/ObjectAdapter.h
@@ -88,7 +88,7 @@ public:
private:
- ObjectAdapter(const IceInternal::InstancePtr&, const CommunicatorPtr&, const std::string&);
+ ObjectAdapter(const IceInternal::InstancePtr&, const CommunicatorPtr&, const std::string&, const std::string&);
~ObjectAdapter();
friend class IceInternal::ObjectAdapterFactory;
diff --git a/cppe/src/IceE/Communicator.cpp b/cppe/src/IceE/Communicator.cpp
index 62cae3c1256..3042bbf89aa 100755
--- a/cppe/src/IceE/Communicator.cpp
+++ b/cppe/src/IceE/Communicator.cpp
@@ -73,24 +73,13 @@ Ice::Communicator::proxyToString(const ObjectPrx& proxy) const
ObjectAdapterPtr
Ice::Communicator::createObjectAdapter(const string& name)
{
- return _instance->objectAdapterFactory()->createObjectAdapter(name);
+ return createObjectAdapterWithEndpoints(name, getProperties()->getProperty(name + ".Endpoints"));
}
ObjectAdapterPtr
Ice::Communicator::createObjectAdapterWithEndpoints(const string& name, const string& endpoints)
{
- const string propertyKey = name + ".Endpoints";
- const string originalValue = getProperties()->getProperty(propertyKey);
- try
- {
- getProperties()->setProperty(propertyKey, endpoints);
- return createObjectAdapter(name);
- }
- catch(const AlreadyRegisteredException&)
- {
- getProperties()->setProperty(propertyKey, originalValue);
- throw;
- }
+ return _instance->objectAdapterFactory()->createObjectAdapter(name, endpoints);
}
#endif
diff --git a/cppe/src/IceE/ObjectAdapter.cpp b/cppe/src/IceE/ObjectAdapter.cpp
index 93068218ff5..724a7f2737e 100644
--- a/cppe/src/IceE/ObjectAdapter.cpp
+++ b/cppe/src/IceE/ObjectAdapter.cpp
@@ -604,7 +604,7 @@ Ice::ObjectAdapter::getServantManager() const
}
Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const CommunicatorPtr& communicator,
- const string& name) :
+ const string& name, const string& endpointInfo) :
_deactivated(false),
_instance(instance),
_communicator(communicator),
@@ -623,8 +623,7 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
// The connection factory might change it, for example, to
// fill in the real port number.
//
- string endpts = _instance->properties()->getProperty(name + ".Endpoints");
- vector<EndpointPtr> endpoints = parseEndpoints(endpts);
+ vector<EndpointPtr> endpoints = parseEndpoints(endpointInfo);
for(vector<EndpointPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
_incomingConnectionFactories.push_back(new IncomingConnectionFactory(_instance, *p, this));
@@ -634,7 +633,7 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
// Parse published endpoints. These are used in proxies
// instead of the connection factory endpoints.
//
- endpts = _instance->properties()->getProperty(name + ".PublishedEndpoints");
+ string endpts = _instance->properties()->getProperty(name + ".PublishedEndpoints");
_publishedEndpoints = parseEndpoints(endpts);
#ifdef ICEE_HAS_ROUTER
diff --git a/cppe/src/IceE/ObjectAdapterFactory.cpp b/cppe/src/IceE/ObjectAdapterFactory.cpp
index 3788e09e322..61ccf92ae83 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.cpp
+++ b/cppe/src/IceE/ObjectAdapterFactory.cpp
@@ -109,7 +109,7 @@ IceInternal::ObjectAdapterFactory::waitForShutdown()
}
ObjectAdapterPtr
-IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name)
+IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpoints)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
@@ -124,7 +124,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name)
throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
- ObjectAdapterPtr adapter = new ObjectAdapter(_instance, _communicator, name);
+ ObjectAdapterPtr adapter = new ObjectAdapter(_instance, _communicator, name, endpoints);
_adapters.insert(make_pair(name, adapter));
return adapter;
}
diff --git a/cppe/src/IceE/ObjectAdapterFactory.h b/cppe/src/IceE/ObjectAdapterFactory.h
index eb91ec4ed9e..258976b6bb2 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.h
+++ b/cppe/src/IceE/ObjectAdapterFactory.h
@@ -29,7 +29,7 @@ public:
void shutdown();
void waitForShutdown();
- ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&);
+ ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&);
::Ice::ObjectAdapterPtr findObjectAdapter(const ::Ice::ObjectPrx&);
void flushBatchRequests() const;
diff --git a/cppe/test/IceE/exceptions/AllTests.cpp b/cppe/test/IceE/exceptions/AllTests.cpp
index 75b2361105a..0411979a650 100644
--- a/cppe/test/IceE/exceptions/AllTests.cpp
+++ b/cppe/test/IceE/exceptions/AllTests.cpp
@@ -75,6 +75,22 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
// Expected
}
+
+ communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "");
+ try
+ {
+ Ice::ObjectAdapterPtr second =
+ communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12346 -t 10000");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected.
+ }
+ //
+ // Properties must remain unaffected if an exception occurs.
+ //
+ test(communicator->getProperties()->getProperty("TestAdapter0.Endpoints") == "");
first->deactivate();
}
tprintf("ok\n");