Program: 75010
Project: 75010
Buggy source:
/** 
 * Open the MoML file at the given location as a new library in the actor library for this application. An alternate class can be used to build the library if reading the MoML is not desired.  The class must extend ptolemy.moml.LibraryBuilder and the _alternateLibraryBuilder property must be set with the 'value' set to the class that extends LibraryBuilder.
 * @param configuration The configuration where we look for theactor library.
 * @param file The MoML file to open.
 * @exception Exception If there is a problem opening the configuration,opening the MoML file, or opening the MoML file as a new library.
 */
public static void openLibrary(Configuration configuration,File file) throws Exception {
  CompositeEntity library=null;
  final CompositeEntity libraryContainer=(CompositeEntity)configuration.getEntity("String_Node_Str");
  if (libraryContainer == null) {
    return;
  }
  StringAttribute alternateLibraryBuilderAttribute=(StringAttribute)libraryContainer.getAttribute("String_Node_Str");
  if (alternateLibraryBuilderAttribute != null) {
    List alternatLibrarySubAttributes=alternateLibraryBuilderAttribute.attributeList();
    String libraryBuilderClassName=alternateLibraryBuilderAttribute.getExpression();
    Class libraryBuilderClass=Class.forName(libraryBuilderClassName);
    LibraryBuilder libraryBuilder=(LibraryBuilder)libraryBuilderClass.newInstance();
    libraryBuilder.addAttributes(alternateLibraryBuilderAttribute.attributeList());
    try {
      library=libraryBuilder.buildLibrary(libraryContainer.workspace());
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      throw new Exception("String_Node_Str" + "String_Node_Str",ex);
    }
    System.out.println("String_Node_Str");
  }
  final ModelDirectory directory=(ModelDirectory)configuration.getEntity(Configuration._DIRECTORY_NAME);
  if (directory == null) {
    return;
  }
  URL fileURL=JNLPUtilities.canonicalizeJarURL(file.toURL());
  String identifier=fileURL.toExternalForm();
  Effigy libraryEffigy=directory.getEffigy(identifier);
  if (libraryEffigy == null) {
    if (library == null) {
      MoMLParser parser=new MoMLParser(libraryContainer.workspace());
      MoMLParser.setErrorHandler(new VergilErrorHandler());
      parser.parse(fileURL,fileURL);
      library=(CompositeEntity)parser.getToplevel();
    }
    final PtolemyEffigy finalLibraryEffigy=new PtolemyEffigy(directory.workspace());
    finalLibraryEffigy.setSystemEffigy(true);
    if (library.getName().equals("String_Node_Str")) {
      library.setName(BasicGraphFrame.VERGIL_USER_LIBRARY_NAME);
    }
    finalLibraryEffigy.setName(directory.uniqueName(library.getName()));
    _instantiateLibrary(library,directory,configuration,file,libraryContainer,finalLibraryEffigy);
    finalLibraryEffigy.setModel(library);
    URIAttribute uri=new URIAttribute(library,"String_Node_Str");
    uri.setURL(fileURL);
    finalLibraryEffigy.uri.setURL(fileURL);
    finalLibraryEffigy.identifier.setExpression(identifier);
  }
}

Fixed version (ground truth):
/** 
 * Open the MoML file at the given location as a new library in the actor library for this application. An alternate class can be used to build the library if reading the MoML is not desired.  The class must extend ptolemy.moml.LibraryBuilder and the _alternateLibraryBuilder property must be set with the 'value' set to the class that extends LibraryBuilder.
 * @param configuration The configuration where we look for theactor library.
 * @param file The MoML file to open.
 * @exception Exception If there is a problem opening the configuration,opening the MoML file, or opening the MoML file as a new library.
 */
public static void openLibrary(Configuration configuration,File file) throws Exception {
  CompositeEntity library=null;
  final CompositeEntity libraryContainer=(CompositeEntity)configuration.getEntity("String_Node_Str");
  final ModelDirectory directory=(ModelDirectory)configuration.getEntity(Configuration._DIRECTORY_NAME);
  if (directory == null) {
    return;
  }
  if (libraryContainer == null) {
    return;
  }
  StringAttribute alternateLibraryBuilderAttribute=(StringAttribute)libraryContainer.getAttribute("String_Node_Str");
  if (alternateLibraryBuilderAttribute != null) {
    List alternatLibrarySubAttributes=alternateLibraryBuilderAttribute.attributeList();
    String libraryBuilderClassName=alternateLibraryBuilderAttribute.getExpression();
    Class libraryBuilderClass=Class.forName(libraryBuilderClassName);
    LibraryBuilder libraryBuilder=(LibraryBuilder)libraryBuilderClass.newInstance();
    libraryBuilder.addAttributes(alternateLibraryBuilderAttribute.attributeList());
    try {
      library=libraryBuilder.buildLibrary(libraryContainer.workspace());
    }
 catch (    Exception ex) {
      ex.printStackTrace();
      throw new Exception("String_Node_Str" + "String_Node_Str",ex);
    }
    System.out.println("String_Node_Str");
  }
  URL fileURL=JNLPUtilities.canonicalizeJarURL(file.toURL());
  String identifier=fileURL.toExternalForm();
  Effigy libraryEffigy=directory.getEffigy(identifier);
  if (libraryEffigy == null) {
    if (library == null) {
      MoMLParser parser=new MoMLParser(libraryContainer.workspace());
      MoMLParser.setErrorHandler(new VergilErrorHandler());
      parser.parse(fileURL,fileURL);
      library=(CompositeEntity)parser.getToplevel();
    }
    final PtolemyEffigy finalLibraryEffigy=new PtolemyEffigy(directory.workspace());
    finalLibraryEffigy.setSystemEffigy(true);
    if (library.getName().equals("String_Node_Str")) {
      library.setName(BasicGraphFrame.VERGIL_USER_LIBRARY_NAME);
    }
    finalLibraryEffigy.setName(directory.uniqueName(library.getName()));
    _instantiateLibrary(library,directory,configuration,file,libraryContainer,finalLibraryEffigy);
    finalLibraryEffigy.setModel(library);
    URIAttribute uri=new URIAttribute(library,"String_Node_Str");
    uri.setURL(fileURL);
    finalLibraryEffigy.uri.setURL(fileURL);
    finalLibraryEffigy.identifier.setExpression(identifier);
  }
}