Handle error while creating checksum

This commit is contained in:
Jonathan Jenne 2021-07-05 13:31:41 +02:00
parent 748c965d48
commit c759ce19a5

View File

@ -10,12 +10,14 @@ Public Class ClassIndexFunctions
Filename = Filename.Replace("'", "''")
End If
Try
oHash = FILESYSTEM.GetChecksum(Filename)
Catch ex As Exception
LOGGER.Error(ex)
oHash = ""
End Try
' If file cannot be accessed, checksum cannot be generated
' In this case, the file should be treated as not yet existing
oHash = FILESYSTEM.GetChecksum(Filename)
If oHash Is Nothing Then
LOGGER.Warn("Checksum for file {0} could not be generated. Treating as new file.", Filename)
Return Nothing
End If
oSQL = "SELECT * FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0 ORDER BY ADDED_WHEN"
Dim oResult As DataTable = ClassDatabase.Return_Datatable_CS(oSQL, MyConnectionString, True)