Skip to content
Advertisement

Why does a variable of type com.ibm.jms.JMSTextMessage print truncated content and ellipses (…)?

I would like to understand why a variable of type com.ibm.jms.JMSTextMessage is printed with truncated content and ellipses (…) when converted to string.

I have this code in a JSR223 Sampler in JMeter:

JavaScript

I would like to understand why log.info(msg.toString()) does not print the whole text content and show ellipses after some point (...)

If I do log.info(msg.getText()), I can see the whole text message.

Here is the print outcome in jmeter’s console:

JavaScript

Advertisement

Answer

According to the IBM documentation com.ibm.jms.JMSTextMessage inherits the toString() implementation from com.ibm.jms.JMSMessage and the JavaDoc for that method says:

Gets a String containing a formatted version of the message header.

My guess is that the body is cut off simply because toString() is really just meant to give you the header. However, only IBM would know for sure why it works that way. To be clear, there is no guarantee that toString() will (or should) return the entire body of the message.

If you really want to inspect the body of the text message you should invoke getText(). This method is required to return the body of the text-message according to the JMS JavaDoc as well as IBM’s own JavaDoc. Both state:

Gets the String containing this message’s data. The default value is null.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement