@ Override public void clearBody ( ) throws javax . jms . JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "clearBody" ) ; // Set the message into write-only mode, handle generic actions super . clearBody ( ) ; // Clear the locally stored reference to body of the message, and ensure the // 'read' stream is set to null dataBuffer = null ; dataStart = 0 ; // @P2A readStream = null ; // remove the encoding and character set properties as these pertain to the // body which is being cleared. // SIB0121: also clear the underlying MFP payload if ( jsBytesMsg != null ) { jsBytesMsg . setBytes ( null ) ; jsBytesMsg . setObjectProperty ( ApiJmsConstants . ENCODING_PROPERTY , null ) ; jsBytesMsg . setObjectProperty ( ApiJmsConstants . CHARSET_PROPERTY , null ) ; } integerEncoding = ApiJmsConstants . ENC_INTEGER_NORMAL ; // reset to standard Java encoding floatEncoding = ApiJmsConstants . ENC_FLOAT_IEEE_NORMAL ; // reset to standard Java encoding // Invalidate the cached toString object. cachedBytesToString = null ; // This class has different behaviour depending on the whether the // producer might modify the payload after it's been set or not if ( ! producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer might modify the payload after set - encoding is required, so reinitialise encoding relating variables" ) ; // Prepare a new stream for the client to write to _writeBytes = new ByteArrayOutputStream ( ) ; writeStream = new DataOutputStream ( _writeBytes ) ; // Initialise the arrays used to record the position of numeric items integer_count = 0 ; // number of integer items recorded in the current arrays integer_offsets = new int [ ARRAY_SIZE ] ; // offset of start of each numeric item integer_sizes = new int [ ARRAY_SIZE ] ; // length in byte of the item in question if ( integers != null ) integers . removeAllElements ( ) ; // arrays which we filled up are stored in this vector - remove them all if ( float_offsets != null ) float_offsets . removeAllElements ( ) ; if ( float_values != null ) float_values . removeAllElements ( ) ; // Ensure that the new data gets exported when the time comes. bodySetInJsMsg = false ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Producer has promised not to modify payload - ensure write streams used for encoding are null" ) ; // Ensure the write stream variables are null - they are never used when the // producer has promised not to modify the payload after it's been set _writeBytes = null ; writeStream = null ; // Ensure the producer promise flag is checked correctly in the writeBytes method writeByteArrayCalled = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "clearBody" ) ; }
Clear out the message body . All other parts of the message are left untouched .