You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/04/04 23:01:33 UTC
svn commit: r762007 [1/2] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/cmsutil/
main/activemq/commands/ main/activemq/core/ main/activemq/exceptions/
main/activemq/wireformat/stomp/marshal/ main/cms/
main/decaf/util/concurren...
Author: tabish
Date: Sat Apr 4 21:01:32 2009
New Revision: 762007
URL: http://svn.apache.org/viewvc?rev=762007&view=rev
Log:
Make CMSException a stand alone exception class so that CMS can be broken out as a separate library someday. Also perform some code cleanup and fix a memory leak that occurs when a BrokerException is received.
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp (with props)
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsAccessor.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/PooledSession.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQQueue.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempDestination.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempQueue.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempTopic.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTopic.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshalable.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/PooledThread.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/LogWriter.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/Logger.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/logging/MarkBlockLogger.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/CmsTemplateTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/cmsutil/CmsTemplateTest.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/core/ActiveMQSessionTest.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/BooleanTest.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/lang/IntegerTest.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/concurrent/ThreadPoolTest.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Sat Apr 4 21:01:32 2009
@@ -16,6 +16,7 @@
# ---------------------------------------------------------------------------
cc_sources = \
+ cms/CMSException.cpp \
decaf/lang/Float.cpp \
decaf/lang/Boolean.cpp \
decaf/lang/Integer.cpp \
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsAccessor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsAccessor.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsAccessor.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsAccessor.cpp Sat Apr 4 21:01:32 2009
@@ -49,8 +49,7 @@
return c;
}
AMQ_CATCH_RETHROW( IllegalStateException )
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -74,8 +73,7 @@
return s;
}
AMQ_CATCH_RETHROW( IllegalStateException )
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/CmsTemplate.cpp Sat Apr 4 21:01:32 2009
@@ -29,7 +29,7 @@
/**
* Macro for catching an exception then rethrowing an
- * ActiveMQException (which is a cms::CMSException).
+ * cms::CMSException.
* @param type
* The type of the exception to throw
* @param t
@@ -42,22 +42,26 @@
try { \
t->destroy(); \
} catch( ... ) {} \
- throw ActiveMQException(ex); \
+ throw ActiveMQException(ex).convertToCMSException(); \
}
/**
- * A catch-all that throws an ActiveMQException.
+ * A catch-all that throws an CMSException.
* @param t
* The instance of CmsTemplate
*/
#define CMSTEMPLATE_CATCHALL(t) \
- catch( ... ){ \
- ActiveMQException ex( __FILE__, __LINE__, \
- "caught unknown exception" ); \
+ catch( cms::CMSException& ex ){ \
try { \
t->destroy(); \
} catch( ... ) {} \
throw ex; \
+ } catch( ... ){ \
+ try { \
+ t->destroy(); \
+ } catch( ... ) {} \
+ throw ActiveMQException( __FILE__, __LINE__, \
+ "caught unknown exception" ).convertToCMSException(); \
}
////////////////////////////////////////////////////////////////////////////////
@@ -236,7 +240,18 @@
}
CMSTEMPLATE_CATCH( IllegalStateException, this )
CMSTEMPLATE_CATCH( ActiveMQException, this )
- CMSTEMPLATE_CATCHALL( this )
+ catch( cms::CMSException& ex ){
+ try {
+ this->destroy();
+ } catch( ... ) {}
+ throw ex;
+ } catch( ... ){
+ try {
+ this->destroy();
+ } catch( ... ) {}
+ throw ActiveMQException( __FILE__, __LINE__, \
+ "caught unknown exception" ).convertToCMSException();
+ }
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp Sat Apr 4 21:01:32 2009
@@ -95,7 +95,9 @@
throw (cms::CMSException) {
if( destName == "" ) {
- throw ActiveMQException( __FILE__, __LINE__, "destination name is invalid" );
+ throw ActiveMQException(
+ __FILE__, __LINE__,
+ "destination name is invalid" ).convertToCMSException();
}
// Get the resolver for this session.
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/PooledSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/PooledSession.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/PooledSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/cmsutil/PooledSession.cpp Sat Apr 4 21:01:32 2009
@@ -91,8 +91,7 @@
return cachedProducer;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -136,8 +135,7 @@
return cachedConsumer;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp Sat Apr 4 21:01:32 2009
@@ -47,9 +47,7 @@
std::vector<unsigned char>& content = getContent();
content.insert( content.end(), buffer, buffer + numBytes );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -63,9 +61,7 @@
return NULL;
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -74,9 +70,7 @@
try{
return getContent().size();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -86,9 +80,7 @@
this->setReadOnlyBody( true );
inputStream.setBuffer( getContent() );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -98,9 +90,7 @@
checkWriteOnlyBody();
return dataInputStream.readBoolean();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -110,9 +100,7 @@
checkReadOnlyBody();
dataOutputStream.writeBoolean( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -122,9 +110,7 @@
checkWriteOnlyBody();
return dataInputStream.readByte();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -134,9 +120,7 @@
checkReadOnlyBody();
dataOutputStream.writeByte( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -147,9 +131,7 @@
checkWriteOnlyBody();
return dataInputStream.read( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -159,9 +141,7 @@
checkReadOnlyBody();
dataOutputStream.write( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -172,9 +152,7 @@
checkWriteOnlyBody();
return dataInputStream.read( buffer, 0, length );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -186,9 +164,7 @@
checkReadOnlyBody();
dataOutputStream.write( value, offset, length );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -198,9 +174,7 @@
checkWriteOnlyBody();
return dataInputStream.readChar();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -210,9 +184,7 @@
checkReadOnlyBody();
dataOutputStream.writeChar( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -234,9 +206,7 @@
checkReadOnlyBody();
dataOutputStream.writeFloat( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -246,9 +216,7 @@
checkWriteOnlyBody();
return dataInputStream.readDouble();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -258,9 +226,7 @@
checkReadOnlyBody();
dataOutputStream.writeDouble( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -270,9 +236,7 @@
checkWriteOnlyBody();
return dataInputStream.readShort();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -282,9 +246,7 @@
checkReadOnlyBody();
dataOutputStream.writeShort( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -294,9 +256,7 @@
checkWriteOnlyBody();
return dataInputStream.readUnsignedShort();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -306,9 +266,7 @@
checkReadOnlyBody();
dataOutputStream.writeUnsignedShort( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -318,9 +276,7 @@
checkWriteOnlyBody();
return dataInputStream.readInt();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -330,9 +286,7 @@
checkReadOnlyBody();
dataOutputStream.writeInt( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -342,9 +296,7 @@
checkWriteOnlyBody();
return dataInputStream.readLong();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -354,9 +306,7 @@
checkReadOnlyBody();
dataOutputStream.writeLong( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -366,9 +316,7 @@
checkWriteOnlyBody();
return dataInputStream.readString();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -378,9 +326,7 @@
checkReadOnlyBody();
dataOutputStream.writeChars( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -390,9 +336,7 @@
checkWriteOnlyBody();
return dataInputStream.readUTF();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -402,7 +346,5 @@
checkReadOnlyBody();
dataOutputStream.writeUTF( value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.h Sat Apr 4 21:01:32 2009
@@ -411,8 +411,10 @@
*/
void checkWriteOnlyBody() const throw ( cms::CMSException ){
if( !this->isReadOnlyBody() ){
- throw exceptions::ActiveMQException( __FILE__, __LINE__,
- "message is in read-only mode and cannot be written to" );
+ throw exceptions::ActiveMQException(
+ __FILE__, __LINE__,
+ "message is in read-only mode and "
+ "cannot be written to" ).convertToCMSException();
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp Sat Apr 4 21:01:32 2009
@@ -61,9 +61,7 @@
clearBody();
}
}
- AMQ_CATCH_RETHROW( io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
- AMQ_CATCHALL_THROW( io::IOException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -74,9 +72,7 @@
this->checkMapIsUnmarshalled();
return *map;
}
- AMQ_CATCH_RETHROW( NullPointerException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
- AMQ_CATCHALL_THROW( NullPointerException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -88,9 +84,7 @@
this->checkMapIsUnmarshalled();
return *map;
}
- AMQ_CATCH_RETHROW( NullPointerException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
- AMQ_CATCHALL_THROW( NullPointerException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -116,20 +110,16 @@
}
}
}
- AMQ_CATCH_RETHROW( NullPointerException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, NullPointerException )
- AMQ_CATCHALL_THROW( NullPointerException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
-std::vector<std::string> ActiveMQMapMessage::getMapNames(void) const {
+std::vector<std::string> ActiveMQMapMessage::getMapNames() const {
try{
return getMap().keySet();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -138,9 +128,7 @@
try{
return getMap().containsKey( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -150,9 +138,7 @@
try{
return getMap().getBool( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -163,9 +149,7 @@
checkReadOnlyBody();
getMap().setBool( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -175,9 +159,7 @@
try{
return getMap().getByte( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -189,9 +171,7 @@
checkReadOnlyBody();
getMap().setByte( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -201,9 +181,7 @@
try{
return getMap().getByteArray( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -215,9 +193,7 @@
checkReadOnlyBody();
getMap().setByteArray( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -227,9 +203,7 @@
try{
return getMap().getChar( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -240,9 +214,7 @@
checkReadOnlyBody();
getMap().setChar( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -252,9 +224,7 @@
try{
return getMap().getDouble( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -266,9 +236,7 @@
checkReadOnlyBody();
getMap().setDouble( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -278,9 +246,7 @@
try{
return getMap().getFloat( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -291,9 +257,7 @@
checkReadOnlyBody();
getMap().setFloat( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -303,9 +267,7 @@
try{
return getMap().getInt( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -316,9 +278,7 @@
checkReadOnlyBody();
getMap().setInt( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -328,9 +288,7 @@
try{
return getMap().getLong( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -341,9 +299,7 @@
checkReadOnlyBody();
getMap().setLong( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -353,9 +309,7 @@
try{
return getMap().getShort( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -366,9 +320,7 @@
checkReadOnlyBody();
getMap().setShort( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -378,9 +330,7 @@
try{
return getMap().getString( name );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -392,7 +342,5 @@
checkReadOnlyBody();
getMap().setString( name, value );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h Sat Apr 4 21:01:32 2009
@@ -36,7 +36,7 @@
public:
- ActiveMQMessageTemplate() : commands::Message() {
+ ActiveMQMessageTemplate() : commands::Message() {
this->propertiesInterceptor.reset(
new wireformat::openwire::utils::MessagePropertyInterceptor(
this, &this->getMessageProperties() ) );
@@ -54,9 +54,7 @@
try{
this->getAckHandler()->acknowledgeMessage( this );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -107,9 +105,7 @@
try{
return this->propertiesInterceptor->getBooleanProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -124,9 +120,7 @@
try{
return this->propertiesInterceptor->getByteProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -141,9 +135,7 @@
try{
return this->propertiesInterceptor->getDoubleProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -158,9 +150,7 @@
try{
return this->propertiesInterceptor->getFloatProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -175,9 +165,7 @@
try{
return this->propertiesInterceptor->getIntProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -192,9 +180,7 @@
try{
return this->propertiesInterceptor->getLongProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -209,9 +195,7 @@
try{
return this->propertiesInterceptor->getShortProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -226,9 +210,7 @@
try{
return this->propertiesInterceptor->getStringProperty( name );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -245,9 +227,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setBooleanProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -264,9 +244,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setByteProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -283,9 +261,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setDoubleProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -302,9 +278,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setFloatProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -321,9 +295,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setIntProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -340,9 +312,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setLongProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -359,9 +329,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setShortProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -378,9 +346,7 @@
checkReadOnlyProperties();
this->propertiesInterceptor->setStringProperty( name, value );
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
/**
@@ -419,7 +385,7 @@
* Gets the Destination for this Message, returns a
* @return Destination object
*/
- virtual const cms::Destination* getCMSDestination(void) const {
+ virtual const cms::Destination* getCMSDestination() const {
return dynamic_cast<const cms::Destination*>( this->getDestination().get() );
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQQueue.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQQueue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQQueue.h Sat Apr 4 21:01:32 2009
@@ -108,7 +108,7 @@
* Retrieve the Destination Type for this Destination
* @return The Destination Type
*/
- virtual cms::Destination::DestinationType getDestinationType(void) const {
+ virtual cms::Destination::DestinationType getDestinationType() const {
return cms::Destination::QUEUE;
}
@@ -157,15 +157,8 @@
* Gets the name of this queue.
* @return The queue name.
*/
- virtual std::string getQueueName() const
- throw( cms::CMSException ) {
-
- try{
- return this->getPhysicalName();
- }
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ virtual std::string getQueueName() const throw( cms::CMSException ) {
+ return this->getPhysicalName();
}
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempDestination.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempDestination.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempDestination.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempDestination.cpp Sat Apr 4 21:01:32 2009
@@ -50,6 +50,5 @@
this->connection->destroyDestination( this );
}
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempQueue.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempQueue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempQueue.h Sat Apr 4 21:01:32 2009
@@ -154,15 +154,8 @@
* Gets the name of this queue.
* @return The queue name.
*/
- virtual std::string getQueueName() const
- throw( cms::CMSException ) {
-
- try{
- return this->getPhysicalName();
- }
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ virtual std::string getQueueName() const throw( cms::CMSException ) {
+ return this->getPhysicalName();
}
/**
@@ -173,9 +166,7 @@
try{
close();
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempTopic.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempTopic.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempTopic.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTempTopic.h Sat Apr 4 21:01:32 2009
@@ -154,15 +154,8 @@
* Gets the name of this topic.
* @return The topic name.
*/
- virtual std::string getTopicName()
- const throw( cms::CMSException ) {
-
- try{
- return this->getPhysicalName();
- }
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ virtual std::string getTopicName() const throw( cms::CMSException ) {
+ return this->getPhysicalName();
}
/**
@@ -173,9 +166,7 @@
try{
close();
}
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp Sat Apr 4 21:01:32 2009
@@ -49,9 +49,7 @@
return std::string( (const char*)&getContent()[4], getContent().size()-4 );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -59,9 +57,7 @@
try{
setText( std::string(msg) );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -76,7 +72,5 @@
dos.writeInt( (int)msg.length() );
dos.write( (const unsigned char*)msg.c_str(), 0, msg.length() );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTopic.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTopic.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTopic.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTopic.h Sat Apr 4 21:01:32 2009
@@ -118,7 +118,7 @@
* necessarily equal to the User Supplied name of the Destination
* @return Provider specific Name
*/
- virtual std::string toProviderString(void) const {
+ virtual std::string toProviderString() const {
return this->getPhysicalName();
}
@@ -157,15 +157,8 @@
* Gets the name of this topic.
* @return The topic name.
*/
- virtual std::string getTopicName(void)
- const throw( cms::CMSException ) {
-
- try{
- return this->getPhysicalName();
- }
- AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, exceptions::ActiveMQException )
- AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+ virtual std::string getTopicName() const throw( cms::CMSException ) {
+ return this->getPhysicalName();
}
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/WireFormatInfo.h Sat Apr 4 21:01:32 2009
@@ -219,8 +219,7 @@
/**
* Gets the Properties for this Command
- * @param reference to a PrimitiveMap
- * @throws cms::CMSException
+ * @return the Properties object for this Command.
*/
virtual const util::PrimitiveMap& getProperties() const {
return properties;
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Sat Apr 4 21:01:32 2009
@@ -95,10 +95,13 @@
const decaf::lang::Pointer<ConsumerId>& consumer, Dispatcher* dispatcher )
throw ( cms::CMSException ) {
- // Add the consumer to the map.
- synchronized( &dispatchers ) {
- dispatchers.put( consumer, dispatcher );
+ try{
+ // Add the consumer to the map.
+ synchronized( &dispatchers ) {
+ dispatchers.put( consumer, dispatcher );
+ }
}
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -106,10 +109,13 @@
const decaf::lang::Pointer<ConsumerId>& consumer )
throw ( cms::CMSException ) {
- // Remove the consumer from the map.
- synchronized( &dispatchers ) {
- dispatchers.remove( consumer );
+ try{
+ // Remove the consumer from the map.
+ synchronized( &dispatchers ) {
+ dispatchers.remove( consumer );
+ }
}
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -117,9 +123,7 @@
try {
return createSession( Session::AUTO_ACKNOWLEDGE );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -156,9 +160,7 @@
return session;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -172,9 +174,7 @@
activeSessions.remove( session );
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -188,9 +188,7 @@
activeProducers.put( producer->getProducerInfo().getProducerId(), producer );
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -204,9 +202,7 @@
activeProducers.remove( producerId );
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -252,9 +248,7 @@
this->started = false;
this->closed = true;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -274,9 +268,7 @@
sessions[ix]->start();
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -296,9 +288,7 @@
iter->next()->stop();
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -574,9 +564,7 @@
if( exceptionResponse != NULL ) {
// Create an exception to hold the error information.
- BrokerError* brokerError =
- exceptionResponse->getException()->cloneDataStructure();
- BrokerException exception( __FILE__, __LINE__, brokerError );
+ BrokerException exception( __FILE__, __LINE__, exceptionResponse->getException().get() );
// Throw the exception.
throw exception;
@@ -631,7 +619,7 @@
void ActiveMQConnection::fire( const ActiveMQException& ex ) {
if( exceptionListener != NULL ) {
try {
- exceptionListener->onException( ex );
+ exceptionListener->onException( ex.convertToCMSException() );
}
catch(...){}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp Sat Apr 4 21:01:32 2009
@@ -144,7 +144,19 @@
return connection.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ catch( cms::CMSException& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ throw ex;
+ } catch( activemq::exceptions::ActiveMQException& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ throw ex.convertToCMSException();
+ } catch( decaf::lang::Exception& ex ){
+ ex.setMark( __FILE__, __LINE__ );
+ activemq::exceptions::ActiveMQException amqEx( ex );
+ throw amqEx.convertToCMSException();
+ } catch( std::exception& ex ) {
+ throw cms::CMSException( ex.what(), NULL );
+ } catch(...) {
+ throw cms::CMSException( "Caught Unknown Exception", NULL );
+ }
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp Sat Apr 4 21:01:32 2009
@@ -137,6 +137,9 @@
this->closed = false;
this->lastDeliveredSequenceId = 0;
this->synchronizationRegistered = false;
+ this->additionalWindowSize = 0;
+ this->redeliveryDelay = 0;
+ this->deliveredCounter = 0;
}
////////////////////////////////////////////////////////////////////////////////
@@ -171,9 +174,7 @@
}
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -233,9 +234,7 @@
// Fetch the Selector
return this->consumerInfo->getSelector();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -300,9 +299,7 @@
return Pointer<Message>();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -335,9 +332,7 @@
// Return the cloned message.
return clonedMessage;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -371,9 +366,7 @@
// Return the cloned message.
return clonedMessage;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -407,9 +400,7 @@
// Return the cloned message.
return clonedMessage;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -651,9 +642,7 @@
this->acknowledge();
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -689,9 +678,7 @@
}
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -795,7 +782,7 @@
return;
}
- cms::MessageListener* cmsListener = this->listener.get();
+ cms::MessageListener* cmsListener = this->listener.get();
// If we have a listener, send the message.
if( cmsListener != NULL ) {
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Sat Apr 4 21:01:32 2009
@@ -76,9 +76,7 @@
this->closed = true;
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -98,9 +96,7 @@
this->send( this->destination.get(), message );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -121,9 +117,7 @@
this->send( this->destination.get(), message, deliveryMode,
priority, timeToLive );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -137,9 +131,7 @@
this->send( destination, message, defaultDeliveryMode,
defaultPriority, defaultTimeToLive );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -180,9 +172,7 @@
// send the message.
this->session->send( message, this, this->memoryUsage.get() );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Sat Apr 4 21:01:32 2009
@@ -159,9 +159,7 @@
// Now indicate that this session is closed.
closed = true;
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -180,9 +178,7 @@
// Commit the Transaction
this->transaction->commit();
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -211,9 +207,7 @@
this->executor->start();
}
}
- AMQ_CATCH_NOTHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_NOTHROW( )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -227,9 +221,7 @@
return this->createConsumer( destination, "", false );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -244,9 +236,7 @@
return this->createConsumer( destination, selector, false );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -287,9 +277,7 @@
return consumer.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -332,9 +320,7 @@
return consumer.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -393,9 +379,7 @@
return producer.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -413,9 +397,7 @@
return new commands::ActiveMQQueue( queueName );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -433,9 +415,7 @@
return new commands::ActiveMQTopic( topicName );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -454,9 +434,7 @@
return queue.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -475,9 +453,7 @@
return topic.release();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -489,9 +465,7 @@
this->checkClosed();
return new commands::ActiveMQMessage();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -503,9 +477,7 @@
this->checkClosed();
return new commands::ActiveMQBytesMessage();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -521,9 +493,7 @@
msg->setBodyBytes( bytes, bytesSize );
return msg;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -535,9 +505,7 @@
this->checkClosed();
return new commands::ActiveMQTextMessage();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -551,9 +519,7 @@
msg->setText( text.c_str() );
return msg;
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -565,9 +531,7 @@
this->checkClosed();
return new commands::ActiveMQMapMessage();
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -658,9 +622,7 @@
this->connection->syncRequest( msgCopy, this->connection->getSendTimeout() );
}
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
@@ -690,9 +652,7 @@
// Send the message to the broker.
this->connection->syncRequest( rsi );
}
- AMQ_CATCH_RETHROW( ActiveMQException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
- AMQ_CATCHALL_THROW( ActiveMQException )
+ AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h Sat Apr 4 21:01:32 2009
@@ -20,7 +20,6 @@
#include <memory>
#include <cms/Message.h>
-#include <cms/CMSException.h>
#include <activemq/util/Config.h>
#include <activemq/exceptions/ActiveMQException.h>
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp Sat Apr 4 21:01:32 2009
@@ -34,8 +34,7 @@
////////////////////////////////////////////////////////////////////////////////
ActiveMQException::ActiveMQException( const ActiveMQException& ex ) throw()
-: cms::CMSException(),
- decaf::lang::Exception() {
+: decaf::lang::Exception() {
this->message = ex.getMessage();
this->stackTrace = ex.getStackTrace();
@@ -44,8 +43,7 @@
////////////////////////////////////////////////////////////////////////////////
ActiveMQException::ActiveMQException( const Exception& ex ) throw()
-: cms::CMSException(),
- decaf::lang::Exception() {
+: decaf::lang::Exception() {
this->message = ex.getMessage();
this->stackTrace = ex.getStackTrace();
@@ -54,9 +52,8 @@
////////////////////////////////////////////////////////////////////////////////
ActiveMQException::ActiveMQException( const char* file, const int lineNumber,
- const char* msg, ... ) throw()
-: cms::CMSException(),
- decaf::lang::Exception() {
+ const char* msg, ... ) throw()
+: decaf::lang::Exception() {
va_list vargs;
va_start( vargs, msg ) ;
@@ -76,8 +73,19 @@
}
////////////////////////////////////////////////////////////////////////////////
-ActiveMQException& ActiveMQException::operator =( const Exception& ex ){
- this->setMessage( ex.getMessage().c_str() );
- this->setStackTrace( ex.getStackTrace() );
- return *this;
+cms::CMSException ActiveMQException::convertToCMSException() const {
+
+ std::exception* result = NULL;
+
+ if( this->getCause() != NULL ) {
+ const Exception* ptrCause = dynamic_cast<const Exception*>( this->getCause() );
+
+ if( ptrCause == NULL ) {
+ result = new Exception( __FILE__, __LINE__, cause->what() );
+ } else {
+ result = ptrCause->clone();
+ }
+ }
+
+ return cms::CMSException( this->getMessage(), result, this->getStackTrace() );
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h Sat Apr 4 21:01:32 2009
@@ -34,8 +34,7 @@
/*
* Base class for all exceptions.
*/
- class AMQCPP_API ActiveMQException : public cms::CMSException,
- public decaf::lang::Exception {
+ class AMQCPP_API ActiveMQException : public decaf::lang::Exception {
public:
/**
@@ -76,79 +75,10 @@
virtual ActiveMQException* clone() const;
/**
- * Assignment operator.
- * @param const reference to another ActiveMQException
+ * Converts this exception to a new CMSException
+ * @return a CMSException with the data from this exception
*/
- virtual ActiveMQException& operator =( const Exception& ex );
-
- /**
- * Gets the cause of the error.
- *
- * @return string errors message
- */
- virtual std::string getMessage() const {
- return decaf::lang::Exception::getMessage();
- }
-
- /**
- * Gets the exception that caused this one to be thrown, this allows
- * for chaining of exceptions in the case of a method that throws only
- * a particular exception but wishes to allow for the real causal
- * exception to be passed only in case the caller knows about that
- * type of exception and wishes to respond to it.
- * @returns a const pointer reference to the causal exception, if there
- * was no cause associated with this exception then NULL is returned.
- */
- virtual const std::exception* getCause() const {
- return decaf::lang::Exception::getCause();
- }
-
- /**
- * Adds a file/line number to the stack trace.
- *
- * @param file
- * The name of the file calling this method (use __FILE__).
- * @param lineNumber
- * The line number in the calling file (use __LINE__).
- */
- virtual void setMark( const char* file, const int lineNumber ) {
- decaf::lang::Exception::setMark( file, lineNumber );
- }
-
- /**
- * Provides the stack trace for every point where
- * this exception was caught, marked, and rethrown.
- *
- * @return vector containing stack trace strings
- */
- virtual std::vector< std::pair< std::string, int> > getStackTrace() const {
- return decaf::lang::Exception::getStackTrace();
- }
-
- /**
- * Prints the stack trace to std::err
- */
- virtual void printStackTrace() const {
- decaf::lang::Exception::printStackTrace();
- }
-
- /**
- * Prints the stack trace to the given output stream.
- *
- * @param stream the target output stream.
- */
- virtual void printStackTrace( std::ostream& stream ) const {
- decaf::lang::Exception::printStackTrace( stream );
- }
-
- /**
- * Gets the stack trace as one contiguous string.
- *
- * @return string with formatted stack trace data
- */
- virtual std::string getStackTraceString() const {
- return decaf::lang::Exception::getStackTraceString();
- }
+ virtual cms::CMSException convertToCMSException() const;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h Sat Apr 4 21:01:32 2009
@@ -75,4 +75,29 @@
ex.setMark( __FILE__, __LINE__ ); \
}
+/**
+ * Macro for catching an exception of one type and then rethrowing
+ * as another type.
+ * @param sourceType the type of the exception to be caught.
+ * @param targetType the type of the exception to be thrown.
+ */
+#define AMQ_CATCH_ALL_THROW_CMSEXCEPTION() \
+ catch( cms::CMSException& ex ){ \
+ ex.setMark( __FILE__, __LINE__ ); \
+ throw ex; \
+ } catch( activemq::exceptions::ActiveMQException& ex ){ \
+ ex.setMark( __FILE__, __LINE__ ); \
+ throw ex.convertToCMSException(); \
+ } catch( decaf::lang::Exception& ex ){ \
+ ex.setMark( __FILE__, __LINE__ ); \
+ activemq::exceptions::ActiveMQException amqEx( ex ); \
+ throw amqEx.convertToCMSException(); \
+ } catch( std::exception& ex ){ \
+ throw cms::CMSException( ex.what(), NULL ); \
+ } catch(...) { \
+ throw cms::CMSException( "Caught Unknown Exception", NULL ); \
+ }
+
+
+
#endif /*_ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_*/
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshalable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshalable.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshalable.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshalable.h Sat Apr 4 21:01:32 2009
@@ -30,7 +30,7 @@
class AMQCPP_API Marshalable {
public:
- virtual ~Marshalable(void) {}
+ virtual ~Marshalable() {}
/**
* Marshals the command to a stomp frame.
@@ -39,7 +39,7 @@
* @throws MarshalException if the command is not
* in a state that can be marshaled.
*/
- virtual const StompFrame& marshal(void)
+ virtual const StompFrame& marshal()
throw ( marshal::MarshalException ) = 0;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h?rev=762007&r1=762006&r2=762007&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.h Sat Apr 4 21:01:32 2009
@@ -34,8 +34,8 @@
class AMQCPP_API Marshaler {
public:
- Marshaler(void) {}
- virtual ~Marshaler(void) {}
+ Marshaler() {}
+ virtual ~Marshaler() {}
/**
* Marshal a Stomp Frame to a Stomp Command, the frame is now
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp?rev=762007&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp Sat Apr 4 21:01:32 2009
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cms/CMSException.h>
+
+#include <vector>
+#include <sstream>
+#include <algorithm>
+
+using namespace std;
+using namespace cms;
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException::CMSException() throw() : std::exception() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException::CMSException( const CMSException& ex ) throw() : std::exception() {
+
+ this->cause.reset( ex.cause.release() );
+ this->message = ex.message;
+ this->stackTrace = ex.stackTrace;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException::CMSException( const std::string& message,
+ const std::exception* cause ) throw() : std::exception() {
+
+ this->cause.reset( cause );
+ this->message = message;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException::CMSException( const std::string& message,
+ const std::exception* cause,
+ const std::vector< std::pair< std::string, int> >& stackTrace )
+ throw() : std::exception() {
+
+ this->cause.reset( cause );
+ this->message = message;
+ this->stackTrace = stackTrace;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException::~CMSException() throw() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSException::setMark( const char* file, const int lineNumber ) {
+
+ // Add this mark to the end of the stack trace.
+ stackTrace.push_back( std::make_pair( (std::string)file, (int)lineNumber ) );
+
+ std::ostringstream stream;
+ stream << "\tFILE: " << stackTrace[stackTrace.size()-1].first;
+ stream << ", LINE: " << stackTrace[stackTrace.size()-1].second;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSException::printStackTrace() const {
+ printStackTrace( std::cerr );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CMSException::printStackTrace( std::ostream& stream ) const {
+ stream << getStackTraceString();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string CMSException::getStackTraceString() const {
+
+ // Create the output stream.
+ std::ostringstream stream;
+
+ // Write the message and each stack entry.
+ stream << message << std::endl;
+ for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
+ stream << "\tFILE: " << stackTrace[ix].first;
+ stream << ", LINE: " << stackTrace[ix].second;
+ stream << std::endl;
+ }
+
+ // Return the string from the output stream.
+ return stream.str();
+}
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/CMSException.cpp
------------------------------------------------------------------------------
svn:eol-style = native