[jboss-cvs] JBoss Messaging SVN: r5001 - in branches/Branch_1_4: tests/src/org/jboss/test/messaging/jms and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 22 06:54:10 EDT 2008
Author: timfox
Date: 2008-09-22 06:54:10 -0400 (Mon, 22 Sep 2008)
New Revision: 5001
Added:
branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ZeroByteBytesMessageTest.java
Modified:
branches/Branch_1_4/src/main/org/jboss/jms/message/JBossBytesMessage.java
Log:
https://jira.jboss.org/jira/browse/JBMESSAGING-1281
Modified: branches/Branch_1_4/src/main/org/jboss/jms/message/JBossBytesMessage.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/message/JBossBytesMessage.java 2008-09-22 10:34:38 UTC (rev 5000)
+++ branches/Branch_1_4/src/main/org/jboss/jms/message/JBossBytesMessage.java 2008-09-22 10:54:10 UTC (rev 5001)
@@ -683,6 +683,10 @@
// read it
if (bais == null)
{
+ if (payloadAsByteArray == null)
+ {
+ payloadAsByteArray = new byte[] {};
+ }
bais = new ByteArrayInputStream(payloadAsByteArray);
dis = new DataInputStream(bais);
}
Added: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ZeroByteBytesMessageTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ZeroByteBytesMessageTest.java (rev 0)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ZeroByteBytesMessageTest.java 2008-09-22 10:54:10 UTC (rev 5001)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.messaging.jms;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+/**
+ *
+ * A ZeroByteBytesMessageTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * Created 22 Sep 2008 11:46:57
+ *
+ *
+ */
+public class ZeroByteBytesMessageTest extends JMSTestCase
+{
+ // Constants -----------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public ZeroByteBytesMessageTest(String name)
+ {
+ super(name);
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ // https://jira.jboss.org/jira/browse/JBMESSAGING-1281
+ public void testZeroByteBytesMessage() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ conn.start();
+
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = session.createProducer(queue1);
+
+ MessageConsumer cons = session.createConsumer(queue1);
+
+ BytesMessage bm = session.createBytesMessage();
+
+ prod.send(bm);
+
+ BytesMessage bm2 = (BytesMessage)cons.receive(10000);
+
+ assertNotNull(bm2);
+
+ byte[] bytes2 = new byte[] {};
+
+ bm2.readBytes(bytes2);
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+}
+
More information about the jboss-cvs-commits
mailing list