Skip to content

Commit

Permalink
More robust error reporting if file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandKluge committed Mar 15, 2018
1 parent 2286adc commit 8f8ecb1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
Expand Down Expand Up @@ -57,7 +58,8 @@ public final void report(final IStatus status) {
}

protected void reportLeafStatus(final IStatus status) throws CoreException {
final IMarker validationMarker = file.createMarker(WorkspaceHelper.MOFLON_PROBLEM_MARKER_ID);
final IResource markedResource = file.exists() ? file : file.getProject();
final IMarker validationMarker = markedResource.createMarker(WorkspaceHelper.MOFLON_PROBLEM_MARKER_ID);
validationMarker.setAttribute(IMarker.MESSAGE, status.getMessage());
validationMarker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
validationMarker.setAttribute(IMarker.SEVERITY,
Expand Down

0 comments on commit 8f8ecb1

Please sign in to comment.