Program: 74547
Project: 74547
Buggy source:
/** 
 * Attempt to find a MoML class from an external file. If there is no source defined, then search for the file relative to the classpath.
 * @param className The class name.
 * @param source The source as specified in the XML.
 * @return The class definition.
 */
private ComponentEntity _attemptToFindMoMLClass(String className,String source) throws Exception {
  String classAsFile=null;
  String altClassAsFile=null;
  ComponentEntity reference=null;
  if (source == null) {
    classAsFile=className.replace('.','/') + "String_Node_Str";
    altClassAsFile=className.replace('.','/') + "String_Node_Str";
  }
 else {
    classAsFile=source;
  }
  URL url=fileNameToURL(classAsFile,_base);
  if (_imports != null) {
    WeakReference possiblePrevious=(WeakReference)_imports.get(url);
    NamedObj previous=null;
    if (possiblePrevious != null) {
      previous=(NamedObj)possiblePrevious.get();
      if (previous == null) {
        _imports.remove(url);
      }
    }
    if (previous instanceof ComponentEntity) {
      return (ComponentEntity)previous;
    }
  }
  MoMLParser newParser=new MoMLParser(_workspace,_classLoader);
  NamedObj candidateReference=null;
  try {
    candidateReference=_findOrParse(newParser,_base,classAsFile,className,source);
  }
 catch (  Exception ex2) {
    url=null;
    if (altClassAsFile != null) {
      url=fileNameToURL(altClassAsFile,_base);
      if (_imports != null) {
        WeakReference possiblePrevious=(WeakReference)_imports.get(url);
        NamedObj previous=null;
        if (possiblePrevious != null) {
          previous=(NamedObj)possiblePrevious.get();
          if (previous == null) {
            _imports.remove(url);
          }
        }
        if (previous instanceof ComponentEntity) {
          return (ComponentEntity)previous;
        }
      }
      try {
        candidateReference=_findOrParse(newParser,_base,altClassAsFile,className,source);
        classAsFile=altClassAsFile;
      }
 catch (      Exception ex3) {
        throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str"+ altClassAsFile+ "String_Node_Str"+ _base+ "String_Node_Str",_currentExternalEntity(),_getLineNumber(),_getColumnNumber(),ex2);
      }
    }
 else {
      throw ex2;
    }
  }
  if (candidateReference instanceof ComponentEntity) {
    reference=(ComponentEntity)candidateReference;
  }
 else {
    throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str",_currentExternalEntity(),_getLineNumber(),_getColumnNumber());
  }
  String referenceName=reference.getName();
  if (!className.equals(referenceName) && !className.endsWith("String_Node_Str" + referenceName)) {
    if (reference instanceof CompositeEntity) {
      if (className.startsWith(referenceName + "String_Node_Str")) {
        reference=((CompositeEntity)reference).getEntity(className.substring(referenceName.length() + 1));
      }
 else {
        reference=null;
      }
    }
 else {
      reference=null;
    }
    if (reference == null) {
      throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str"+ className,_currentExternalEntity(),_getLineNumber(),_getColumnNumber());
    }
  }
  _loadIconForClass(className,reference);
  if (reference != null) {
    if (_imports == null) {
      _imports=new HashMap();
    }
    _imports.put(url,new WeakReference(reference));
  }
  return reference;
}

Fixed version (ground truth):
/** 
 * Attempt to find a MoML class from an external file. If there is no source defined, then search for the file relative to the classpath.
 * @param className The class name.
 * @param source The source as specified in the XML.
 * @return The class definition.
 */
private ComponentEntity _attemptToFindMoMLClass(String className,String source) throws Exception {
  String classAsFile=null;
  String altClassAsFile=null;
  ComponentEntity reference=null;
  if (source == null) {
    classAsFile=className.replace('.','/') + "String_Node_Str";
    altClassAsFile=className.replace('.','/') + "String_Node_Str";
  }
 else {
    classAsFile=source;
  }
  URL url=null;
  try {
    url=fileNameToURL(classAsFile,_base);
    if (_imports != null) {
      WeakReference possiblePrevious=(WeakReference)_imports.get(url);
      NamedObj previous=null;
      if (possiblePrevious != null) {
        previous=(NamedObj)possiblePrevious.get();
        if (previous == null) {
          _imports.remove(url);
        }
      }
      if (previous instanceof ComponentEntity) {
        return (ComponentEntity)previous;
      }
    }
  }
 catch (  Exception ex) {
  }
  MoMLParser newParser=new MoMLParser(_workspace,_classLoader);
  NamedObj candidateReference=null;
  try {
    candidateReference=_findOrParse(newParser,_base,classAsFile,className,source);
  }
 catch (  Exception ex2) {
    url=null;
    if (altClassAsFile != null) {
      url=fileNameToURL(altClassAsFile,_base);
      if (_imports != null) {
        WeakReference possiblePrevious=(WeakReference)_imports.get(url);
        NamedObj previous=null;
        if (possiblePrevious != null) {
          previous=(NamedObj)possiblePrevious.get();
          if (previous == null) {
            _imports.remove(url);
          }
        }
        if (previous instanceof ComponentEntity) {
          return (ComponentEntity)previous;
        }
      }
      try {
        candidateReference=_findOrParse(newParser,_base,altClassAsFile,className,source);
        classAsFile=altClassAsFile;
      }
 catch (      Exception ex3) {
        throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str"+ altClassAsFile+ "String_Node_Str"+ _base+ "String_Node_Str",_currentExternalEntity(),_getLineNumber(),_getColumnNumber(),ex2);
      }
    }
 else {
      throw ex2;
    }
  }
  if (candidateReference instanceof ComponentEntity) {
    reference=(ComponentEntity)candidateReference;
  }
 else {
    throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str",_currentExternalEntity(),_getLineNumber(),_getColumnNumber());
  }
  String referenceName=reference.getName();
  if (!className.equals(referenceName) && !className.endsWith("String_Node_Str" + referenceName)) {
    if (reference instanceof CompositeEntity) {
      if (className.startsWith(referenceName + "String_Node_Str")) {
        reference=((CompositeEntity)reference).getEntity(className.substring(referenceName.length() + 1));
      }
 else {
        reference=null;
      }
    }
 else {
      reference=null;
    }
    if (reference == null) {
      throw new XmlException("String_Node_Str" + classAsFile + "String_Node_Str"+ className,_currentExternalEntity(),_getLineNumber(),_getColumnNumber());
    }
  }
  _loadIconForClass(className,reference);
  if (reference != null) {
    if (_imports == null) {
      _imports=new HashMap();
    }
    _imports.put(url,new WeakReference(reference));
  }
  return reference;
}