tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1143022 - in /tomcat/trunk: java/org/apache/catalina/tribes/io/XByteBuffer.java test/org/apache/catalina/tribes/io/TestXByteBuffer.java
Date Tue, 05 Jul 2011 12:25:39 GMT
Author: markt
Date: Tue Jul  5 12:25:38 2011
New Revision: 1143022

URL: http://svn.apache.org/viewvc?rev=1143022&view=rev
Log:
Based on current usage within Tomcat, message length of 0 should result in null.
Populate the test for this and ensure the test passes.

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/io/XByteBuffer.java
    tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/io/XByteBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/io/XByteBuffer.java?rev=1143022&r1=1143021&r2=1143022&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/io/XByteBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/io/XByteBuffer.java Tue Jul  5 12:25:38 2011
@@ -561,7 +561,7 @@ public class XByteBuffer
         invokecount.addAndGet(1);
         Object message = null;
         if ( cls == null ) cls = new ClassLoader[0];
-        if (data != null) {
+        if (data != null && length > 0) {
             InputStream  instream = new ByteArrayInputStream(data,offset,length);
             ObjectInputStream stream = null;
             stream = (cls.length>0)? new ReplicationStream(instream,cls):new ObjectInputStream(instream);

Modified: tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java?rev=1143022&r1=1143021&r2=1143022&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java Tue Jul  5 12:25:38
2011
@@ -21,7 +21,8 @@ import junit.framework.TestCase;
 public class TestXByteBuffer extends TestCase {
 
     public void testEmptyArray() throws Exception {
-        // TODO
+        Object obj = XByteBuffer.deserialize(new byte[0]);
+        assertNull(obj);
     }
 
     public void testSerializationString() throws Exception {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message