Program: 48233
Project: 48233
Buggy source:
/** 
 * Load a document and query it (temporal enhancements).
 */
private static void loadDocumentAndQueryTemporal() throws QueryException, IOException {
  File tmpDir=new File(System.getProperty("String_Node_Str"));
  File doc=generateSampleDoc(tmpDir,"String_Node_Str");
  doc.deleteOnExit();
  try (final DBStore store=DBStore.newBuilder().isUpdatable().build()){
    final QueryContext ctx=new QueryContext(store);
    System.out.println("String_Node_Str");
    final String xq1=String.format("String_Node_Str",doc);
    System.out.println(xq1);
    new XQuery(xq1).evaluate(ctx);
    final QueryContext ctx2=new QueryContext(store);
    System.out.println();
    System.out.println("String_Node_Str");
    final String xq2="String_Node_Str";
    System.out.println(xq2);
    final XQuery q=new XQuery(xq2);
    q.serialize(ctx2,System.out);
    store.commitAll();
    System.out.println();
  }
   try (final DBStore store=DBStore.newBuilder().build()){
    final QueryContext ctx3=new QueryContext(store);
    System.out.println();
    System.out.println("String_Node_Str");
    final String xq3="String_Node_Str";
    System.out.println(xq3);
    XQuery q=new XQuery(new SirixCompileChain(store),xq3);
    q.prettyPrint();
    q.serialize(ctx3,System.out);
    final QueryContext ctx4=new QueryContext(store);
    final String xq4="String_Node_Str";
    q=new XQuery(xq4);
    try (final PrintStream out=new PrintStream(new FileOutputStream(new File(new StringBuilder(LOCATION.getAbsolutePath()).append(File.separator).append("String_Node_Str").toString())))){
      q.prettyPrint().serialize(ctx4,out);
    }
     System.out.println();
    final QueryContext ctx5=new QueryContext(store);
    final String xq5="String_Node_Str";
    q=new XQuery(xq5);
    try (final PrintStream out=new PrintStream(new FileOutputStream(new File(new StringBuilder(LOCATION.getAbsolutePath()).append(File.separator).append(File.separator).append("String_Node_Str").toString())))){
      q.prettyPrint().serialize(ctx5,out);
    }
     System.out.println();
  }
 }

Fixed version (ground truth):
/** 
 * Load a document and query it (temporal enhancements).
 */
private static void loadDocumentAndQueryTemporal() throws QueryException, IOException {
  File tmpDir=new File(System.getProperty("String_Node_Str"));
  try (final DBStore store=DBStore.newBuilder().isUpdatable().build()){
    final QueryContext ctx=new QueryContext(store);
    File doc1=generateSampleDoc(tmpDir,"String_Node_Str");
    doc1.deleteOnExit();
    System.out.println("String_Node_Str");
    final String xq1=String.format("String_Node_Str",doc1);
    System.out.println(xq1);
    new XQuery(xq1).evaluate(ctx);
    final QueryContext ctx2=new QueryContext(store);
    System.out.println();
    System.out.println("String_Node_Str");
    final String xq2="String_Node_Str";
    System.out.println(xq2);
    final XQuery q=new XQuery(xq2);
    q.serialize(ctx2,System.out);
    store.commitAll();
    System.out.println();
    File doc2=generateSampleDoc(tmpDir,"String_Node_Str");
    doc2.deleteOnExit();
    System.out.println("String_Node_Str");
    final String xq3=String.format("String_Node_Str",doc2);
    System.out.println(xq3);
    new XQuery(xq3).evaluate(ctx);
  }
   try (final DBStore store=DBStore.newBuilder().isUpdatable().build()){
    final QueryContext ctx3=new QueryContext(store);
    System.out.println();
    System.out.println("String_Node_Str");
    Sequence result=new XQuery(new SirixCompileChain(store),"String_Node_Str").execute(ctx3);
  }
   try (final DBStore store=DBStore.newBuilder().build()){
    final QueryContext ctx3=new QueryContext(store);
    System.out.println();
    System.out.println("String_Node_Str");
    final String xq3="String_Node_Str";
    System.out.println(xq3);
    XQuery q=new XQuery(new SirixCompileChain(store),xq3);
    q.prettyPrint();
    q.serialize(ctx3,System.out);
    final QueryContext ctx4=new QueryContext(store);
    final String xq4="String_Node_Str";
    q=new XQuery(xq4);
    try (final PrintStream out=new PrintStream(new FileOutputStream(new File(new StringBuilder(LOCATION.getAbsolutePath()).append(File.separator).append("String_Node_Str").toString())))){
      q.prettyPrint().serialize(ctx4,out);
    }
     System.out.println();
    final QueryContext ctx5=new QueryContext(store);
    final String xq5="String_Node_Str";
    q=new XQuery(xq5);
    try (final PrintStream out=new PrintStream(new FileOutputStream(new File(new StringBuilder(LOCATION.getAbsolutePath()).append(File.separator).append(File.separator).append("String_Node_Str").toString())))){
      q.prettyPrint().serialize(ctx5,out);
    }
     System.out.println();
  }
 }