Verbesserung der Fehlerbehandlung und Protokollierung
Neue Konstanten und Wiederholungslogik in `ActiveDirectoryInterface.vb` hinzugefügt, um vorübergehende AD-Fehler zu handhaben. Funktion `IsTransientAdException` implementiert. Verbesserte Benutzer-Synchronisierungslogik in `SyncUsers.MSSQL.vb`, um unnötige Löschvorgänge zu vermeiden. Versionsnummern in `AssemblyInfo.vb` aktualisiert. Warnmeldungen und Index-Typ-Überprüfung in `Windream.vb` verbessert. NLog-Verwaltung in `Windream.vbproj` auf NuGet umgestellt und entsprechende Referenz aus `packages.config` entfernt.
This commit is contained in:
@@ -1244,7 +1244,7 @@ Public Class Windream
|
||||
Dim oWMObject As IWMObject6 = GetFileByPath(Path)
|
||||
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File {0} could not be locked", Path)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1254,22 +1254,26 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
If Not IsNothing(oType) Then
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Else
|
||||
' IsNothing() schlägt bei Integer (Werttyp) nie an – stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndex aborted for file '{1}'", pIndexName, Path)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value '{0}' for index '{1}' on file '{2}'", pStringValue, pIndexName, Path)
|
||||
_logger.Error(ex)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
@@ -1285,6 +1289,7 @@ Public Class Windream
|
||||
_logger.Warn("File '{0}' does not exist", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oWMObject As IWMObject6
|
||||
|
||||
Try
|
||||
@@ -1295,9 +1300,10 @@ Public Class Windream
|
||||
_logger.Warn(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
'Lock WMObject for changes
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File '{0}' could not be locked", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1307,9 +1313,18 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
Dim oConvertedValues As New List(Of String)
|
||||
Dim oArray As Object
|
||||
|
||||
' Gleicher Bug wie in SetFileIndex: Integer-Werttyp – IsNothing() greift nie
|
||||
' Stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndexLoS aborted for file '{1}'", pIndexName, pPath)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
_logger.Debug("SetFileIndexLoS '{0}' - Indextype: {1} - Values.Count: {2} ... ", pIndexName, oType, pAttributeValues.Count)
|
||||
|
||||
Dim oArray As Object
|
||||
ReDim oArray(pAttributeValues.Count - 1)
|
||||
|
||||
For oIndex = 0 To pAttributeValues.Count - 1
|
||||
@@ -1322,13 +1337,14 @@ Public Class Windream
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", pPath)
|
||||
_logger.Warn("File '{0}' could not be unlocked", pPath)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value for index '{0}' on file '{1}'", pIndexName, pPath)
|
||||
_logger.Error(ex)
|
||||
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user