mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
#538 prevent destructors from throwing exceptions
This commit is contained in:
parent
c8686a727d
commit
544229302e
@ -46,9 +46,16 @@ OpenSSLInitializer::OpenSSLInitializer()
|
||||
|
||||
|
||||
OpenSSLInitializer::~OpenSSLInitializer()
|
||||
{
|
||||
try
|
||||
{
|
||||
uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenSSLInitializer::initialize()
|
||||
|
@ -32,9 +32,16 @@ PooledSessionImpl::PooledSessionImpl(PooledSessionHolder* pHolder):
|
||||
|
||||
|
||||
PooledSessionImpl::~PooledSessionImpl()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StatementImpl* PooledSessionImpl::createStatementImpl()
|
||||
|
@ -74,6 +74,8 @@ RecordSet::RecordSet(const RecordSet& other):
|
||||
|
||||
|
||||
RecordSet::~RecordSet()
|
||||
{
|
||||
try
|
||||
{
|
||||
delete _pBegin;
|
||||
delete _pEnd;
|
||||
@ -83,6 +85,11 @@ RecordSet::~RecordSet()
|
||||
RowMap::iterator end = _rowMap.end();
|
||||
for (; it != end; ++it) delete it->second;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Poco::Dynamic::Var RecordSet::value(std::size_t col, std::size_t row, bool useFilter) const
|
||||
|
@ -59,11 +59,18 @@ void RowFilter::init()
|
||||
|
||||
|
||||
RowFilter::~RowFilter()
|
||||
{
|
||||
try
|
||||
{
|
||||
release();
|
||||
if (_pRecordSet) _pRecordSet->filter(0);
|
||||
if (_pParent.get()) _pParent->removeFilter(this);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool RowFilter::isAllowed(std::size_t row) const
|
||||
|
@ -68,9 +68,16 @@ SQLChannel::SQLChannel(const std::string& connector,
|
||||
|
||||
|
||||
SQLChannel::~SQLChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SQLChannel::open()
|
||||
|
@ -40,9 +40,16 @@ SessionPool::SessionPool(const std::string& connector, const std::string& connec
|
||||
|
||||
|
||||
SessionPool::~SessionPool()
|
||||
{
|
||||
try
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Session SessionPool::get(const std::string& name, bool value)
|
||||
|
@ -39,6 +39,8 @@ Transaction::Transaction(Poco::Data::Session& rSession, bool start):
|
||||
|
||||
|
||||
Transaction::~Transaction()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_rSession.isTransaction())
|
||||
{
|
||||
@ -56,6 +58,11 @@ Transaction::~Transaction()
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Transaction::begin()
|
||||
|
@ -63,9 +63,16 @@ public:
|
||||
}
|
||||
|
||||
virtual ~AbstractCache()
|
||||
{
|
||||
try
|
||||
{
|
||||
uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void add(const TKey& key, const TValue& val)
|
||||
/// Adds the key value pair to the cache.
|
||||
|
@ -93,10 +93,17 @@ public:
|
||||
|
||||
~Activity()
|
||||
/// Stops and destroys the activity.
|
||||
{
|
||||
try
|
||||
{
|
||||
stop();
|
||||
wait();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void start()
|
||||
/// Starts the activity by acquiring a
|
||||
|
@ -58,7 +58,6 @@ union Placeholder
|
||||
/// where the object was allocated (0 => heap, 1 => local).
|
||||
{
|
||||
public:
|
||||
|
||||
struct Size
|
||||
{
|
||||
static const unsigned int value = SizeV;
|
||||
|
@ -186,9 +186,16 @@ public:
|
||||
}
|
||||
|
||||
~BasicMemoryBinaryWriter()
|
||||
{
|
||||
try
|
||||
{
|
||||
flush();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
Buffer<T>& data()
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
return new char_type[static_cast<std::size_t>(size)];
|
||||
}
|
||||
|
||||
static void deallocate(char_type* ptr, std::streamsize /*size*/)
|
||||
static void deallocate(char_type* ptr, std::streamsize /*size*/) throw()
|
||||
{
|
||||
delete [] ptr;
|
||||
}
|
||||
|
@ -150,9 +150,16 @@ inline NDCScope::NDCScope(const std::string& info, int line, const char* filenam
|
||||
|
||||
|
||||
inline NDCScope::~NDCScope()
|
||||
{
|
||||
try
|
||||
{
|
||||
NestedDiagnosticContext::current().pop();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -193,12 +193,19 @@ public:
|
||||
|
||||
~ObjectPool()
|
||||
/// Destroys the ObjectPool.
|
||||
{
|
||||
try
|
||||
{
|
||||
for (typename std::vector<P>::iterator it = _pool.begin(); it != _pool.end(); ++it)
|
||||
{
|
||||
_factory.destroyObject(*it);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
P borrowObject()
|
||||
/// Obtains an object from the pool, or creates a new object if
|
||||
|
@ -167,9 +167,16 @@ inline ScopedRWLock::ScopedRWLock(RWLock& rwl, bool write): _rwl(rwl)
|
||||
|
||||
|
||||
inline ScopedRWLock::~ScopedRWLock()
|
||||
{
|
||||
try
|
||||
{
|
||||
_rwl.unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline ScopedReadRWLock::ScopedReadRWLock(RWLock& rwl): ScopedRWLock(rwl, false)
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void duplicate() const;
|
||||
/// Increments the object's reference count.
|
||||
|
||||
void release() const;
|
||||
void release() const throw();
|
||||
/// Decrements the object's reference count
|
||||
/// and deletes the object if the count
|
||||
/// reaches zero.
|
||||
@ -77,10 +77,17 @@ inline void RefCountedObject::duplicate() const
|
||||
}
|
||||
|
||||
|
||||
inline void RefCountedObject::release() const
|
||||
inline void RefCountedObject::release() const throw()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (--_counter == 0) delete this;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
@ -46,9 +46,16 @@ public:
|
||||
}
|
||||
|
||||
~ScopedLock()
|
||||
{
|
||||
try
|
||||
{
|
||||
_mutex.unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
M& _mutex;
|
||||
@ -81,9 +88,16 @@ public:
|
||||
}
|
||||
|
||||
~ScopedLockWithUnlock()
|
||||
{
|
||||
try
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
|
@ -142,9 +142,16 @@ public:
|
||||
}
|
||||
|
||||
~SharedPtr()
|
||||
{
|
||||
try
|
||||
{
|
||||
release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
SharedPtr& assign(C* ptr)
|
||||
{
|
||||
|
@ -58,10 +58,17 @@ AsyncChannel::AsyncChannel(Channel* pChannel, Thread::Priority prio):
|
||||
|
||||
|
||||
AsyncChannel::~AsyncChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
if (_pChannel) _pChannel->release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AsyncChannel::setChannel(Channel* pChannel)
|
||||
|
@ -540,10 +540,17 @@ DirectoryWatcher::DirectoryWatcher(const Poco::File& directory, int eventMask, i
|
||||
|
||||
|
||||
DirectoryWatcher::~DirectoryWatcher()
|
||||
{
|
||||
try
|
||||
{
|
||||
stop();
|
||||
delete _pStrategy;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DirectoryWatcher::suspendEvents()
|
||||
|
@ -80,9 +80,16 @@ EventLogChannel::EventLogChannel(const std::string& name, const std::string& hos
|
||||
|
||||
|
||||
EventLogChannel::~EventLogChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EventLogChannel::open()
|
||||
|
@ -70,12 +70,19 @@ FileChannel::FileChannel(const std::string& path):
|
||||
|
||||
|
||||
FileChannel::~FileChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
delete _pRotateStrategy;
|
||||
delete _pArchiveStrategy;
|
||||
delete _pPurgeStrategy;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FileChannel::open()
|
||||
|
@ -443,9 +443,16 @@ public:
|
||||
{
|
||||
}
|
||||
~AutoLoggerShutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger::shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,9 +29,16 @@ NotificationQueue::NotificationQueue()
|
||||
|
||||
|
||||
NotificationQueue::~NotificationQueue()
|
||||
{
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NotificationQueue::enqueueNotification(Notification::Ptr pNotification)
|
||||
|
@ -29,9 +29,16 @@ PriorityNotificationQueue::PriorityNotificationQueue()
|
||||
|
||||
|
||||
PriorityNotificationQueue::~PriorityNotificationQueue()
|
||||
{
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PriorityNotificationQueue::enqueueNotification(Notification::Ptr pNotification, int priority)
|
||||
|
@ -51,9 +51,16 @@ SimpleFileChannel::SimpleFileChannel(const std::string& path):
|
||||
|
||||
|
||||
SimpleFileChannel::~SimpleFileChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SimpleFileChannel::open()
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
}
|
||||
|
||||
~TempFileCollector()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (std::set<std::string>::iterator it = _files.begin(); it != _files.end(); ++it)
|
||||
{
|
||||
@ -50,6 +52,11 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
void registerFile(const std::string& path)
|
||||
{
|
||||
@ -80,6 +87,8 @@ TemporaryFile::TemporaryFile(const std::string& tempDir):
|
||||
|
||||
|
||||
TemporaryFile::~TemporaryFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!_keep)
|
||||
{
|
||||
@ -93,6 +102,11 @@ TemporaryFile::~TemporaryFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TemporaryFile::keep()
|
||||
|
@ -279,9 +279,16 @@ ThreadPool::ThreadPool(const std::string& name,
|
||||
|
||||
|
||||
ThreadPool::~ThreadPool()
|
||||
{
|
||||
try
|
||||
{
|
||||
stopAll();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ThreadPool::addCapacity(int n)
|
||||
|
@ -28,9 +28,16 @@ TimedNotificationQueue::TimedNotificationQueue()
|
||||
|
||||
|
||||
TimedNotificationQueue::~TimedNotificationQueue()
|
||||
{
|
||||
try
|
||||
{
|
||||
clear();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TimedNotificationQueue::enqueueNotification(Notification::Ptr pNotification, Timestamp timestamp)
|
||||
|
@ -34,9 +34,16 @@ Timer::Timer(long startInterval, long periodicInterval):
|
||||
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
try
|
||||
{
|
||||
stop();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Timer::start(const AbstractTimerCallback& method)
|
||||
|
@ -83,9 +83,16 @@ public:
|
||||
}
|
||||
|
||||
virtual ~PooledConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.returnObject(_connection);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
operator Connection::Ptr ()
|
||||
{
|
||||
|
@ -86,9 +86,16 @@ public:
|
||||
|
||||
virtual ~ParallelSocketAcceptor()
|
||||
/// Destroys the ParallelSocketAcceptor.
|
||||
{
|
||||
try
|
||||
{
|
||||
unregisterAcceptor();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerAcceptor(SocketReactor& reactor)
|
||||
/// Registers the ParallelSocketAcceptor with a SocketReactor.
|
||||
|
@ -87,9 +87,16 @@ public:
|
||||
|
||||
virtual ~SocketAcceptor()
|
||||
/// Destroys the SocketAcceptor.
|
||||
{
|
||||
try
|
||||
{
|
||||
unregisterAcceptor();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerAcceptor(SocketReactor& reactor)
|
||||
/// Registers the SocketAcceptor with a SocketReactor.
|
||||
|
@ -91,9 +91,16 @@ public:
|
||||
|
||||
virtual ~SocketConnector()
|
||||
/// Destroys the SocketConnector.
|
||||
{
|
||||
try
|
||||
{
|
||||
unregisterConnector();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void registerConnector(SocketReactor& reactor)
|
||||
/// Registers the SocketConnector with a SocketReactor.
|
||||
|
@ -160,9 +160,16 @@ void* HTTPChunkedInputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPChunkedInputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@ -192,9 +199,16 @@ void* HTTPChunkedOutputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPChunkedOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -129,9 +129,16 @@ void* HTTPFixedLengthInputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPFixedLengthInputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@ -161,9 +168,16 @@ void* HTTPFixedLengthOutputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPFixedLengthOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -126,9 +126,16 @@ void* HTTPHeaderInputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPHeaderInputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@ -158,9 +165,16 @@ void* HTTPHeaderOutputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPHeaderOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -44,9 +44,16 @@ HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServe
|
||||
|
||||
|
||||
HTTPServerConnection::~HTTPServerConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
_pFactory->serverStopped -= Poco::delegate(this, &HTTPServerConnection::onServerStopped);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HTTPServerConnection::run()
|
||||
|
@ -63,6 +63,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive):
|
||||
|
||||
|
||||
HTTPSession::~HTTPSession()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_pBuffer) HTTPBufferAllocator::deallocate(_pBuffer, HTTPBufferAllocator::BUFFER_SIZE);
|
||||
try
|
||||
@ -74,6 +76,11 @@ HTTPSession::~HTTPSession()
|
||||
}
|
||||
delete _pException;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HTTPSession::setKeepAlive(bool keepAlive)
|
||||
|
@ -120,9 +120,16 @@ void* HTTPInputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPInputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@ -152,9 +159,16 @@ void* HTTPOutputStream::operator new(std::size_t size)
|
||||
|
||||
|
||||
void HTTPOutputStream::operator delete(void* ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
_pool.release(ptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -130,9 +130,15 @@ MultipartIOS::MultipartIOS(std::istream& istr, const std::string& boundary):
|
||||
|
||||
|
||||
MultipartIOS::~MultipartIOS()
|
||||
{
|
||||
try
|
||||
{
|
||||
_buf.sync();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MultipartStreamBuf* MultipartIOS::rdbuf()
|
||||
|
@ -61,9 +61,16 @@ void Net_API uninitializeNetwork()
|
||||
|
||||
~NetworkInitializer()
|
||||
/// Calls Poco::Net::uninitializeNetwork();
|
||||
{
|
||||
try
|
||||
{
|
||||
Poco::Net::uninitializeNetwork();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const NetworkInitializer pocoNetworkInitializer;
|
||||
|
@ -24,7 +24,10 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
/// PartStore
|
||||
//
|
||||
// PartStore
|
||||
//
|
||||
|
||||
|
||||
PartStore::PartStore(const std::string& mediaType): PartSource(mediaType)
|
||||
{
|
||||
@ -36,7 +39,10 @@ PartStore::~PartStore()
|
||||
}
|
||||
|
||||
|
||||
/// FilePartStore
|
||||
//
|
||||
// FilePartStore
|
||||
//
|
||||
|
||||
|
||||
FilePartStore::FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename):
|
||||
PartStore(mediaType),
|
||||
@ -56,7 +62,7 @@ FilePartStore::~FilePartStore()
|
||||
_fstr.close();
|
||||
File(_path).remove();
|
||||
}
|
||||
catch (Exception&)
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,16 @@ RemoteSyslogChannel::RemoteSyslogChannel(const std::string& address, const std::
|
||||
|
||||
|
||||
RemoteSyslogChannel::~RemoteSyslogChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RemoteSyslogChannel::open()
|
||||
|
@ -68,9 +68,16 @@ SMTPChannel::SMTPChannel(const std::string& mailhost, const std::string& sender,
|
||||
|
||||
|
||||
SMTPChannel::~SMTPChannel()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SMTPChannel::open()
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <stropts.h>
|
||||
#endif
|
||||
|
||||
|
||||
using Poco::IOException;
|
||||
using Poco::TimeoutException;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
@ -71,10 +71,17 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool&
|
||||
|
||||
|
||||
TCPServer::~TCPServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
stop();
|
||||
_pDispatcher->release();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TCPServerParams& TCPServer::params() const
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "Poco/MemoryStream.h"
|
||||
#include "Poco/Format.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
@ -41,10 +41,17 @@ WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskP
|
||||
|
||||
|
||||
WebSocketImpl::~WebSocketImpl()
|
||||
{
|
||||
try
|
||||
{
|
||||
_pStreamSocketImpl->release();
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int WebSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||
|
@ -167,11 +167,17 @@ Context::Context(
|
||||
|
||||
|
||||
Context::~Context()
|
||||
{
|
||||
try
|
||||
{
|
||||
SSL_CTX_free(_pSSLContext);
|
||||
|
||||
Poco::Crypto::OpenSSLInitializer::uninitialize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Context::useCertificate(const Poco::Crypto::X509Certificate& certificate)
|
||||
|
@ -36,12 +36,19 @@ InvalidCertificateHandler::InvalidCertificateHandler(bool handleErrorsOnServerSi
|
||||
|
||||
|
||||
InvalidCertificateHandler::~InvalidCertificateHandler()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_handleErrorsOnServerSide)
|
||||
SSLManager::instance().ServerVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
else
|
||||
SSLManager::instance().ClientVerificationError -= Delegate<InvalidCertificateHandler, VerificationErrorArgs>(this, &InvalidCertificateHandler::onInvalidCertificate);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -33,9 +33,16 @@ PrivateKeyPassphraseHandler::PrivateKeyPassphraseHandler(bool onServerSide): _se
|
||||
|
||||
|
||||
PrivateKeyPassphraseHandler::~PrivateKeyPassphraseHandler()
|
||||
{
|
||||
try
|
||||
{
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -68,9 +68,16 @@ SSLManager::SSLManager()
|
||||
|
||||
|
||||
SSLManager::~SSLManager()
|
||||
{
|
||||
try
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SSLManager::shutdown()
|
||||
|
@ -28,9 +28,16 @@ SecureServerSocketImpl::SecureServerSocketImpl(Context::Ptr pContext):
|
||||
|
||||
|
||||
SecureServerSocketImpl::~SecureServerSocketImpl()
|
||||
{
|
||||
try
|
||||
{
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SocketImpl* SecureServerSocketImpl::acceptConnection(SocketAddress& clientAddr)
|
||||
|
@ -40,9 +40,16 @@ SecureStreamSocketImpl::SecureStreamSocketImpl(StreamSocketImpl* pStreamSocket,
|
||||
|
||||
|
||||
SecureStreamSocketImpl::~SecureStreamSocketImpl()
|
||||
{
|
||||
try
|
||||
{
|
||||
reset();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SocketImpl* SecureStreamSocketImpl::acceptConnection(SocketAddress& clientAddr)
|
||||
|
@ -46,9 +46,16 @@ public:
|
||||
}
|
||||
|
||||
~ArchiveImpl()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& path() const
|
||||
{
|
||||
|
@ -231,10 +231,17 @@ Timer::Timer(Poco::Thread::Priority priority)
|
||||
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
try
|
||||
{
|
||||
_queue.enqueueNotification(new StopNotification(_queue), Poco::Clock(0));
|
||||
_thread.join();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Timer::cancel(bool wait)
|
||||
|
@ -53,9 +53,16 @@ Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flatt
|
||||
|
||||
|
||||
Decompress::~Decompress()
|
||||
{
|
||||
try
|
||||
{
|
||||
EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZipArchive Decompress::decompressAllFiles()
|
||||
|
@ -241,9 +241,16 @@ PartialOutputStream::PartialOutputStream(std::ostream& ostr, std::size_t start,
|
||||
|
||||
|
||||
PartialOutputStream::~PartialOutputStream()
|
||||
{
|
||||
try
|
||||
{
|
||||
close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poco_unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Zip
|
||||
|
Loading…
x
Reference in New Issue
Block a user