From e4ba39f19c85eb306ab95a8afbeb8468b8c2799d Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 13 Mar 2019 12:49:17 +0100 Subject: [PATCH] ZUGFeRD: Exit early when there are no files to process --- Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index 5f066ed4..f35c28f6 100644 --- a/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -131,7 +131,6 @@ Public Class ImportZUGFeRDFiles End Function Private Function GroupFiles(Files As List(Of FileInfo)) As Dictionary(Of String, List(Of FileInfo)) - Dim oRegex = New Regex("([\w\d]+)_.+") Dim oGrouped As New Dictionary(Of String, List(Of FileInfo)) If Files.Count = 0 Then @@ -177,7 +176,12 @@ Public Class ImportZUGFeRDFiles Dim oFileCount = oFiles.Count Dim oCurrentFileCount = 0 - _logger.Info("Found {0} files", oFileCount) + If oFileCount = 0 Then + _logger.Info("No files to process.") + Continue For + Else + _logger.Info("Found {0} files", oFileCount) + End If ' Group files by messageId Dim oGrouped As Dictionary(Of String, List(Of FileInfo)) = GroupFiles(oFiles) @@ -209,6 +213,7 @@ Public Class ImportZUGFeRDFiles oMissingProperties = New List(Of String) oCurrentFileCount += 1 + ' Only pdf files are allowed from here on If Not oFile.Name.EndsWith(".pdf") Then _logger.Debug("Skipping non-pdf file {0}", oFile.Name) Continue For