Program: 75343
Project: 75343
Buggy source:
/** 
 * Create a new effigy in the given container by reading the <i>input</i> URL. If the <i>input</i> URL is null, then create a blank effigy. The blank effigy will have a new model associated with it. If this effigy factory contains an entity named "blank", then the new model will be a clone of that entity.  Otherwise, it will be an instance of TypedCompositeActor. If the URL does not end with extension ".xml" or ".moml", then return null.  If the URL points to an XML file that is not a MoML file, then also return null. The specified base is used to expand any relative file references within the URL.
 * @param container The container for the effigy.
 * @param base The base for relative file references, or null ifthere are no relative file references.
 * @param input The input URL.
 * @return A new instance of PtolemyEffigy, or null if the URLdoes not specify a Ptolemy II model.
 * @exception Exception If the URL cannot be read, or if the datais malformed in some way.
 */
public Effigy createEffigy(CompositeEntity container,URL base,URL input) throws Exception {
  if (input == null) {
    PtolemyEffigy effigy=_newEffigy(container,container.uniqueName("String_Node_Str"));
    NamedObj entity=getEntity("String_Node_Str");
    NamedObj newModel;
    if (entity != null) {
      newModel=(NamedObj)entity.clone(new Workspace());
    }
 else {
      newModel=new TypedCompositeActor(new Workspace());
    }
    ParserAttribute.getParser(newModel);
    newModel.setName("String_Node_Str");
    effigy.setModel(newModel);
    return effigy;
  }
 else {
    String extension=getExtension(input);
    if (!extension.equals("String_Node_Str") && !extension.equals("String_Node_Str")) {
      if (extension.equals("String_Node_Str")) {
        System.out.println("String_Node_Str" + input + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ input);
      }
      return null;
    }
    PtolemyEffigy effigy=_newEffigy(container,container.uniqueName("String_Node_Str"));
    MoMLParser parser=new MoMLParser();
    parser.reset();
    NamedObj toplevel=null;
    try {
      try {
        try {
          toplevel=parser.parse(base,input);
        }
 catch (        IOException io) {
          URL anotherURL=JNLPUtilities.jarURLEntryResource(input.toString());
          if (anotherURL != null) {
            toplevel=parser.parse(base,anotherURL.openStream());
          }
 else {
            throw io;
          }
        }
        if (toplevel != null) {
          effigy.setModel(toplevel);
          effigy.setModified(MoMLParser.isModified());
          MoMLParser.setModified(false);
          URIAttribute uriAttribute=new URIAttribute(toplevel,"String_Node_Str");
          URI inputURI=null;
          try {
            inputURI=new URI(input.toExternalForm());
          }
 catch (          java.net.URISyntaxException ex) {
            String inputExternalFormFixed=StringUtilities.substitute(input.toExternalForm(),"String_Node_Str","String_Node_Str");
            try {
              inputURI=new URI(inputExternalFormFixed);
            }
 catch (            Exception ex2) {
              throw new Exception("String_Node_Str" + "String_Node_Str" + input.toExternalForm() + "String_Node_Str"+ inputExternalFormFixed+ "String_Node_Str",ex);
            }
          }
          uriAttribute.setURI(inputURI);
          effigy.uri.setURI(inputURI);
          return effigy;
        }
 else {
          effigy.setContainer(null);
        }
      }
 catch (      Throwable throwable) {
        if (throwable instanceof StackOverflowError) {
          Throwable newThrowable=new StackOverflowError("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          newThrowable.initCause(throwable);
          throwable=newThrowable;
        }
        throwable.printStackTrace();
        ModelDirectory dir=(ModelDirectory)effigy.topEffigy().getContainer();
        List effigies=dir.entityList(Effigy.class);
        if (effigies.size() <= 3) {
          String errorMessage="String_Node_Str" + input;
          System.err.println(errorMessage);
          throwable.printStackTrace();
          MessageHandler.error(errorMessage,throwable);
        }
 else {
          if (throwable instanceof Exception) {
            throw (Exception)throwable;
          }
 else {
            throw new Exception(throwable);
          }
        }
      }
    }
  finally {
      if (toplevel == null) {
        effigy.setContainer(null);
      }
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Create a new effigy in the given container by reading the <i>input</i> URL. If the <i>input</i> URL is null, then create a blank effigy. The blank effigy will have a new model associated with it. If this effigy factory contains an entity named "blank", then the new model will be a clone of that entity.  Otherwise, it will be an instance of TypedCompositeActor. If the URL does not end with extension ".xml" or ".moml", then return null.  If the URL points to an XML file that is not a MoML file, then also return null. The specified base is used to expand any relative file references within the URL.
 * @param container The container for the effigy.
 * @param base The base for relative file references, or null ifthere are no relative file references.
 * @param input The input URL.
 * @return A new instance of PtolemyEffigy, or null if the URLdoes not specify a Ptolemy II model.
 * @exception Exception If the URL cannot be read, or if the datais malformed in some way.
 */
public Effigy createEffigy(CompositeEntity container,URL base,URL input) throws Exception {
  if (input == null) {
    PtolemyEffigy effigy=_newEffigy(container,container.uniqueName("String_Node_Str"));
    NamedObj entity=getEntity("String_Node_Str");
    NamedObj newModel;
    if (entity != null) {
      newModel=(NamedObj)entity.clone(new Workspace());
    }
 else {
      newModel=new TypedCompositeActor(new Workspace());
    }
    ParserAttribute.getParser(newModel);
    newModel.setName("String_Node_Str");
    effigy.setModel(newModel);
    return effigy;
  }
 else {
    String extension=getExtension(input);
    if (!extension.equals("String_Node_Str") && !extension.equals("String_Node_Str")) {
      if (extension.equals("String_Node_Str")) {
        System.out.println("String_Node_Str" + input + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ input);
      }
      return null;
    }
    PtolemyEffigy effigy=_newEffigy(container,container.uniqueName("String_Node_Str"));
    MoMLParser parser=new MoMLParser();
    parser.reset();
    NamedObj toplevel=null;
    try {
      try {
        try {
          toplevel=parser.parse(base,input);
        }
 catch (        IOException io) {
          URL anotherURL=JNLPUtilities.jarURLEntryResource(input.toString());
          if (anotherURL != null) {
            toplevel=parser.parse(base,anotherURL);
          }
 else {
            throw io;
          }
        }
        if (toplevel != null) {
          effigy.setModel(toplevel);
          effigy.setModified(MoMLParser.isModified());
          MoMLParser.setModified(false);
          URIAttribute uriAttribute=new URIAttribute(toplevel,"String_Node_Str");
          URI inputURI=null;
          try {
            inputURI=new URI(input.toExternalForm());
          }
 catch (          java.net.URISyntaxException ex) {
            String inputExternalFormFixed=StringUtilities.substitute(input.toExternalForm(),"String_Node_Str","String_Node_Str");
            try {
              inputURI=new URI(inputExternalFormFixed);
            }
 catch (            Exception ex2) {
              throw new Exception("String_Node_Str" + "String_Node_Str" + input.toExternalForm() + "String_Node_Str"+ inputExternalFormFixed+ "String_Node_Str",ex);
            }
          }
          uriAttribute.setURI(inputURI);
          effigy.uri.setURI(inputURI);
          return effigy;
        }
 else {
          effigy.setContainer(null);
        }
      }
 catch (      Throwable throwable) {
        if (throwable instanceof StackOverflowError) {
          Throwable newThrowable=new StackOverflowError("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
          newThrowable.initCause(throwable);
          throwable=newThrowable;
        }
        throwable.printStackTrace();
        ModelDirectory dir=(ModelDirectory)effigy.topEffigy().getContainer();
        List effigies=dir.entityList(Effigy.class);
        if (effigies.size() <= 3) {
          String errorMessage="String_Node_Str" + input;
          System.err.println(errorMessage);
          throwable.printStackTrace();
          MessageHandler.error(errorMessage,throwable);
        }
 else {
          if (throwable instanceof Exception) {
            throw (Exception)throwable;
          }
 else {
            throw new Exception(throwable);
          }
        }
      }
    }
  finally {
      if (toplevel == null) {
        effigy.setContainer(null);
      }
    }
    return null;
  }
}