Program: 12468
Project: 12468
Buggy source:
/** 
 * The validate function will: - perform validation on the given input SBOL file - perform comparison between 2 SBOL files - perform interconversion between SBOL1 and SBOL2 - convert from SBOL to GenBank - convert from SBOL to FASTA
 * @param fileName - Input SBOL file name
 * @param URIPrefix - Default URI prefix to set the SBOL Document to be read in or to be created.
 * @param complete - Set boolean variable to false to allow SBOL document to be incomplete. True otherwise.
 * @param compliant - Set boolean variable to false to allow non-compliant URIs. True otherwise. 
 * @param bestPractice - Set boolean variable to true to check best practices. False otherwise.
 * @param typesInURI - Set boolean variable to true to indicate that types are inserted into top-level identity URIs when they are created of the SBOL Document.
 * @param version - Specify the version to use for converted SBOL objects.
 * @param keepGoing - Set boolean variable to false to indicate fail on first error and stop program from continuing. True otherwise. 
 * @param compareFile - Second SBOL file to compare to the primary SBOL file.
 * @param compareFileName - The name of the second SBOL file to compare to the primary SBOL file.
 * @param mainFileName - Primary SBOL file to compare to the second SBOL file.
 * @param topLevelURIStr - Specify the top level URI SBOL object contained within the given SBOL Document.
 * @param genBankOut - Set boolean variable to true to convert input file to GenBank. False otherwise. 
 * @param sbolV1out - Set boolean variable to true to convert input file to SBOL1. False otherwise. 
 * @param fastaOut - Set boolean variable to true to convert input file to FASTA. False otherwise. 
 * @param outputFile - The specified output name to be generated if the validation must produce an output file.
 * @param showDetail - Set boolean variable to true to display detailed error trace. False otherwise. 
 * @param noOutput - Set boolean variable to true to indicate no output file to be generated from validation
 */
public static void validate(String fileName,String URIPrefix,boolean complete,boolean compliant,boolean bestPractice,boolean typesInURI,String version,boolean keepGoing,String compareFile,String compareFileName,String mainFileName,String topLevelURIStr,boolean genBankOut,boolean sbolV1out,boolean fastaOut,String outputFile,boolean showDetail,boolean noOutput){
  try {
    SBOLDocument doc=null;
    if (!URIPrefix.equals("String_Node_Str")) {
      SBOLReader.setURIPrefix(URIPrefix);
    }
    if (!compliant) {
      SBOLReader.setCompliant(false);
    }
    SBOLReader.setTypesInURI(typesInURI);
    SBOLReader.setVersion(version);
    SBOLReader.setKeepGoing(keepGoing);
    SBOLWriter.setKeepGoing(keepGoing);
    if (FASTA.isFastaFile(fileName)) {
      System.out.println("String_Node_Str");
    }
 else     if (GenBank.isGenBankFile(fileName)) {
      System.out.println("String_Node_Str");
    }
 else     if (SBOLReader.getSBOLVersion(fileName).equals(SBOLReader.SBOLVERSION1)) {
      System.out.println("String_Node_Str");
    }
    doc=SBOLReader.read(fileName);
    doc.setTypesInURIs(typesInURI);
    if (!compareFile.equals("String_Node_Str")) {
      SBOLDocument doc2=SBOLReader.read(compareFile);
      if (mainFileName.equals("String_Node_Str")) {
        File f=new File(fileName);
        mainFileName=f.getName();
      }
      if (compareFileName.equals("String_Node_Str")) {
        File f=new File(compareFile);
        compareFileName=f.getName();
      }
      compareDocuments(mainFileName,doc,compareFileName,doc2);
    }
    if (!topLevelURIStr.equals("String_Node_Str")) {
      TopLevel topLevel=doc.getTopLevel(URI.create(topLevelURIStr));
      if (topLevel == null) {
        System.err.println("String_Node_Str" + topLevelURIStr + "String_Node_Str");
        return;
      }
      if (complete) {
        doc=doc.createRecursiveCopy(topLevel);
      }
 else {
        SBOLDocument newDoc=new SBOLDocument();
        newDoc.createCopy(topLevel);
        doc=newDoc;
      }
    }
    if (!URIPrefix.equals("String_Node_Str")) {
      System.out.println("String_Node_Str" + URIPrefix);
      if (version != null) {
        System.out.println("String_Node_Str" + version);
      }
      doc=doc.changeURIPrefixVersion(URIPrefix,version);
    }
 else     if (version != null) {
      System.err.println("String_Node_Str");
      return;
    }
    validateSBOL(doc,complete,compliant,bestPractice);
    if (getNumErrors() == 0 && SBOLReader.getNumErrors() == 0) {
      if (noOutput) {
        System.out.println("String_Node_Str");
      }
 else       if (genBankOut) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.GENBANK);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.GENBANK);
        }
      }
 else       if (sbolV1out) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.RDFV1);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.RDFV1);
        }
        if (SBOLWriter.getNumErrors() != 0) {
          for (          String error : SBOLWriter.getErrors()) {
            System.err.println(error);
          }
        }
      }
 else       if (fastaOut) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.FASTAformat);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.FASTAformat);
        }
      }
 else {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out));
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile);
        }
      }
    }
 else {
      if (getNumErrors() != 0) {
        for (        String error : getErrors()) {
          System.err.println(error);
          System.err.println();
        }
      }
      if (SBOLReader.getNumErrors() != 0) {
        for (        String error : SBOLReader.getErrors()) {
          System.err.println(error);
          System.err.println();
        }
      }
      System.err.println("String_Node_Str");
    }
  }
 catch (  SBOLValidationException e) {
    if (showDetail) {
      e.printStackTrace();
    }
    if (e.getMessage() != null) {
      System.err.println(e.getMessage() + "String_Node_Str");
    }
 else {
      e.printStackTrace();
      System.err.println("String_Node_Str");
    }
  }
