You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2008/02/20 22:47:18 UTC

svn commit: r629623 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java

Author: rajdavies
Date: Wed Feb 20 13:47:18 2008
New Revision: 629623

URL: http://svn.apache.org/viewvc?rev=629623&view=rev
Log:
check for null byte passed as parameter

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java?rev=629623&r1=629622&r2=629623&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java Wed Feb 20 13:47:18 2008
@@ -82,14 +82,16 @@
      * @throws IOException
      */
     public void write(byte b[], int off, int len) throws IOException {
-        if ((bufferlen - count) < len) {
-            flush();
-        }
-        if (buffer.length >= len) {
-            System.arraycopy(b, off, buffer, count, len);
-            count += len;
-        } else {
-            out.write(b, off, len);
+        if (b != null) {
+            if ((bufferlen - count) < len) {
+                flush();
+            }
+            if (buffer.length >= len) {
+                System.arraycopy(b, off, buffer, count, len);
+                count += len;
+            } else {
+                out.write(b, off, len);
+            }
         }
     }