Message.getStringProperty("JMSXProducerTXID") throws 
java.lang.NumberFormatException
------------------------------------------------------------------------------------

                 Key: AMQ-1831
                 URL: https://issues.apache.org/activemq/browse/AMQ-1831
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.1.0
         Environment: Windows XP SP2
            Reporter: Joel Turkel


A  java.lang.NumberFormatException is thrown when attempting to retrieve the 
JMSXProducerTXID from a message. The stack trace is:

Exception in thread "main" java.lang.NumberFormatException: For input string: 
"TX:ID:JTURKEL-690-4629-1214839585805-0:0:1"
        at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:447)
        at java.lang.Integer.<init>(Integer.java:620)
        at 
org.apache.activemq.filter.PropertyExpression$14.evaluate(PropertyExpression.java:147)
        at 
org.apache.activemq.filter.PropertyExpression.evaluate(PropertyExpression.java:194)
        at 
org.apache.activemq.command.ActiveMQMessage.getObjectProperty(ActiveMQMessage.java:447)
        at 
org.apache.activemq.command.ActiveMQMessage.getStringProperty(ActiveMQMessage.java:535)
        at com.queue.test.MQTest.testBug(MQTest.java:41)
        at com.queue.test.ActiveMQTest.main(ActiveMQTest.java:21)

Here is some simple test code to reproduce the problem:

                ConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_USER, 
                                ActiveMQConnection.DEFAULT_PASSWORD, 
ActiveMQConnection.DEFAULT_BROKER_URL)
                Connection connection = connectionFactory.createConnection();   
        
                connection.start();
                Session producerSession = connection.createSession(true, 
Session.SESSION_TRANSACTED);
                MessageProducer producer = 
producerSession.createProducer(producerSession.createQueue("myQueue"));
                TextMessage producerMessage = 
producerSession.createTextMessage("Test Message");
                producer.send(producerMessage);
                producer.close();
                producerSession.commit();
                producerSession.close();
                
                Session consumerSession = connection.createSession(true, 
Session.SESSION_TRANSACTED);
                MessageConsumer consumer = 
consumerSession.createConsumer(consumerSession.createQueue("myQueue"));
                Message consumerMessage = consumer.receive(1000);
                
System.out.println(consumerMessage.getStringProperty("JMSXProducerTXID"));
                consumer.close();
                consumerSession.commit();
                consumerSession.close();

                connection.close();

This problem is quite severe for us since we need the transaction id property 
and would like to certify against ActiveMQ.

-- 
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