java.lang.NumberFormatException silently ignored in 
MessageListener.onMessage(Message message)
----------------------------------------------------------------------------------------------

                 Key: QPID-906
                 URL: https://issues.apache.org/jira/browse/QPID-906
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: M2.1
         Environment: JDK 1.6
            Reporter: Alasdair MacLeod
            Priority: Minor


If the property is missing the following code will generate an exception:
                        Message msg = consumer.receive();
                        System.out.println ("Received message 
["+msg.getIntProperty("sequence")+"] sent to "+msg.getJMSDestination());  
//This works

Exception in thread "main" java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Byte.parseByte(Unknown Source)
        at java.lang.Byte.valueOf(Unknown Source)
        at java.lang.Byte.valueOf(Unknown Source)
        at 
org.apache.qpid.client.message.JMSHeaderAdapter.getByte(JMSHeaderAdapter.java:171)
        at 
org.apache.qpid.client.message.JMSHeaderAdapter.getShort(JMSHeaderAdapter.java:185)
        at 
org.apache.qpid.client.message.JMSHeaderAdapter.getInteger(JMSHeaderAdapter.java:198)
        at 
org.apache.qpid.client.message.AbstractJMSMessage.getIntProperty(AbstractJMSMessage.java:361)
        at VerySimpleReceive.receiveLoop(VerySimpleReceive.java:94)
        at VerySimpleReceive.main(VerySimpleReceive.java:71)

If the same getIntProperty() is called in a MessageListener's onMessage() 
method then the exception is not reported and the application continues.  I 
would expect at the very least that the error would be logged to standard error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to