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 2010/07/07 23:45:36 UTC
svn commit: r961514 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
Author: tabish
Date: Wed Jul 7 21:45:36 2010
New Revision: 961514
URL: http://svn.apache.org/viewvc?rev=961514&view=rev
Log:
Use a dynamic_cast and check for Null.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp?rev=961514&r1=961513&r2=961514&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp Wed Jul 7 21:45:36 2010
@@ -364,7 +364,12 @@ std::string DataInputStream::readLine()
PushbackInputStream* pbStream = dynamic_cast<PushbackInputStream*>( inputStream );
if( foundTerminator ) {
- ( (PushbackInputStream*)inputStream )->unread( (unsigned char)nextByte );
+
+ if( pbStream == NULL ) {
+ throw IOException( __FILE__, __LINE__, "State is not valid, parse failed." );
+ }
+
+ pbStream->unread( (unsigned char)nextByte );
return line;
}
@@ -383,7 +388,13 @@ std::string DataInputStream::readLine()
} else {
if( foundTerminator ) {
- ( (PushbackInputStream*)inputStream )->unread( (unsigned char)nextByte );
+ PushbackInputStream* pbStream = dynamic_cast<PushbackInputStream*>( inputStream );
+
+ if( pbStream == NULL ) {
+ throw IOException( __FILE__, __LINE__, "State is not valid, parse failed." );
+ }
+
+ pbStream->unread( (unsigned char)nextByte );
return line;
}