User: starksm
Date: 01/10/02 19:37:11
Modified: src/main/org/jboss/mq Tag: Branch_2_4 SpyBytesMessage.java
Log:
Merge the fix for NPE on externalization from main
Revision Changes Path
No revision
No revision
1.2.2.2 +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.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- SpyBytesMessage.java 2001/08/23 03:57:08 1.2.2.1
+++ SpyBytesMessage.java 2001/10/03 02:37:11 1.2.2.2
@@ -18,7 +18,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @created August 16, 2001
- * @version $Revision: 1.2.2.1 $
+ * @version $Revision: 1.2.2.2 $
*/
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]
https://lists.sourceforge.net/lists/listinfo/jboss-development