Program: 75271
Project: 75271
Buggy source:
/** 
 * End the document. The MoMLParser calls this method once, when it has finished parsing the complete XML document. It is guaranteed that this will be the last method called in the XML parsing process. As a consequence, it is guaranteed that all dependencies between parameters used in the XML description are resolved. This method executes any change requests that may have been made during the parsing process.
 * @exception CancelException If an error occurs parsing one of theparameter values, and the user clicks on "cancel" to cancel the parse.
 */
public void endDocument() throws Exception {
  _processPendingRequests();
  if (_handler != null) {
    _handler.enableErrorSkipping(false);
  }
  if (_undoEnabled && _undoContext != null && _undoContext.hasUndoMoML()) {
    String undoMoML=_undoContext.getUndoMoML();
    if (_undoDebug) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.print(undoMoML);
      System.out.println("String_Node_Str");
    }
    NamedObj context=_current;
    if (context == null) {
      context=_toplevel;
    }
    MoMLUndoEntry newEntry=new MoMLUndoEntry(context,undoMoML);
    UndoStackAttribute undoInfo=UndoStackAttribute.getUndoInfo(context);
    undoInfo.push(newEntry);
    _resetUndo();
  }
  if (_unrecognized != null) {
    StringBuffer warning=new StringBuffer("String_Node_Str");
    Iterator elements=_unrecognized.iterator();
    while (elements.hasNext()) {
      warning.append("String_Node_Str" + elements.next().toString());
    }
    try {
      MessageHandler.warning(warning.toString());
    }
 catch (    CancelException ex) {
    }
  }
  if (_toplevel != null) {
    _toplevel.setDeferringChangeRequests(_previousDeferStatus);
    _toplevel.executeChangeRequests();
  }
  Iterator parameters=_paramsToParse.iterator();
  while (parameters.hasNext()) {
    Settable param=(Settable)parameters.next();
    try {
      param.validate();
      Iterator derivedParams=((NamedObj)param).getDerivedList().iterator();
      while (derivedParams.hasNext()) {
        Settable derivedParam=(Settable)derivedParams.next();
        derivedParam.validate();
      }
    }
 catch (    Exception ex) {
      if (_handler != null) {
        int reply=_handler.handleError("String_Node_Str" + param.getName() + "String_Node_Str"+ param.getExpression()+ "String_Node_Str",(NamedObj)param.getContainer(),ex);
        if (reply == ErrorHandler.CONTINUE) {
          continue;
        }
      }
      throw ex;
    }
  }
}

Fixed version (ground truth):
/** 
 * End the document. The MoMLParser calls this method once, when it has finished parsing the complete XML document. It is guaranteed that this will be the last method called in the XML parsing process. As a consequence, it is guaranteed that all dependencies between parameters used in the XML description are resolved. This method executes any change requests that may have been made during the parsing process.
 * @exception CancelException If an error occurs parsing one of theparameter values, and the user clicks on "cancel" to cancel the parse.
 */
public void endDocument() throws Exception {
  _processPendingRequests();
  if (_undoEnabled && _undoContext != null && _undoContext.hasUndoMoML()) {
    String undoMoML=_undoContext.getUndoMoML();
    if (_undoDebug) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.print(undoMoML);
      System.out.println("String_Node_Str");
    }
    NamedObj context=_current;
    if (context == null) {
      context=_toplevel;
    }
    MoMLUndoEntry newEntry=new MoMLUndoEntry(context,undoMoML);
    UndoStackAttribute undoInfo=UndoStackAttribute.getUndoInfo(context);
    undoInfo.push(newEntry);
    _resetUndo();
  }
  if (_unrecognized != null) {
    StringBuffer warning=new StringBuffer("String_Node_Str");
    Iterator elements=_unrecognized.iterator();
    while (elements.hasNext()) {
      warning.append("String_Node_Str" + elements.next().toString());
    }
    try {
      MessageHandler.warning(warning.toString());
    }
 catch (    CancelException ex) {
    }
  }
  try {
    if (_toplevel != null) {
      _toplevel.setDeferringChangeRequests(_previousDeferStatus);
      _toplevel.executeChangeRequests();
    }
    Iterator parameters=_paramsToParse.iterator();
    while (parameters.hasNext()) {
      Settable param=(Settable)parameters.next();
      try {
        param.validate();
        Iterator derivedParams=((NamedObj)param).getDerivedList().iterator();
        while (derivedParams.hasNext()) {
          Settable derivedParam=(Settable)derivedParams.next();
          derivedParam.validate();
        }
      }
 catch (      Exception ex) {
        if (_handler != null) {
          int reply=_handler.handleError("String_Node_Str" + param.getName() + "String_Node_Str"+ param.getExpression()+ "String_Node_Str",(NamedObj)param.getContainer(),ex);
          if (reply == ErrorHandler.CONTINUE) {
            continue;
          }
        }
        throw ex;
      }
    }
  }
  finally {
    if (_handler != null) {
      _handler.enableErrorSkipping(false);
    }
  }
}