From bca91bb068926562d49ed145823f705e887d4475 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Wed, 20 Feb 2008 21:47:18 +0000 Subject: [PATCH] check for null byte passed as parameter git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@629623 13f79535-47bb-0310-9956-ffa450edef68 --- .../transport/tcp/TcpBufferedOutputStream.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java index dc6c4779e6..4031b90467 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java @@ -82,14 +82,16 @@ public class TcpBufferedOutputStream extends FilterOutputStream { * @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); + } } }