User: dmaplesden
  Date: 01/08/26 14:15:42

  Modified:    src/main/org/jboss/mq SpyBytesMessage.java
  Log:
  Fix null pointer exception in checkRead after receiving an empty bytes message from 
server.
  
  Revision  Changes    Path
  1.3       +26 -19    jbossmq/src/main/org/jboss/mq/SpyBytesMessage.java
  
  Index: SpyBytesMessage.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/SpyBytesMessage.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpyBytesMessage.java      2001/08/17 03:04:01     1.2
  +++ SpyBytesMessage.java      2001/08/26 21:15:42     1.3
  @@ -18,7 +18,7 @@
    *
    * @author     Norbert Lataille ([EMAIL PROTECTED])
    * @created    August 16, 2001
  - * @version    $Revision: 1.2 $
  + * @version    $Revision: 1.3 $
    */
   public class SpyBytesMessage
          extends SpyMessage
  @@ -414,12 +414,19 @@
   
      public void writeExternal( java.io.ObjectOutput out )
         throws java.io.IOException {
  +      byte [] arrayToSend = null;
  +      if ( !msgReadOnly ) {
  +         p.flush();
  +         arrayToSend = ostream.toByteArray();
  +      }else{
  +        arrayToSend = InternalArray;
  +      }
         super.writeExternal( out );
  -      if ( InternalArray == null ) {
  -         out.writeInt( -1 );
  +      if ( arrayToSend == null ) {
  +         out.writeInt( 0 ); //pretend to be empty array
         } else {
  -         out.writeInt( InternalArray.length );
  -         out.write( InternalArray );
  +         out.writeInt( arrayToSend.length );
  +         out.write( arrayToSend );
         }
      }
   
  @@ -436,20 +443,20 @@
      }
   
      // Private -------------------------------------------------------
  -   private void writeObject( java.io.ObjectOutputStream out )
  -      throws IOException {
  -      if ( !msgReadOnly ) {
  -         p.flush();
  -         InternalArray = ostream.toByteArray();
  -      }
  -      out.writeObject( InternalArray );
  -   }
  -
  -   private void readObject( java.io.ObjectInputStream in )
  -      throws IOException, ClassNotFoundException {
  -      InternalArray = ( byte[] )in.readObject();
  -   }
  -
  +//   private void writeObject( java.io.ObjectOutputStream out )
  +//      throws IOException {
  +//      if ( !msgReadOnly ) {
  +//         p.flush();
  +//         InternalArray = ostream.toByteArray();
  +//      }
  +//      out.writeObject( InternalArray );
  +//   }
  +//
  +//   private void readObject( java.io.ObjectInputStream in )
  +//      throws IOException, ClassNotFoundException {
  +//      InternalArray = ( byte[] )in.readObject();
  +//   }
  +//
      private void checkRead()
         throws JMSException {
         if ( !msgReadOnly ) {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to