Program: 72471
Project: 72471
Buggy source:
/** 
 * Read a Configuration from the URL given by the specified string. The URL may absolute, or relative to the Ptolemy II tree root, or in the classpath.  To convert a String to a URL suitable for use by this method, call specToURL(String). <p>If there is an _applicationInitializer parameter, then instantiate the class named by that parameter.  The _applicationInitializer parameter contains a string that names a class to be initialized. <p>If the configuration has already been read in, then the old configuration will be deleted.  Note that this may exit the application.
 * @param specificationURL A string describing a URL.
 * @return A configuration.
 * @exception Exception If the configuration cannot be opened, orif the contents of the URL is not a configuration.
 */
public static Configuration readConfiguration(URL specificationURL) throws Exception {
  if (_initialSpecificationURI == null) {
    _initialSpecificationURI=specificationURL.toURI();
  }
  MoMLParser parser=new MoMLParser();
  parser.reset();
  Configuration configuration=null;
  Exception cause=null;
  try {
    configuration=(Configuration)parser.parse(specificationURL,specificationURL);
  }
 catch (  Exception ex) {
    cause=ex;
    ex.printStackTrace();
  }
  if (configuration == null) {
    NullPointerException exception=new NullPointerException("String_Node_Str" + specificationURL);
    if (cause != null) {
      exception.initCause(cause);
    }
    throw exception;
  }
  ComponentEntity directory=configuration.getDirectory();
  if (directory != null) {
    PtolemyEffigy effigy=null;
    try {
      effigy=new PtolemyEffigy((ModelDirectory)directory,configuration.getName());
    }
 catch (    NameDuplicationException ex) {
      PtolemyEffigy oldEffigy=(PtolemyEffigy)((ModelDirectory)directory).getEntity(configuration.getName());
      oldEffigy.setContainer(null);
      effigy=new PtolemyEffigy((ModelDirectory)directory,configuration.getName());
    }
    effigy.setModel(configuration);
    effigy.identifier.setExpression(specificationURL.toExternalForm());
  }
  StringParameter applicationInitializerParameter=(StringParameter)configuration.getAttribute("String_Node_Str",Parameter.class);
  if (applicationInitializerParameter != null) {
    String applicationInitializerClassName=applicationInitializerParameter.stringValue();
    try {
      Class applicationInitializer=Class.forName(applicationInitializerClassName);
      applicationInitializer.newInstance();
    }
 catch (    Throwable throwable) {
      throw new Exception("String_Node_Str" + "String_Node_Str" + applicationInitializerClassName + "String_Node_Str"+ specificationURL+ "String_Node_Str",throwable);
    }
  }
  return configuration;
}

Fixed version (ground truth):
/** 
 * Read a Configuration from the URL given by the specified string. The URL may absolute, or relative to the Ptolemy II tree root, or in the classpath.  To convert a String to a URL suitable for use by this method, call specToURL(String). <p>If there is an _applicationInitializer parameter, then instantiate the class named by that parameter.  The _applicationInitializer parameter contains a string that names a class to be initialized. <p>If the configuration has already been read in, then the old configuration will be deleted.  Note that this may exit the application.
 * @param specificationURL A string describing a URL.
 * @return A configuration.
 * @exception Exception If the configuration cannot be opened, orif the contents of the URL is not a configuration.
 */
public static Configuration readConfiguration(URL specificationURL) throws Exception {
  if (_initialSpecificationURI == null) {
    _initialSpecificationURI=specificationURL.toURI();
  }
  MoMLParser parser=new MoMLParser();
  parser.reset();
  Configuration configuration=null;
  Exception cause=null;
  try {
    configuration=(Configuration)parser.parse(specificationURL,specificationURL);
  }
 catch (  Exception ex) {
    cause=ex;
    ex.printStackTrace();
  }
  if (configuration == null) {
    NullPointerException exception=new NullPointerException("String_Node_Str" + specificationURL);
    if (cause != null) {
      exception.initCause(cause);
    }
    throw exception;
  }
  ComponentEntity directory=configuration.getDirectory();
  if (directory != null) {
    PtolemyEffigy effigy=null;
    try {
      effigy=new PtolemyEffigy((ModelDirectory)directory,configuration.getName());
      effigy.setSystemEffigy(true);
    }
 catch (    NameDuplicationException ex) {
      PtolemyEffigy oldEffigy=(PtolemyEffigy)((ModelDirectory)directory).getEntity(configuration.getName());
      oldEffigy.setContainer(null);
      effigy=new PtolemyEffigy((ModelDirectory)directory,configuration.getName());
    }
    effigy.setModel(configuration);
    effigy.identifier.setExpression(specificationURL.toExternalForm());
  }
  StringParameter applicationInitializerParameter=(StringParameter)configuration.getAttribute("String_Node_Str",Parameter.class);
  if (applicationInitializerParameter != null) {
    String applicationInitializerClassName=applicationInitializerParameter.stringValue();
    try {
      Class applicationInitializer=Class.forName(applicationInitializerClassName);
      applicationInitializer.newInstance();
    }
 catch (    Throwable throwable) {
      throw new Exception("String_Node_Str" + "String_Node_Str" + applicationInitializerClassName + "String_Node_Str"+ specificationURL+ "String_Node_Str",throwable);
    }
  }
  return configuration;
}