From 8f26f2c51d886c0cf28636929ef2a9bddca9871c Mon Sep 17 00:00:00 2001 From: Tomek Melissa Date: Thu, 18 Oct 2018 12:41:14 +0200 Subject: [PATCH] Added error message when input file cannot be identified in Manifest file of package template. --- Job.Import/Import.cs | 10 +++++--- Job.Import/Properties/Resources.Designer.cs | 28 ++++++++++++++------- Job.Import/Properties/Resources.resx | 7 ++++-- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Job.Import/Import.cs b/Job.Import/Import.cs index 56a8c3b..d69ac84 100644 --- a/Job.Import/Import.cs +++ b/Job.Import/Import.cs @@ -192,9 +192,13 @@ namespace RecurringIntegrationsScheduler.Job FileStream zipToOpen = null; ZipArchive archive = null; - if (!String.IsNullOrEmpty(_settings.PackageTemplate)) + if (!string.IsNullOrEmpty(_settings.PackageTemplate)) { fileNameInPackage = GetFileNameInPackage(); + if (!string.IsNullOrEmpty(fileNameInPackage)) + { + throw new Exception(string.Format(Resources.Job_0_Please_check_your_package_template_Input_file_name_in_Manifest_cannot_be_identified, _context.JobDetail.Key)); + } } while (InputQueue.TryDequeue(out DataMessage dataMessage)) @@ -228,7 +232,7 @@ namespace RecurringIntegrationsScheduler.Job if (entry != null) { entry.Delete(); - Log.WarnFormat(CultureInfo.InvariantCulture, string.Format(Resources.Package_template_contains_input_file_0_Please_remove_it_from_the_template, fileNameInPackage)); + Log.WarnFormat(CultureInfo.InvariantCulture, string.Format(Resources.Job_0_Package_template_contains_input_file_1_Please_remove_it_from_the_template, _context.JobDetail.Key, fileNameInPackage)); } // Update Manifest file with the original file name for end-to-end traceability. Use the new file name in the rest of the method. @@ -435,7 +439,7 @@ namespace RecurringIntegrationsScheduler.Job if (entry != null) { entry.Delete(); - Log.WarnFormat(CultureInfo.InvariantCulture, string.Format(Resources.Package_template_contains_input_file_0_Please_remove_it_from_the_template, fileNameInPackage)); + Log.WarnFormat(CultureInfo.InvariantCulture, string.Format(Resources.Job_0_Package_template_contains_input_file_1_Please_remove_it_from_the_template, fileNameInPackage)); } return fileNameInPackage; diff --git a/Job.Import/Properties/Resources.Designer.cs b/Job.Import/Properties/Resources.Designer.cs index 0677c7f..c25f0a8 100644 --- a/Job.Import/Properties/Resources.Designer.cs +++ b/Job.Import/Properties/Resources.Designer.cs @@ -141,6 +141,25 @@ namespace RecurringIntegrationsScheduler.Job.Properties { } } + /// + /// Looks up a localized string similar to Job: {0} Package template contains input file: {1}. Please remove it from the template.. + /// + internal static string Job_0_Package_template_contains_input_file_1_Please_remove_it_from_the_template { + get { + return ResourceManager.GetString("Job_0_Package_template_contains_input_file_1_Please_remove_it_from_the_template", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job: {0} Please check your package template. Input file name in Manifest cannot be identified.. + /// + internal static string Job_0_Please_check_your_package_template_Input_file_name_in_Manifest_cannot_be_identified { + get { + return ResourceManager.GetString("Job_0_Please_check_your_package_template_Input_file_name_in_Manifest_cannot_be_id" + + "entified", resourceCulture); + } + } + /// /// Looks up a localized string similar to Job: {0}. Retrying HTTP operation. Exception : {1}. /// @@ -221,14 +240,5 @@ namespace RecurringIntegrationsScheduler.Job.Properties { return ResourceManager.GetString("Job_0_was_paused_indefinitely", resourceCulture); } } - - /// - /// Looks up a localized string similar to Package template contains input file: {0}. Please remove it from the template.. - /// - internal static string Package_template_contains_input_file_0_Please_remove_it_from_the_template { - get { - return ResourceManager.GetString("Package_template_contains_input_file_0_Please_remove_it_from_the_template", resourceCulture); - } - } } } diff --git a/Job.Import/Properties/Resources.resx b/Job.Import/Properties/Resources.resx index ab0b752..d4e23b2 100644 --- a/Job.Import/Properties/Resources.resx +++ b/Job.Import/Properties/Resources.resx @@ -159,8 +159,8 @@ Delay upload of next file for {0} seconds - - Package template contains input file: {0}. Please remove it from the template. + + Job: {0} Package template contains input file: {1}. Please remove it from the template. Job: {0}. Retrying HTTP operation. Exception : {1} @@ -174,4 +174,7 @@ Job: {0} was paused indefinitely. + + Job: {0} Please check your package template. Input file name in Manifest cannot be identified. + \ No newline at end of file