Program: 75301
Project: 75301
Buggy source:
/** 
 * End an element. This method pops the current container from the stack, if appropriate, and also adds specialized properties to the container, such as <i>_doc</i>, if appropriate. &AElig;lfred will call this method at the end of each element (including EMPTY elements).
 * @param elementName The element type name.
 */
public void endElement(String elementName) throws Exception {
  if (_filterList != null) {
    Iterator filters=_filterList.iterator();
    String filteredElementName=elementName;
    while (filters.hasNext()) {
      MoMLFilter filter=(MoMLFilter)filters.next();
      filteredElementName=filter.filterEndElement(_current,filteredElementName);
    }
    elementName=filteredElementName;
    if (elementName == null) {
      return;
    }
  }
  if (_skipElement <= 0) {
    if (elementName.equals("String_Node_Str")) {
      _configureNesting--;
      if (_configureNesting < 0) {
        throw new XmlException("String_Node_Str" + _configureNesting + "String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
      }
    }
 else     if (elementName.equals("String_Node_Str")) {
      _docNesting--;
      if (_docNesting < 0) {
        throw new XmlException("String_Node_Str" + _docNesting + "String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
      }
    }
    if (_configureNesting > 0 || _docNesting > 0) {
      _currentCharData.append("String_Node_Str");
      _currentCharData.append(elementName);
      _currentCharData.append("String_Node_Str");
      return;
    }
  }
  if (_skipRendition) {
    if (elementName.equals("String_Node_Str")) {
      _skipRendition=false;
    }
  }
 else   if (_skipElement > 0) {
    if (elementName.equals(_skipElementName)) {
      _skipElement--;
    }
  }
 else   if (elementName.equals("String_Node_Str")) {
    try {
      ((Configurable)_current).configure(_base,_configureSource,_currentCharData.toString());
      _current.setOverrideDepth(0);
      List depthList=new LinkedList();
      Iterator heritage=_current.getShadowedDerivedList(depthList).iterator();
      Iterator depths=depthList.iterator();
      while (heritage.hasNext()) {
        Configurable inherited=(Configurable)heritage.next();
        int depth=((Integer)depths.next()).intValue();
        inherited.configure(_base,_configureSource,_currentCharData.toString());
        ((NamedObj)inherited).setOverrideDepth(depth);
      }
    }
 catch (    NoClassDefFoundError e) {
    }
  }
 else {
    if (elementName.equals("String_Node_Str")) {
      if (_currentDocName == null && _docNesting == 0) {
        _currentDocName="String_Node_Str";
      }
      Documentation previous=(Documentation)_current.getAttribute(_currentDocName);
      String previousValue=null;
      if (previous != null) {
        previousValue=previous.getValue();
      }
      if (_currentCharData.length() > 0 && !_currentCharData.equals(previousValue)) {
        if (previous != null) {
          previous.setExpression(_currentCharData.toString());
          previous.setOverrideDepth(0);
          List depthList=new LinkedList();
          Iterator heritage=previous.getShadowedDerivedList(depthList).iterator();
          Iterator depths=depthList.iterator();
          while (heritage.hasNext()) {
            int depth=((Integer)depths.next()).intValue();
            Documentation inherited=(Documentation)heritage.next();
            inherited.setExpression(_currentCharData.toString());
            inherited.setOverrideDepth(depth);
          }
        }
 else {
          Documentation doc=new Documentation(_current,_currentDocName);
          doc.setValue(_currentCharData.toString());
          doc.setOverrideDepth(0);
          List depthList=new LinkedList();
          Iterator heritage=_current.getShadowedDerivedList(depthList).iterator();
          Iterator depths=depthList.iterator();
          while (heritage.hasNext()) {
            int depth=((Integer)depths.next()).intValue();
            NamedObj inherited=(NamedObj)heritage.next();
            Documentation newDoc=new Documentation(inherited,_currentDocName);
            newDoc.setValue(_currentCharData.toString());
            newDoc.setDerived(true);
            newDoc.setOverrideDepth(depth);
          }
        }
      }
 else {
        if (previous != null) {
          Iterator heritage=previous.getShadowedDerivedList(null).iterator();
          while (heritage.hasNext()) {
            Documentation inherited=(Documentation)heritage.next();
            inherited.setContainer(null);
          }
          previous.setContainer(null);
        }
      }
      if (_undoEnabled && _undoContext.isUndoable()) {
        _undoContext.appendUndoMoML("String_Node_Str" + _currentDocName + "String_Node_Str");
        if (previous != null) {
          _undoContext.appendUndoMoML(previousValue);
        }
        _undoContext.appendUndoMoML("String_Node_Str");
      }
      _currentDocName=null;
    }
 else     if (elementName.equals("String_Node_Str")) {
      try {
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _namespace=_DEFAULT_NAMESPACE;
      }
    }
 else     if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) {
      if (_linkRequests != null) {
        Iterator requests=_linkRequests.iterator();
        while (requests.hasNext()) {
          LinkRequest request=(LinkRequest)requests.next();
          try {
            request.execute();
          }
 catch (          Exception ex) {
            if (_handler != null) {
              int reply=_handler.handleError(request.toString(),_current,ex);
              if (reply == ErrorHandler.CONTINUE) {
                continue;
              }
 else               if (reply == ErrorHandler.CANCEL) {
                throw new XmlException("String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
              }
            }
 else {
              throw ex;
            }
          }
        }
      }
      try {
        _current=(NamedObj)_containers.pop();
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _current=null;
        _namespace=_DEFAULT_NAMESPACE;
      }
      try {
        _linkRequests=(List)_linkRequestStack.pop();
      }
 catch (      EmptyStackException ex) {
        _linkRequests=null;
      }
    }
 else     if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")) {
      try {
        _current=(NamedObj)_containers.pop();
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _current=null;
        _namespace=_DEFAULT_NAMESPACE;
      }
    }
  }
  if (_undoEnabled && _isUndoableElement(elementName)) {
    try {
      String undoMoML=_undoContext.generateUndoEntry();
      if (_undoDebug) {
        System.out.println("String_Node_Str" + elementName + "String_Node_Str"+ _undoContext.getUndoMoML());
      }
      _undoContext=(UndoContext)_undoContexts.pop();
      _undoContext.pushUndoEntry(undoMoML);
    }
 catch (    EmptyStackException ex) {
      if (_undoDebug) {
        System.out.println("String_Node_Str" + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * End an element. This method pops the current container from the stack, if appropriate, and also adds specialized properties to the container, such as <i>_doc</i>, if appropriate. &AElig;lfred will call this method at the end of each element (including EMPTY elements).
 * @param elementName The element type name.
 */
public void endElement(String elementName) throws Exception {
  if (_filterList != null) {
    Iterator filters=_filterList.iterator();
    String filteredElementName=elementName;
    while (filters.hasNext()) {
      MoMLFilter filter=(MoMLFilter)filters.next();
      filteredElementName=filter.filterEndElement(_current,filteredElementName);
    }
    elementName=filteredElementName;
    if (elementName == null) {
      return;
    }
  }
  if (_skipElement <= 0) {
    if (elementName.equals("String_Node_Str")) {
      _configureNesting--;
      if (_configureNesting < 0) {
        throw new XmlException("String_Node_Str" + _configureNesting + "String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
      }
    }
 else     if (elementName.equals("String_Node_Str")) {
      _docNesting--;
      if (_docNesting < 0) {
        throw new XmlException("String_Node_Str" + _docNesting + "String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
      }
    }
    if (_configureNesting > 0 || _docNesting > 0) {
      _currentCharData.append("String_Node_Str");
      _currentCharData.append(elementName);
      _currentCharData.append("String_Node_Str");
      return;
    }
  }
  if (_skipRendition) {
    if (elementName.equals("String_Node_Str")) {
      _skipRendition=false;
    }
  }
 else   if (_skipElement > 0) {
    if (elementName.equals(_skipElementName)) {
      _skipElement--;
    }
  }
 else   if (elementName.equals("String_Node_Str")) {
    try {
      ((Configurable)_current).configure(_base,_configureSource,_currentCharData.toString());
      _current.setOverrideDepth(0);
      List depthList=new LinkedList();
      Iterator heritage=_current.getShadowedDerivedList(depthList).iterator();
      Iterator depths=depthList.iterator();
      while (heritage.hasNext()) {
        Configurable inherited=(Configurable)heritage.next();
        int depth=((Integer)depths.next()).intValue();
        inherited.configure(_base,_configureSource,_currentCharData.toString());
        ((NamedObj)inherited).setOverrideDepth(depth);
      }
    }
 catch (    NoClassDefFoundError e) {
    }
  }
 else {
    if (elementName.equals("String_Node_Str")) {
      if (_currentDocName == null && _docNesting == 0) {
        _currentDocName="String_Node_Str";
      }
      Documentation previous=(Documentation)_current.getAttribute(_currentDocName);
      String previousValue=null;
      if (previous != null) {
        previousValue=previous.getValue();
      }
      if (_currentCharData.length() > 0 && !_currentCharData.equals(previousValue)) {
        if (previous != null) {
          previous.setExpression(_currentCharData.toString());
          previous.setOverrideDepth(0);
          List depthList=new LinkedList();
          Iterator heritage=previous.getShadowedDerivedList(depthList).iterator();
          Iterator depths=depthList.iterator();
          while (heritage.hasNext()) {
            int depth=((Integer)depths.next()).intValue();
            Documentation inherited=(Documentation)heritage.next();
            inherited.setExpression(_currentCharData.toString());
            inherited.setOverrideDepth(depth);
          }
        }
 else {
          Documentation doc=new Documentation(_current,_currentDocName);
          doc.setValue(_currentCharData.toString());
          doc.setOverrideDepth(0);
          List depthList=new LinkedList();
          Iterator heritage=_current.getShadowedDerivedList(depthList).iterator();
          Iterator depths=depthList.iterator();
          while (heritage.hasNext()) {
            int depth=((Integer)depths.next()).intValue();
            NamedObj inherited=(NamedObj)heritage.next();
            Documentation newDoc=new Documentation(inherited,_currentDocName);
            newDoc.setValue(_currentCharData.toString());
            newDoc.setDerived(true);
            newDoc.setOverrideDepth(depth);
          }
        }
      }
 else {
        if (previous != null) {
          Iterator heritage=previous.getShadowedDerivedList(null).iterator();
          while (heritage.hasNext()) {
            Documentation inherited=(Documentation)heritage.next();
            inherited.setContainer(null);
          }
          previous.setContainer(null);
        }
      }
      if (_undoEnabled && _undoContext.isUndoable()) {
        _undoContext.appendUndoMoML("String_Node_Str" + _currentDocName + "String_Node_Str");
        if (previous != null) {
          _undoContext.appendUndoMoML(previousValue);
        }
        _undoContext.appendUndoMoML("String_Node_Str");
      }
      _currentDocName=null;
    }
 else     if (elementName.equals("String_Node_Str")) {
      try {
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _namespace=_DEFAULT_NAMESPACE;
      }
    }
 else     if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) {
      if (_linkRequests != null) {
        Iterator requests=_linkRequests.iterator();
        while (requests.hasNext()) {
          LinkRequest request=(LinkRequest)requests.next();
          try {
            request.execute();
          }
 catch (          Exception ex) {
            if (_handler != null) {
              int reply=_handler.handleError(request.toString(),_current,ex);
              if (reply == ErrorHandler.CONTINUE) {
                continue;
              }
 else               if (reply == ErrorHandler.CANCEL) {
                throw new XmlException("String_Node_Str",_currentExternalEntity(),_parser.getLineNumber(),_parser.getColumnNumber());
              }
            }
 else {
              throw ex;
            }
          }
        }
      }
      try {
        _current=(NamedObj)_containers.pop();
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _current=null;
        _namespace=_DEFAULT_NAMESPACE;
      }
      try {
        _linkRequests=(List)_linkRequestStack.pop();
      }
 catch (      EmptyStackException ex) {
        _linkRequests=null;
      }
    }
 else     if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")) {
      try {
        _current=(NamedObj)_containers.pop();
        _namespace=(String)_namespaces.pop();
      }
 catch (      EmptyStackException ex) {
        _current=null;
        _namespace=_DEFAULT_NAMESPACE;
      }
    }
  }
  if (_undoEnabled && _isUndoableElement(elementName)) {
    try {
      String undoMoML=_undoContext.generateUndoEntry();
      if (_undoDebug) {
        System.out.println("String_Node_Str" + elementName + "String_Node_Str"+ _undoContext.getUndoMoML());
      }
      _undoContext=(UndoContext)_undoContexts.pop();
      _undoContext.pushUndoEntry(undoMoML);
    }
 catch (    EmptyStackException ex) {
      if (_undoDebug) {
        System.out.println("String_Node_Str" + "String_Node_Str");
      }
    }
  }
}