Program: 135996
Project: 135996
Buggy source:
/** 
 * Installs a new marker on the obligation in the message or updates the existing marker on that obligation (if there is one) with the information contained in message. The message location should be for a module in the currently opened spec. If no such module exists, this method returns null. Returns the marker created or updated.
 * @param message must not be null
 */
public static IMarker newObligationStatus(ObligationStatusMessage message){
  Location location=message.getLocation();
  IResource module=ResourceHelper.getResourceByModuleName(location.source());
  if (module != null && module instanceof IFile && module.exists()) {
    FileEditorInput fileEditorInput=new FileEditorInput((IFile)module);
    FileDocumentProvider fileDocumentProvider=new FileDocumentProvider();
    try {
      IMarker[] markers=module.findMarkers(ProverHelper.OBLIGATION_MARKER,false,IResource.DEPTH_ZERO);
      for (int i=0; i < markers.length; i++) {
        if (markers[i].getAttribute(ProverHelper.OBLIGATION_ID,-1) == message.getID()) {
          markers[i].setAttribute(ProverHelper.OBLIGATION_STATUS,message.getStatus());
          markers[i].setAttribute(ProverHelper.OBLIGATION_METHOD,message.getMethod());
          return markers[i];
        }
      }
      IMarker marker=module.createMarker(ProverHelper.OBLIGATION_MARKER);
      marker.setAttribute(ProverHelper.OBLIGATION_ID,message.getID());
      marker.setAttribute(ProverHelper.OBLIGATION_METHOD,message.getMethod());
      marker.setAttribute(ProverHelper.OBLIGATION_STATUS,message.getStatus());
      marker.setAttribute(ProverHelper.OBLIGATION_STRING,message.getObString());
      fileDocumentProvider.connect(fileEditorInput);
      IDocument document=fileDocumentProvider.getDocument(fileEditorInput);
      IRegion obRegion=AdapterFactory.locationToRegion(document,location);
      marker.setAttribute(IMarker.CHAR_START,obRegion.getOffset());
      marker.setAttribute(IMarker.CHAR_END,obRegion.getOffset() + obRegion.getLength());
      return marker;
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
catch (    BadLocationException e) {
      e.printStackTrace();
    }
 finally {
      fileDocumentProvider.disconnect(fileEditorInput);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Installs a new marker on the obligation in the message or updates the existing marker on that obligation (if there is one) with the information contained in message. The message location should be for a module in the currently opened spec. If no such module exists, this method returns null. Returns the marker created or updated.
 * @param message must not be null
 */
public static IMarker newObligationStatus(ObligationStatusMessage message){
  Location location=message.getLocation();
  IResource module=ResourceHelper.getResourceByModuleName(location.source());
  if (module != null && module instanceof IFile && module.exists()) {
    FileEditorInput fileEditorInput=new FileEditorInput((IFile)module);
    FileDocumentProvider fileDocumentProvider=new FileDocumentProvider();
    try {
      IMarker[] markers=module.findMarkers(ProverHelper.OBLIGATION_MARKER,false,IResource.DEPTH_ZERO);
      for (int i=0; i < markers.length; i++) {
        if (markers[i].getAttribute(ProverHelper.OBLIGATION_ID,-1) == message.getID()) {
          markers[i].setAttribute(ProverHelper.OBLIGATION_STATUS,message.getStatus());
          markers[i].setAttribute(ProverHelper.OBLIGATION_METHOD,message.getMethod());
          return markers[i];
        }
      }
      IMarker marker=module.createMarker(ProverHelper.OBLIGATION_MARKER);
      marker.setAttribute(ProverHelper.OBLIGATION_ID,message.getID());
      marker.setAttribute(ProverHelper.OBLIGATION_METHOD,message.getMethod());
      marker.setAttribute(ProverHelper.OBLIGATION_STATUS,message.getStatus());
      marker.setAttribute(ProverHelper.OBLIGATION_STRING,message.getObString());
      fileDocumentProvider.connect(fileEditorInput);
      IDocument document=fileDocumentProvider.getDocument(fileEditorInput);
      IRegion obRegion=AdapterFactory.locationToRegion(document,location);
      marker.setAttribute(IMarker.CHAR_START,obRegion.getOffset());
      marker.setAttribute(IMarker.CHAR_END,obRegion.getOffset() + obRegion.getLength() - 1);
      return marker;
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
catch (    BadLocationException e) {
      e.printStackTrace();
    }
 finally {
      fileDocumentProvider.disconnect(fileEditorInput);
    }
  }
  return null;
}