2 Replies Latest reply on Jul 15, 2009 10:48 AM by Adrian Woodhead

    session.createTextMessage() returns null?

    Adrian Woodhead Newbie

      I've noticed some strange behaviour in JBM 2.0.0.BETA3. We have a client application which queues up messages and sends them periodically to a topic. Sometimes the client gets into a strange state where:

      message = session.createTextMessage();

      returns null. I've never seen this happen before. The strange thing is that it doesn't happen on every call to createTextMessage. It will work for a few calls, then return null, then work again for a few more etc. It also doesn't happen all the time, our other client application running the same code at the same time does not exhibit this behaviour. In what cases would this method return null? The spec says nothing about this other than that a JMSException should be throw if an error occurs creating the message.

        • 1. Re: session.createTextMessage() returns null?
          Tim Fox Master

          Are you sure it's really returning null?

          The code from JBossSession::createTextMessage is just this:

          public TextMessage createTextMessage() throws JMSException
           return new JBossTextMessage(session);

          So I don't see how any well behaved JVM could return null, even under error conditions. If the creation of the text message proceeds you'll get a non null object. If it throws an exception, then an exception should be thrown from the method.

          • 2. Re: session.createTextMessage() returns null?
            Adrian Woodhead Newbie

            Yeah, you are right, that code can't return null. I will have another look at our code, my guess is that due to the number of deploys we have done recently with different versions there is a mismatch in line numbers which is confusing the issue here. Sorry about that.