Author: fhanik Date: Tue May 30 05:34:03 2006 New Revision: 410260 URL: http://svn.apache.org/viewvc?rev=410260&view=rev Log: Avoid NPE
Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/ByteMessage.java Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/ByteMessage.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/ByteMessage.java?rev=410260&r1=410259&r2=410260&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/ByteMessage.java (original) +++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/ByteMessage.java Tue May 30 05:34:03 2006 @@ -1,12 +1,12 @@ /* * Copyright 1999,2004-2005 The Apache Software Foundation. - * + * * Licensed 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. @@ -25,8 +25,8 @@ * A byte message is not serialized and deserialized by the channel * instead it is sent as a byte array<br> * By default Tribes uses java serialization when it receives an object - * to be sent over the wire. Java serialization is not the most - * efficient of serializing data, and Tribes might not even + * to be sent over the wire. Java serialization is not the most + * efficient of serializing data, and Tribes might not even * have access to the correct class loaders to deserialize the object properly. * <br> * The ByteMessage class is a class where the channel when it receives it will @@ -44,15 +44,15 @@ * Storage for the message to be sent */ private byte[] message; - - + + /** * Creates an empty byte message * Constructor also for deserialization */ public ByteMessage() { } - + /** * Creates a byte message wit h * @param data byte[] - the message contents @@ -60,7 +60,7 @@ public ByteMessage(byte[] data) { message = data; } - + /** * Returns the message contents of this byte message * @return byte[] - message contents, can be null @@ -68,7 +68,7 @@ public byte[] getMessage() { return message; } - + /** * Sets the message contents of this byte message * @param message byte[] @@ -76,7 +76,7 @@ public void setMessage(byte[] message) { this.message = message; } - + /** * @see java.io.Externalizable#readExternal * @param in ObjectInput @@ -87,7 +87,7 @@ message = new byte[length]; in.read(message,0,length); } - + /** * @see java.io.Externalizable#writeExternal * @param out ObjectOutput @@ -95,7 +95,7 @@ */ public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(message!=null?message.length:0); - out.write(message,0,message.length); + if ( message!=null ) out.write(message,0,message.length); } -} \ No newline at end of file +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]