Changeset 627

Show
Ignore:
Timestamp:
08/07/07 15:50:18 (1 year ago)
Author:
sacha
Message:

better handling if encryption fails

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/taskers/hefeweizen_tasker_application_encrypt_ebXML_message.rb

    r604 r627  
    139139      def run 
    140140 
     141        success = 0 
     142 
    141143        if (FileTest.exists?(@parameters_file_path) && FileTest.readable?(@parameters_file_path) &&  
    142144            FileTest.exists?(@ebXML_message_file_path) && FileTest.readable?(@ebXML_message_file_path)) then 
     
    168170        files_to_delete, files_to_repackage = encrypt content_hash, template_filename, files_to_delete 
    169171 
    170         # repackage 
    171         @logger.debug "#{me}: Repackaging the encrypted content of the ebXML message into a new ebXML message." if @debug 
    172         new_ebXML_message_file_path = repackage files_to_repackage 
     172        unless files_to_delete == nil or files_to_repackage == nil then 
     173          # repackage 
     174          @logger.debug "#{me}: Repackaging the encrypted content of the ebXML message into a new ebXML message." if @debug 
     175          new_ebXML_message_file_path = repackage files_to_repackage 
     176        else 
     177          success = -1 
     178        end 
    173179 
    174180        command_hash = { 
     
    177183          "b2b_system_name" => @b2b_system_name, 
    178184          "command" => "encrypt ebXML message done", 
    179           "new_ebXML_message_file_path" => new_ebXML_message_file_path
     185          "new_ebXML_message_file_path" => (new_ebXML_message_file_path || '')
    180186          "state_expectation" => @state_expectation, 
    181187          "uuid" => HefeWeizen::HefeWeizenLibrary::HefeWeizenUUID.uuid, 
     
    183189        } 
    184190         
    185         success = 0 
    186191        if success == 0 then 
    187192          command_hash['status'] = "OK" 
     
    195200        HefeWeizen::HefeWeizenLibrary::Execution.write_to_pipe command, @pipe_to_ania 
    196201 
    197         FileUtils.rm files_to_delete 
    198  
    199         exit 0 
     202        FileUtils.rm files_to_delete unless files_to_delete.empty? 
    200203 
    201204        return 0 
     
    287290          else 
    288291            puts "ERROR encryption" 
     292            return nil, nil 
    289293          end 
    290294        }