From 5904264927fadc9b0860cd1256380ecd471df8fe Mon Sep 17 00:00:00 2001 From: agibert Date: Mon, 5 Jan 2009 17:32:49 +0000 Subject: [PATCH] Fix MQMessage character set handling, Fix character set error handling. --- MQSSave.java | 57 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/MQSSave.java b/MQSSave.java index 9ffcaf1..978bbda 100644 --- a/MQSSave.java +++ b/MQSSave.java @@ -1,7 +1,7 @@ // $RCSfile: MQSSave.java,v $ -// $Revision: 1.19 $ +// $Revision: 1.20 $ // $Name: $ -// $Date: 2008/12/18 17:25:42 $ +// $Date: 2009/01/05 17:32:49 $ // $Author: agibert $ /* @@ -35,9 +35,9 @@ import java.text.*; public class MQSSave { - private String MQSSave_Revision = "$Revision: 1.19 $"; + private String MQSSave_Revision = "$Revision: 1.20 $"; private String MQSSave_Tag = "$Name: $"; - private String MQSSave_Date = "$Date: 2008/12/18 17:25:42 $"; + private String MQSSave_Date = "$Date: 2009/01/05 17:32:49 $"; private String MQSSave_Author = "$Author: agibert $"; private MQQueueManager QMng = null; private String QMng_Name = ""; @@ -594,8 +594,6 @@ public class MQSSave { if( CC_Error) { - CC_Error = false; - Counter_Print( "*"); Msg_Error_Nb++; @@ -628,37 +626,50 @@ public class MQSSave try { // input_msg.format = MQC.MQFMT_STRING; + input_msg.characterSet = Character_Set; /* Loop while Msg_Count not reatch */ while( Msg_Get( input_msg, msg_id, Msg_Skip, Msg_Count, get_first)) { get_first = false; - if( msg_id >= Msg_Skip) + if( CC_Error == false) { - /* This message is not skiped */ + /* This message is not in error */ - if( Msg_Saved_Nb > 1) + if( msg_id >= Msg_Skip) { - Output_File.write( Message_Break.getBytes()); - } + /* This message is not skiped */ - buffer = new byte[ input_msg.getMessageLength()]; - input_msg.readFully( buffer); + if( Msg_Saved_Nb > 1) + { + Output_File.write( Message_Break.getBytes()); + } + + buffer = new byte[ input_msg.getMessageLength()]; + input_msg.readFully( buffer); - if( Trim_Mode) - { - String buffer_string = new String( buffer).trim(); - buffer = buffer_string.getBytes(); - } - - Output_File.write( buffer, 0, buffer.length); + if( Trim_Mode) + { + String buffer_string = new String( buffer).trim(); + buffer = buffer_string.getBytes(); + } + + Output_File.write( buffer, 0, buffer.length); - if( Copy_Mode == false ) - { - MQSDelete_Msg( input_msg); + if( Copy_Mode == false ) + { + MQSDelete_Msg( input_msg); + } } } + else + { + /* This message is in error */ + + CC_Error = false; + } + msg_id++; }