activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r961514 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
Date Wed, 07 Jul 2010 21:45:36 GMT
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;
                 }
 



Mime
View raw message