Skip to content

Commit 5fec6b9

Browse files
committed
Don't log error if info for deleted marker is not found
Its possible that a marker is deleted, while its info is being retrieved. This will produce a logged error such as: "Marker id 6922 not found.", while the caller continues working without the info. In this case, the logged error is not necessary - the marker is gone, not being able to retrieve its info is expected behavior. This change adjusts MarkerUtilities to not log an error for a not found Marker, if the marker is not existing at the time of catching the respective exception. Fixes: #2219
1 parent 68371cb commit 5fec6b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/MarkerUtilities.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import org.eclipse.core.resources.IMarker;
3333
import org.eclipse.core.resources.IResource;
34+
import org.eclipse.core.resources.IResourceStatus;
3435
import org.eclipse.core.resources.IWorkspace;
3536
import org.eclipse.core.resources.IWorkspaceRunnable;
3637
import org.eclipse.core.resources.ResourcesPlugin;
@@ -258,7 +259,11 @@ public static String getMarkerType(IMarker marker) {
258259
try {
259260
return marker.getType();
260261
} catch (CoreException x) {
261-
handleCoreException(x);
262+
// check if the marker marker was deleted and an exception was thrown due to that
263+
boolean deletedMarkerNotFound = x.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND && !marker.exists();
264+
if (!deletedMarkerNotFound) {
265+
handleCoreException(x);
266+
}
262267
}
263268
return null;
264269
}

0 commit comments

Comments
 (0)