catch (  SBOLConversionException e) {
    if (showDetail) {
      e.printStackTrace();
    }
    if (e.getMessage() != null) {
      System.err.println(e.getMessage() + "String_Node_Str");
    }
 else {
      e.printStackTrace();
      System.err.println("String_Node_Str");
    }
  }
catch (  IOException e) {
    System.err.println(e.getMessage() + "String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * The validate function will: - perform validation on the given input SBOL file - perform comparison between 2 SBOL files - perform interconversion between SBOL1 and SBOL2 - convert from SBOL to GenBank - convert from SBOL to FASTA
 * @param fileName - Input SBOL file name
 * @param URIPrefix - Default URI prefix to set the SBOL Document to be read in or to be created.
 * @param complete - Set boolean variable to false to allow SBOL document to be incomplete. True otherwise.
 * @param compliant - Set boolean variable to false to allow non-compliant URIs. True otherwise. 
 * @param bestPractice - Set boolean variable to true to check best practices. False otherwise.
 * @param typesInURI - Set boolean variable to true to indicate that types are inserted into top-level identity URIs when they are created of the SBOL Document.
 * @param version - Specify the version to use for converted SBOL objects.
 * @param keepGoing - Set boolean variable to false to indicate fail on first error and stop program from continuing. True otherwise. 
 * @param compareFile - Second SBOL file to compare to the primary SBOL file.
 * @param compareFileName - The name of the second SBOL file to compare to the primary SBOL file.
 * @param mainFileName - Primary SBOL file to compare to the second SBOL file.
 * @param topLevelURIStr - Specify the top level URI SBOL object contained within the given SBOL Document.
 * @param genBankOut - Set boolean variable to true to convert input file to GenBank. False otherwise. 
 * @param sbolV1out - Set boolean variable to true to convert input file to SBOL1. False otherwise. 
 * @param fastaOut - Set boolean variable to true to convert input file to FASTA. False otherwise. 
 * @param outputFile - The specified output name to be generated if the validation must produce an output file.
 * @param showDetail - Set boolean variable to true to display detailed error trace. False otherwise. 
 * @param noOutput - Set boolean variable to true to indicate no output file to be generated from validation
 */
public static void validate(String fileName,String URIPrefix,boolean complete,boolean compliant,boolean bestPractice,boolean typesInURI,String version,boolean keepGoing,String compareFile,String compareFileName,String mainFileName,String topLevelURIStr,boolean genBankOut,boolean sbolV1out,boolean fastaOut,String outputFile,boolean showDetail,boolean noOutput){
  try {
    SBOLDocument doc=null;
    if (!URIPrefix.equals("String_Node_Str")) {
      SBOLReader.setURIPrefix(URIPrefix);
    }
    if (!compliant) {
      SBOLReader.setCompliant(false);
    }
    SBOLReader.setTypesInURI(typesInURI);
    SBOLReader.setVersion(version);
    SBOLReader.setKeepGoing(keepGoing);
    SBOLWriter.setKeepGoing(keepGoing);
    if (FASTA.isFastaFile(fileName)) {
      System.out.println("String_Node_Str");
    }
 else     if (GenBank.isGenBankFile(fileName)) {
      System.out.println("String_Node_Str");
    }
 else     if (SBOLReader.getSBOLVersion(fileName).equals(SBOLReader.SBOLVERSION1)) {
      System.out.println("String_Node_Str");
    }
    doc=SBOLReader.read(fileName);
    doc.setTypesInURIs(typesInURI);
    if (!compareFile.equals("String_Node_Str")) {
      SBOLDocument doc2=SBOLReader.read(compareFile);
      if (mainFileName.equals("String_Node_Str")) {
        File f=new File(fileName);
        mainFileName=f.getName();
      }
      if (compareFileName.equals("String_Node_Str")) {
        File f=new File(compareFile);
        compareFileName=f.getName();
      }
      compareDocuments(mainFileName,doc,compareFileName,doc2);
    }
    if (!topLevelURIStr.equals("String_Node_Str")) {
      TopLevel topLevel=doc.getTopLevel(URI.create(topLevelURIStr));
      if (topLevel == null) {
        System.err.println("String_Node_Str" + topLevelURIStr + "String_Node_Str");
        return;
      }
      if (complete) {
        doc=doc.createRecursiveCopy(topLevel);
      }
 else {
        SBOLDocument newDoc=new SBOLDocument();
        newDoc.createCopy(topLevel);
        doc=newDoc;
      }
    }
    if (!URIPrefix.equals("String_Node_Str") && doc.getTopLevels().size() > 0) {
      System.out.println("String_Node_Str" + URIPrefix);
      if (version != null) {
        System.out.println("String_Node_Str" + version);
      }
      doc=doc.changeURIPrefixVersion(URIPrefix,version);
    }
 else     if (version != null) {
      System.err.println("String_Node_Str");
      return;
    }
    validateSBOL(doc,complete,compliant,bestPractice);
    if (getNumErrors() == 0 && SBOLReader.getNumErrors() == 0) {
      if (noOutput) {
        System.out.println("String_Node_Str");
      }
 else       if (genBankOut) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.GENBANK);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.GENBANK);
        }
      }
 else       if (sbolV1out) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.RDFV1);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.RDFV1);
        }
        if (SBOLWriter.getNumErrors() != 0) {
          for (          String error : SBOLWriter.getErrors()) {
            System.err.println(error);
          }
        }
      }
 else       if (fastaOut) {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out),SBOLDocument.FASTAformat);
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile,SBOLDocument.FASTAformat);
        }
      }
 else {
        if (outputFile.equals("String_Node_Str")) {
          SBOLWriter.write(doc,(System.out));
        }
 else {
          System.out.println("String_Node_Str");
          SBOLWriter.write(doc,outputFile);
        }
      }
    }
 else {
      if (getNumErrors() != 0) {
        for (        String error : getErrors()) {
          System.err.println(error);
          System.err.println();
        }
      }
      if (SBOLReader.getNumErrors() != 0) {
        for (        String error : SBOLReader.getErrors()) {
          System.err.println(error);
          System.err.println();
        }
      }
      System.err.println("String_Node_Str");
    }
  }
 catch (  SBOLValidationException e) {
    if (showDetail) {
      e.printStackTrace();
    }
    if (e.getMessage() != null) {
      System.err.println(e.getMessage() + "String_Node_Str");
    }
 else {
      e.printStackTrace();
      System.err.println("String_Node_Str");
    }
  }
catch (  SBOLConversionException e) {
    if (showDetail) {
      e.printStackTrace();
    }
    if (e.getMessage() != null) {
      System.err.println(e.getMessage() + "String_Node_Str");
    }
 else {
      e.printStackTrace();
      System.err.println("String_Node_Str");
    }
  }
catch (  IOException e) {
    System.err.println(e.getMessage() + "String_Node_Str");
    e.printStackTrace();
  }
}