Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-906

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Later
    • M2.1
    • JIRA Cleanup
    • JMS AMQP 0-x
    • None
    • JDK 1.6

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            alasdair Alasdair MacLeod
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: