Author: clebert.suconic(a)jboss.com
Date: 2009-08-27 17:58:51 -0400 (Thu, 27 Aug 2009)
New Revision: 7929
Modified:
trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
trunk/tests/src/org/hornetq/tests/integration/jms/largemessage/JMSLargeMessageTest.java
Log:
Small tweak.. improving error message
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2009-08-27 21:50:45 UTC (rev
7928)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2009-08-27 21:58:51 UTC (rev
7929)
@@ -300,8 +300,7 @@
for (Map.Entry<String, Object> entry : coreMessage.entrySet())
{
- if (entry.getKey().equals("messageID") ||
- entry.getKey().equals("destination") ||
+ if (entry.getKey().equals("messageID") ||
entry.getKey().equals("destination") ||
entry.getKey().equals("type") ||
entry.getKey().equals("durable") ||
entry.getKey().equals("expiration") ||
@@ -316,7 +315,7 @@
if (value instanceof SimpleString)
{
jmsMessage.put(entry.getKey(), value.toString());
- }
+ }
else
{
jmsMessage.put(entry.getKey(), value);
@@ -1102,13 +1101,13 @@
if (JMS_HORNETQ_OUTPUT_STREAM.equals(name))
{
setOutputStream((OutputStream)value);
-
+
return;
}
else if (JMS_HORNETQ_SAVE_STREAM.equals(name))
{
saveToOutputStream((OutputStream)value);
-
+
return;
}
@@ -1117,7 +1116,7 @@
if (JMS_HORNETQ_INPUT_STREAM.equals(name))
{
setInputStream((InputStream)value);
-
+
return;
}
@@ -1310,7 +1309,16 @@
{
if (propertiesReadOnly)
{
- throw new MessageNotWriteableException("Message is read-only");
+ if (name.equals(JMS_HORNETQ_INPUT_STREAM))
+ {
+ throw new MessageNotWriteableException("You cannot set the Input Stream
on received messages. Did you mean " + JMS_HORNETQ_OUTPUT_STREAM +
+ " or " +
+ JMS_HORNETQ_SAVE_STREAM +
"?");
+ }
+ else
+ {
+ throw new MessageNotWriteableException("Message is read-only");
+ }
}
if (name == null)
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/largemessage/JMSLargeMessageTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/jms/largemessage/JMSLargeMessageTest.java 2009-08-27
21:50:45 UTC (rev 7928)
+++
trunk/tests/src/org/hornetq/tests/integration/jms/largemessage/JMSLargeMessageTest.java 2009-08-27
21:58:51 UTC (rev 7929)
@@ -23,6 +23,7 @@
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
+import javax.jms.MessageNotWriteableException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
@@ -305,6 +306,15 @@
}
};
+
+ try
+ {
+ rm.setObjectProperty("JMS_HQ_InputStream",
createFakeLargeStream(100));
+ fail("Exception expected!");
+ }
+ catch (MessageNotWriteableException expected)
+ {
+ }
rm.setObjectProperty("JMS_HQ_SaveStream", out);
Show replies by date