Program: 135866
Project: 135866
Buggy source:
/** 
 * THE REAL EXECUTE METHOD This method is called by a synchronous job launched in the execute method  to do most of the work of executing the Decompose Proof command.
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object realExecute() throws ExecutionException {
  Activator.getDefault().logDebug("String_Node_Str");
  Vector<SemanticNode> assumes;
  SemanticNode goal;
  String[] blankLine=new String[]{"String_Node_Str"};
  String[] oneline=new String[]{"String_Node_Str"};
  if (this.windowShell != null) {
    if (!this.windowShell.isDisposed()) {
      System.out.println("String_Node_Str");
      return null;
    }
  }
  boolean proceed=UIHelper.promptUserForDirtyModules();
  if (!proceed) {
    return null;
  }
  if (editor == null) {
    Activator.getDefault().logDebug("String_Node_Str");
    return null;
  }
  editorIFile=((FileEditorInput)editor.getEditorInput()).getFile();
  ParseResult parseResult=ResourceHelper.getValidParseResult(editorIFile);
  if (parseResult == null) {
    parseResult=new ModuleParserLauncher().parseModule(editorIFile,new NullProgressMonitor());
  }
  if (existDirtyModules()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  Spec spec=Activator.getSpecManager().getSpecLoaded();
  if (spec == null || spec.getStatus() != IParseConstants.PARSED) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  if (editor == null) {
    Activator.getDefault().logDebug("String_Node_Str");
    return null;
  }
  editorIFile=((FileEditorInput)editor.getEditorInput()).getFile();
  if (editor.isDirty()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  hasChanged=false;
  chosenSplit=-1;
  needsStepNumber=false;
  andSplitBegin=-1;
  andSplitEnd=-1;
  goalDefinitions=new HashSet<String>();
  assumpDefinitions=new HashSet<String>();
  Location selectedLocation=EditorUtil.getLocationAt(doc,offset,selection.getLength());
  TheoremNode[] allTheorems=moduleNode.getTheorems();
  theorem=null;
  int i=0;
  String moduleFile=moduleNode.stn.getFilename();
  while ((theorem == null) & (i < allTheorems.length)) {
    if (allTheorems[i].stn.getFilename().equals(moduleFile) && EditorUtil.lineLocationContainment(selectedLocation,allTheorems[i].stn.getLocation())) {
      theorem=allTheorems[i];
    }
    i++;
  }
  if (theorem == null) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  step=theorem;
  boolean notDone=true;
  proofLevel=-1;
  proof=step.getProof();
  while (notDone && (proof != null) && (proof instanceof NonLeafProofNode)) {
    LevelNode[] pfsteps=((NonLeafProofNode)proof).getSteps();
    LevelNode foundLevelNode=null;
    i=0;
    proofLevel=stepLevel(pfsteps[0]);
    while ((foundLevelNode == null) && (i < pfsteps.length)) {
      if (EditorUtil.lineLocationContainment(selectedLocation,pfsteps[i].stn.getLocation())) {
        foundLevelNode=pfsteps[i];
      }
      i++;
    }
    if (foundLevelNode == null) {
      notDone=false;
    }
 else     if (!(foundLevelNode instanceof TheoremNode)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
 else {
      step=(TheoremNode)foundLevelNode;
      proof=step.getProof();
    }
  }
  if (step.isSuffices()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  int level=this.proofLevel;
  if (level < 0) {
    level=0;
  }
  proofLevelString="String_Node_Str" + (level + 1) + "String_Node_Str";
  SyntaxTreeNode nd=(SyntaxTreeNode)step.stn;
  if (step == theorem) {
    stepNumber=null;
  }
 else {
    stepNumber=nd.getHeirs()[0].image.toString();
    if (stepNumber.indexOf('>') == stepNumber.length() - 1) {
      stepNumber=null;
    }
 else {
      i=stepNumber.indexOf('>') + 1;
      while ((i < stepNumber.length() && (Character.isLetterOrDigit(stepNumber.charAt(i)) || (stepNumber.charAt(i) == '_')))) {
        i++;
      }
      if (i < stepNumber.length()) {
        stepNumber=stepNumber.substring(0,i);
      }
    }
  }
  stepColumn=nd.getLocation().beginColumn();
  if ((proof != null) && !(proof instanceof LeafProofNode)) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  try {
    stepRep=new NodeRepresentation(doc,step);
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
    System.out.println("String_Node_Str");
  }
  LevelNode thm=step.getTheorem();
  if (thm instanceof AssumeProveNode) {
    hasAssumes=true;
    SemanticNode[] assump=((AssumeProveNode)thm).getAssumes();
    assumes=new Vector<SemanticNode>();
    assumeReps=new Vector<NodeRepresentation>();
    int rowOfLastNew=-1;
    for (i=0; i < assump.length; i++) {
      if (assump[i] instanceof AssumeProveNode) {
        MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
        return null;
      }
      assumes.add(assump[i]);
      NodeRepresentation nodeRep=stepRep.subNodeRep(assump[i],assumeReps,null,null);
      if (nodeRep.nodeType == NodeRepresentation.NEW_NODE) {
        Location loc=nodeRep.semanticNode.stn.getLocation();
        if (loc.beginLine() == loc.endLine()) {
          if (loc.beginLine() == rowOfLastNew) {
            assumeReps.elementAt(i - 1).onSameLineAsNext=true;
          }
          rowOfLastNew=loc.beginLine();
        }
 else {
          rowOfLastNew=-1;
        }
      }
 else {
        rowOfLastNew=-1;
      }
      assumeReps.add(nodeRep);
      goal=((AssumeProveNode)thm).getProve();
      if (!(goal instanceof OpApplNode)) {
        MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
        return null;
      }
      goalRep=stepRep.subNodeRep(goal,null,null,null);
    }
  }
 else {
    hasAssumes=false;
    assumes=new Vector<SemanticNode>();
    assumeReps=new Vector<NodeRepresentation>();
    if (!(thm instanceof OpApplNode)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
    goal=thm;
    UniqueString goalOpName=null;
    if (goal instanceof OpApplNode) {
      goalOpName=((OpApplNode)goal).getOperator().getName();
    }
    if ((goalOpName == null) || (goalOpName == ASTConstants.OP_qed) || (goalOpName == ASTConstants.OP_pfcase)|| (goalOpName == ASTConstants.OP_have)|| (goalOpName == ASTConstants.OP_pick)|| (goalOpName == ASTConstants.OP_witness)|| (goalOpName == ASTConstants.OP_suffices)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
    goalRep=stepRep.subNodeRep(goal,null,null,null);
  }
  editorIFile.setReadOnly(true);
  raiseWindow();
  Activator.getDefault().logDebug("String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * THE REAL EXECUTE METHOD This method is called by a synchronous job launched in the execute method  to do most of the work of executing the Decompose Proof command.
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
public Object realExecute() throws ExecutionException {
  Activator.getDefault().logDebug("String_Node_Str");
  Vector<SemanticNode> assumes;
  SemanticNode goal;
  String[] blankLine=new String[]{"String_Node_Str"};
  String[] oneline=new String[]{"String_Node_Str"};
  if (this.windowShell != null) {
    if (!this.windowShell.isDisposed()) {
      System.out.println("String_Node_Str");
      return null;
    }
  }
  if (existDirtyModules()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  Spec spec=Activator.getSpecManager().getSpecLoaded();
  if (spec == null || spec.getStatus() != IParseConstants.PARSED) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  if (editor == null) {
    Activator.getDefault().logDebug("String_Node_Str");
    return null;
  }
  editorIFile=((FileEditorInput)editor.getEditorInput()).getFile();
  if (editor.isDirty()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  hasChanged=false;
  chosenSplit=-1;
  needsStepNumber=false;
  andSplitBegin=-1;
  andSplitEnd=-1;
  goalDefinitions=new HashSet<String>();
  assumpDefinitions=new HashSet<String>();
  Location selectedLocation=EditorUtil.getLocationAt(doc,offset,selection.getLength());
  TheoremNode[] allTheorems=moduleNode.getTheorems();
  theorem=null;
  int i=0;
  String moduleFile=moduleNode.stn.getFilename();
  while ((theorem == null) & (i < allTheorems.length)) {
    if (allTheorems[i].stn.getFilename().equals(moduleFile) && EditorUtil.lineLocationContainment(selectedLocation,allTheorems[i].stn.getLocation())) {
      theorem=allTheorems[i];
    }
    i++;
  }
  if (theorem == null) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  step=theorem;
  boolean notDone=true;
  proofLevel=-1;
  proof=step.getProof();
  while (notDone && (proof != null) && (proof instanceof NonLeafProofNode)) {
    LevelNode[] pfsteps=((NonLeafProofNode)proof).getSteps();
    LevelNode foundLevelNode=null;
    i=0;
    proofLevel=stepLevel(pfsteps[0]);
    while ((foundLevelNode == null) && (i < pfsteps.length)) {
      if (EditorUtil.lineLocationContainment(selectedLocation,pfsteps[i].stn.getLocation())) {
        foundLevelNode=pfsteps[i];
      }
      i++;
    }
    if (foundLevelNode == null) {
      notDone=false;
    }
 else     if (!(foundLevelNode instanceof TheoremNode)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
 else {
      step=(TheoremNode)foundLevelNode;
      proof=step.getProof();
    }
  }
  if (step.isSuffices()) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  int level=this.proofLevel;
  if (level < 0) {
    level=0;
  }
  proofLevelString="String_Node_Str" + (level + 1) + "String_Node_Str";
  SyntaxTreeNode nd=(SyntaxTreeNode)step.stn;
  if (step == theorem) {
    stepNumber=null;
  }
 else {
    stepNumber=nd.getHeirs()[0].image.toString();
    if (stepNumber.indexOf('>') == stepNumber.length() - 1) {
      stepNumber=null;
    }
 else {
      i=stepNumber.indexOf('>') + 1;
      while ((i < stepNumber.length() && (Character.isLetterOrDigit(stepNumber.charAt(i)) || (stepNumber.charAt(i) == '_')))) {
        i++;
      }
      if (i < stepNumber.length()) {
        stepNumber=stepNumber.substring(0,i);
      }
    }
  }
  stepColumn=nd.getLocation().beginColumn();
  if ((proof != null) && !(proof instanceof LeafProofNode)) {
    MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
    return null;
  }
  try {
    stepRep=new NodeRepresentation(doc,step);
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
    System.out.println("String_Node_Str");
  }
  LevelNode thm=step.getTheorem();
  if (thm instanceof AssumeProveNode) {
    hasAssumes=true;
    SemanticNode[] assump=((AssumeProveNode)thm).getAssumes();
    assumes=new Vector<SemanticNode>();
    assumeReps=new Vector<NodeRepresentation>();
    int rowOfLastNew=-1;
    for (i=0; i < assump.length; i++) {
      if (assump[i] instanceof AssumeProveNode) {
        MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
        return null;
      }
      assumes.add(assump[i]);
      NodeRepresentation nodeRep=stepRep.subNodeRep(assump[i],assumeReps,null,null);
      if (nodeRep.nodeType == NodeRepresentation.NEW_NODE) {
        Location loc=nodeRep.semanticNode.stn.getLocation();
        if (loc.beginLine() == loc.endLine()) {
          if (loc.beginLine() == rowOfLastNew) {
            assumeReps.elementAt(i - 1).onSameLineAsNext=true;
          }
          rowOfLastNew=loc.beginLine();
        }
 else {
          rowOfLastNew=-1;
        }
      }
 else {
        rowOfLastNew=-1;
      }
      assumeReps.add(nodeRep);
      goal=((AssumeProveNode)thm).getProve();
      if (!(goal instanceof OpApplNode)) {
        MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
        return null;
      }
      goalRep=stepRep.subNodeRep(goal,null,null,null);
    }
  }
 else {
    hasAssumes=false;
    assumes=new Vector<SemanticNode>();
    assumeReps=new Vector<NodeRepresentation>();
    if (!(thm instanceof OpApplNode)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
    goal=thm;
    UniqueString goalOpName=null;
    if (goal instanceof OpApplNode) {
      goalOpName=((OpApplNode)goal).getOperator().getName();
    }
    if ((goalOpName == null) || (goalOpName == ASTConstants.OP_qed) || (goalOpName == ASTConstants.OP_pfcase)|| (goalOpName == ASTConstants.OP_have)|| (goalOpName == ASTConstants.OP_pick)|| (goalOpName == ASTConstants.OP_witness)|| (goalOpName == ASTConstants.OP_suffices)) {
      MessageDialog.openError(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str");
      return null;
    }
    goalRep=stepRep.subNodeRep(goal,null,null,null);
  }
  editorIFile.setReadOnly(true);
  raiseWindow();
  Activator.getDefault().logDebug("String_Node_Str");
  return null;
}