nus-yam/ex-repair huggingface dataset:
Program: 31253
Project: 31253
Buggy source:
private static void putValue(CharSink sink,ColumnType type,Record rec,int col){
switch (type) {
case BOOLEAN:
    sink.put(rec.getBool(col));
  break;
case BYTE:
sink.put(rec.get(col));
break;
case DOUBLE:
sink.putJson(rec.getDouble(col),10);
break;
case FLOAT:
sink.putJson(rec.getFloat(col),10);
break;
case INT:
final int i=rec.getInt(col);
if (i == Integer.MIN_VALUE) {
sink.put("String_Node_Str");
}
 else {
Numbers.append(sink,i);
}
break;
case LONG:
final long l=rec.getLong(col);
if (l == Long.MIN_VALUE) {
sink.put("String_Node_Str");
}
 else {
sink.put('"').put(l).put('"');
}
break;
case DATE:
final long d=rec.getDate(col);
if (d == Long.MIN_VALUE) {
sink.put("String_Node_Str");
break;
}
sink.put('"').putISODate(d).put('"');
break;
case SHORT:
sink.put(rec.getShort(col));
break;
case STRING:
putStringOrNull(sink,rec.getFlyweightStr(col));
break;
case SYMBOL:
putStringOrNull(sink,rec.getSym(col));
break;
case BINARY:
sink.put('[');
sink.put(']');
break;
default :
break;
}
}

Fixed version (ground truth):
private static void putValue(CharSink sink,ColumnType type,Record rec,int col){
switch (type) {
case BOOLEAN:
    sink.put(rec.getBool(col));
  break;
case BYTE:
sink.put(rec.get(col));
break;
case DOUBLE:
sink.putJson(rec.getDouble(col),10);
break;
case FLOAT:
sink.putJson(rec.getFloat(col),10);
break;
case INT:
final int i=rec.getInt(col);
if (i == Integer.MIN_VALUE) {
sink.put("String_Node_Str");
}
 else {
Numbers.append(sink,i);
}
break;
case LONG:
final long l=rec.getLong(col);
if (l == Long.MIN_VALUE) {
sink.put("String_Node_Str");
}
 else {
sink.put(l);
}
break;
case DATE:
final long d=rec.getDate(col);
if (d == Long.MIN_VALUE) {
sink.put("String_Node_Str");
break;
}
sink.put('"').putISODate(d).put('"');
break;
case SHORT:
sink.put(rec.getShort(col));
break;
case STRING:
putStringOrNull(sink,rec.getFlyweightStr(col));
break;
case SYMBOL:
putStringOrNull(sink,rec.getSym(col));
break;
case BINARY:
sink.put('[');
sink.put(']');
break;
default :
break;
}
}
Program: 31256
Project: 31256
Buggy source:
@Test public void testImportIntoBusyJournal2() throws Exception {
  JournalFactory f=new JournalFactory(factory.getConfiguration().getJournalBase().getAbsolutePath());
  try (JournalWriter w=f.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$int("String_Node_Str").$())){
    JournalEntryWriter ew=w.entryWriter();
    ew.putInt(0,3);
    ew.putInt(1,30);
    ew.append();
    w.commit();
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,response));
      Assert.assertTrue(Chars.startsWith(response,"String_Node_Str"));
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportIntoBusyJournal2() throws Exception {
  JournalFactory f=new JournalFactory(factory.getConfiguration().getJournalBase().getAbsolutePath());
  try (JournalWriter w=f.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$int("String_Node_Str").$())){
    JournalEntryWriter ew=w.entryWriter();
    ew.putInt(0,3);
    ew.putInt(1,30);
    ew.append();
    w.commit();
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,response));
      Assert.assertTrue(Chars.startsWith(response,"String_Node_Str"));
    }
 catch (    IOException e) {
      Assert.assertTrue(e.getMessage().contains("String_Node_Str"));
    }
 finally {
      server.halt();
    }
  }
 }
Program: 31257
Project: 31257
Buggy source:
public static void export(RecordSource from,JournalReaderFactory factory,File to,TextFileFormat format) throws JournalException, IOException {
  if (to.isDirectory()) {
    throw new JournalException(to + "String_Node_Str");
  }
  try (FileSink sink=new FileSink(to)){
    RecordSourcePrinter printer=new RecordSourcePrinter(sink,format.getDelimiter());
    printer.printCursor(from,factory);
  }
 }

Fixed version (ground truth):
public static void export(RecordSource from,JournalReaderFactory factory,File to,TextFileFormat format) throws JournalException, IOException {
  if (to.isDirectory()) {
    throw new JournalException(to + "String_Node_Str");
  }
  try (FileSink sink=new FileSink(to)){
    RecordSourcePrinter printer=new RecordSourcePrinter(sink,format.getDelimiter());
    printer.print(from,factory);
  }
 }
Program: 31258
Project: 31258
Buggy source:
@Override public int getStrLen(){
  return nextNull ? 0 : valueColumn.getStrLen(getParentRecord());
}

Fixed version (ground truth):
@Override public int getStrLen(){
  return nextNull ? -1 : valueColumn.getStrLen(getParentRecord());
}
Program: 31259
Project: 31259
Buggy source:
@Override public int getStrLen(){
  return prevRowId == -1 ? 0 : valueColumn.getStrLen(getParentRecord());
}

Fixed version (ground truth):
@Override public int getStrLen(){
  return prevRowId == -1 ? -1 : valueColumn.getStrLen(getParentRecord());
}
Program: 31260
Project: 31260
Buggy source:
public CharSequence getFlyweightStrB(int index){
  long address=address0(index);
  int len=Unsafe.getUnsafe().getInt(address);
  return csB.of(address + 4,address + 4 + len * 2);
}

Fixed version (ground truth):
public CharSequence getFlyweightStrB(int index){
  long address=address0(index);
  int len=Unsafe.getUnsafe().getInt(address);
  return len == VariableColumn.NULL_LEN ? null : csB.of(address + 4,address + 4 + len * 2);
}
Program: 31261
Project: 31261
Buggy source:
public CharSequence getFlyweightStr(int index){
  long address=address0(index);
  int len=Unsafe.getUnsafe().getInt(address);
  return csA.of(address + 4,address + 4 + len * 2);
}

Fixed version (ground truth):
public CharSequence getFlyweightStr(int index){
  long address=address0(index);
  int len=Unsafe.getUnsafe().getInt(address);
  return len == VariableColumn.NULL_LEN ? null : csA.of(address + 4,address + 4 + len * 2);
}
Program: 31262
Project: 31262
Buggy source:
@Override public int getStrLen(Record rec){
  return lhs.getStrLen(rec) + rhs.getStrLen(rec);
}

Fixed version (ground truth):
@Override public int getStrLen(Record rec){
  int ll=lhs.getStrLen(rec);
  int rl=rhs.getStrLen(rec);
  if (ll == VariableColumn.NULL_LEN) {
    return rl;
  }
  if (rl == VariableColumn.NULL_LEN) {
    return ll;
  }
  return ll + rl;
}
Program: 31263
Project: 31263
Buggy source:
public void init(CharSequence lhs,CharSequence rhs){
  this.lhs=lhs;
  this.rhs=rhs;
  this.split=lhs.length();
}

Fixed version (ground truth):
public void init(CharSequence lhs,CharSequence rhs){
  this.lhs=lhs;
  this.rhs=rhs;
  this.rl=rhs == null ? 0 : rhs.length();
  this.split=lhs == null ? 0 : lhs.length();
}
Program: 31264
Project: 31264
Buggy source:
@Override public int length(){
  return split + rhs.length();
}

Fixed version (ground truth):
@Override public int length(){
  return split + rl;
}
Program: 31267
Project: 31267
Buggy source:
@Test public void testImportAppend() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      printer.printCursor(qc.compileSource(f,"String_Node_Str"),f);
      TestUtils.assertEquals("String_Node_Str",sink);
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportAppend() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      printer.print(qc.compileSource(f,"String_Node_Str"),f);
      TestUtils.assertEquals("String_Node_Str",sink);
    }
  finally {
      server.halt();
    }
  }
 }
Program: 31268
Project: 31268
Buggy source:
@Test public void testImportWrongType() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str","String_Node_Str",null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str","String_Node_Str",null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      RecordSource src1=qc.compileSource(f,"String_Node_Str");
      try {
        printer.printCursor(src1,factory);
        TestUtils.assertEquals("String_Node_Str",sink);
      }
  finally {
        Misc.free(src1);
      }
      RecordSource src2=qc.compileSource(factory,"String_Node_Str");
      try {
        Assert.assertEquals(ColumnType.DOUBLE,src2.getMetadata().getColumn("String_Node_Str").getType());
      }
  finally {
        Misc.free(src2);
      }
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportWrongType() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str","String_Node_Str",null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str","String_Node_Str",null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      RecordSource src1=qc.compileSource(f,"String_Node_Str");
      try {
        printer.print(src1,factory);
        TestUtils.assertEquals("String_Node_Str",sink);
      }
  finally {
        Misc.free(src1);
      }
      RecordSource src2=qc.compileSource(factory,"String_Node_Str");
      try {
        Assert.assertEquals(ColumnType.DOUBLE,src2.getMetadata().getColumn("String_Node_Str").getType());
      }
  finally {
        Misc.free(src2);
      }
    }
  finally {
      server.halt();
    }
  }
 }
Program: 31269
Project: 31269
Buggy source:
@Test public void testRowidNonPartitioned() throws Exception {
  AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,compiler.compileSource(factory,"String_Node_Str"),0);
  String expected="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";
  printer.printCursor(source,factory);
  TestUtils.assertEquals(expected,sink);
  source.reset();
  sink.clear();
  printer.printCursor(source,factory);
  TestUtils.assertEquals(expected,sink);
}

Fixed version (ground truth):
@Test public void testRowidNonPartitioned() throws Exception {
  AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,compiler.compileSource(factory,"String_Node_Str"),0);
  String expected="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";
  printer.print(source,factory);
  TestUtils.assertEquals(expected,sink);
  source.reset();
  sink.clear();
  printer.print(source,factory);
  TestUtils.assertEquals(expected,sink);
}
Program: 31270
Project: 31270
Buggy source:
@Test public void testFixNonPartitionedJoin() throws Exception {
  final String expected="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";
  try (AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0)){
    printer.printCursor(source,factory);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.printCursor(source,factory);
    TestUtils.assertEquals(expected,sink);
  }
 }

Fixed version (ground truth):
@Test public void testFixNonPartitionedJoin() throws Exception {
  final String expected="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";
  try (AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0)){
    printer.print(source,factory);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.print(source,factory);
    TestUtils.assertEquals(expected,sink);
  }
 }
Program: 31271
Project: 31271
Buggy source:
@Test public void testVarNonPartitioned() throws Exception {
  AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0);
  String expected="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";
  printer.printCursor(source,factory);
  TestUtils.assertEquals(expected,sink);
}

Fixed version (ground truth):
@Test public void testVarNonPartitioned() throws Exception {
  AsOfJoinRecordSource source=new AsOfJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0);
  String expected="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";
  printer.print(source,factory);
  TestUtils.assertEquals(expected,sink);
}
Program: 31272
Project: 31272
Buggy source:
@Test public void testFixJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0,keys,keys,128,128,128)){
    printer.printCursor(source,factory);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.printCursor(source,factory);
    TestUtils.assertEquals(expected,sink);
  }
 }

Fixed version (ground truth):
@Test public void testFixJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0,keys,keys,128,128,128)){
    printer.print(source,factory);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.print(source,factory);
    TestUtils.assertEquals(expected,sink);
  }
 }
Program: 31273
Project: 31273
Buggy source:
@Test public void testRowidJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,compiler.compileSource(factory,"String_Node_Str"),0,keys,keys,512,512,512)){
    printer.printCursor(source,factory,true);
    TestUtils.assertEquals(expected,sink);
    sink.clear();
    source.reset();
    printer.printCursor(source,factory,true);
    TestUtils.assertEquals(expected,sink);
  }
 }

Fixed version (ground truth):
@Test public void testRowidJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,compiler.compileSource(factory,"String_Node_Str"),0,keys,keys,512,512,512)){
    printer.print(source,factory,true);
    TestUtils.assertEquals(expected,sink);
    sink.clear();
    source.reset();
    printer.print(source,factory,true);
    TestUtils.assertEquals(expected,sink);
  }
 }
Program: 31274
Project: 31274
Buggy source:
@Test public void testVarJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0,keys,keys,512,512,512)){
    printer.printCursor(source,factory,true);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.printCursor(source,factory,true);
    TestUtils.assertEquals(expected,sink);
  }
 }

Fixed version (ground truth):
@Test public void testVarJoin() throws Exception {
  final String expected="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";
  try (AsOfPartitionedJoinRecordSource source=new AsOfPartitionedJoinRecordSource(compiler.compileSource(factory,"String_Node_Str"),0,new NoRowidSource().of(compiler.compileSource(factory,"String_Node_Str")),0,keys,keys,512,512,512)){
    printer.print(source,factory,true);
    TestUtils.assertEquals(expected,sink);
    source.reset();
    sink.clear();
    printer.print(source,factory,true);
    TestUtils.assertEquals(expected,sink);
  }
 }
Program: 31278
Project: 31278
Buggy source:
@Test public void testCrossJoin() throws Exception {
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.commit();
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.commit();
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new CrossJoinRecordSource(new JournalSource(new JournalPartitionSource(aw.getMetadata(),false),new AllRowSource()),new JournalSource(new JournalPartitionSource(bw.getMetadata(),false),new AllRowSource())),factory);
  final String expected="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";
  TestUtils.assertEquals(expected,sink);
}

Fixed version (ground truth):
@Test public void testCrossJoin() throws Exception {
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.append(new Band().setName("String_Node_Str").setType("String_Node_Str").setUrl("String_Node_Str"));
  bw.commit();
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.append(new Album().setName("String_Node_Str").setBand("String_Node_Str").setGenre("String_Node_Str"));
  aw.commit();
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new CrossJoinRecordSource(new JournalSource(new JournalPartitionSource(aw.getMetadata(),false),new AllRowSource()),new JournalSource(new JournalPartitionSource(bw.getMetadata(),false),new AllRowSource())),factory);
  final String expected="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";
  TestUtils.assertEquals(expected,sink);
}
Program: 31279
Project: 31279
Buggy source:
private void assertEquals(CharSequence expected,RecordSource src) throws JournalException, IOException {
  new RecordSourcePrinter(sink).printCursor(src,factory);
  Assert.assertEquals(expected,sink.toString());
  sink.flush();
}

Fixed version (ground truth):
private void assertEquals(CharSequence expected,RecordSource src) throws JournalException, IOException {
  new RecordSourcePrinter(sink).print(src,factory);
  Assert.assertEquals(expected,sink.toString());
  sink.flush();
}
Program: 31280
Project: 31280
Buggy source:
@Test public void testTail() throws Exception {
  final String expected="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"+ "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";
  JournalWriter<Quote> w=factory.writer(Quote.class);
  long lo=Dates.parseDateTime("String_Node_Str");
  long hi=Dates.parseDateTime("String_Node_Str");
  TestUtils.generateQuoteData(w,100,new Interval(lo,hi));
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new JournalSource(new JournalTailPartitionSource(w.getMetadata(),false,Rows.toRowID(1,30)),new AllRowSource()),factory);
  Assert.assertEquals(expected,sink.toString());
}

Fixed version (ground truth):
@Test public void testTail() throws Exception {
  final String expected="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"+ "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";
  JournalWriter<Quote> w=factory.writer(Quote.class);
  long lo=Dates.parseDateTime("String_Node_Str");
  long hi=Dates.parseDateTime("String_Node_Str");
  TestUtils.generateQuoteData(w,100,new Interval(lo,hi));
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new JournalSource(new JournalTailPartitionSource(w.getMetadata(),false,Rows.toRowID(1,30)),new AllRowSource()),factory);
  Assert.assertEquals(expected,sink.toString());
}
Program: 31281
Project: 31281
Buggy source:
@Test public void testBottomSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(99997),new LongConstant(100000)),factory);
  final String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  Assert.assertEquals(expected,sink.toString());
}

Fixed version (ground truth):
@Test public void testBottomSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(99997),new LongConstant(100000)),factory);
  final String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  Assert.assertEquals(expected,sink.toString());
}
Program: 31282
Project: 31282
Buggy source:
@Test public void testTopSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(0),new LongConstant(10)),factory);
  final String expected="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";
  Assert.assertEquals(expected,sink.toString());
}

Fixed version (ground truth):
@Test public void testTopSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(0),new LongConstant(10)),factory);
  final String expected="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";
  Assert.assertEquals(expected,sink.toString());
}
Program: 31283
Project: 31283
Buggy source:
@Test public void testNoRows() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(99997),new LongConstant(10)),factory);
  Assert.assertEquals("String_Node_Str",sink.toString());
}

Fixed version (ground truth):
@Test public void testNoRows() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(99997),new LongConstant(10)),factory);
  Assert.assertEquals("String_Node_Str",sink.toString());
}
Program: 31284
Project: 31284
Buggy source:
@Test public void testMiddleSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.printCursor(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(102),new LongConstant(112)),factory);
  final String expected="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";
  Assert.assertEquals(expected,sink.toString());
}

Fixed version (ground truth):
@Test public void testMiddleSource() throws Exception {
  JournalWriter<Quote> w=factory.writer(Quote.class);
  TestUtils.generateQuoteData(w,100000);
  StringSink sink=new StringSink();
  RecordSourcePrinter p=new RecordSourcePrinter(sink);
  p.print(new TopRecordSource(compiler.compileSource(factory,"String_Node_Str"),new LongConstant(102),new LongConstant(112)),factory);
  final String expected="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";
  Assert.assertEquals(expected,sink.toString());
}
Program: 31285
Project: 31285
Buggy source:
@Override public void scroll(Record record){
  DirectMap.KeyWriter kw=map.keyWriter();
  for (int i=0, n=partitionBy.size(); i < n; i++) {
    MapUtils.writeVirtualColumn(kw,record,partitionBy.getQuick(i));
  }
  MapValues values=map.getOrCreateValues(kw);
  if (values.isNew()) {
    nextNull=true;
    store(record,values);
  }
 else {
    nextNull=false;
switch (valueColumn.getType()) {
case BOOLEAN:
      Unsafe.getUnsafe().putByte(bufPtr,values.getByte(0));
    values.putByte(0,(byte)(valueColumn.getBool(record) ? 1 : 0));
  break;
case BYTE:
Unsafe.getUnsafe().putByte(bufPtr,values.getByte(0));
values.putByte(0,valueColumn.get(record));
break;
case DOUBLE:
Unsafe.getUnsafe().putDouble(bufPtr,values.getDouble(0));
values.putDouble(0,valueColumn.getDouble(record));
break;
case FLOAT:
Unsafe.getUnsafe().putFloat(bufPtr,values.getFloat(0));
values.putFloat(0,valueColumn.getFloat(record));
break;
case SYMBOL:
case INT:
Unsafe.getUnsafe().putInt(bufPtr,values.getInt(0));
values.putInt(0,valueColumn.getInt(record));
break;
case LONG:
case DATE:
Unsafe.getUnsafe().putLong(bufPtr,values.getLong(0));
values.putLong(0,valueColumn.getLong(record));
break;
case SHORT:
Unsafe.getUnsafe().putShort(bufPtr,values.getShort(0));
values.putShort(0,valueColumn.getShort(record));
break;
default :
throw new JournalRuntimeException("String_Node_Str" + valueColumn.getType());
}
}
}

Fixed version (ground truth):
@Override public void scroll(Record record){
  DirectMap.KeyWriter kw=map.keyWriter();
  for (int i=0, n=partitionBy.size(); i < n; i++) {
    MapUtils.writeVirtualColumn(kw,record,partitionBy.getQuick(i));
  }
  MapValues values=map.getOrCreateValues(kw);
  if (values.isNew()) {
    nextNull=true;
    store(record,values);
  }
 else {
    nextNull=false;
switch (valueColumn.getType()) {
case BOOLEAN:
      Unsafe.getUnsafe().putByte(bufPtr,values.get(0));
    values.putByte(0,(byte)(valueColumn.getBool(record) ? 1 : 0));
  break;
case BYTE:
Unsafe.getUnsafe().putByte(bufPtr,values.get(0));
values.putByte(0,valueColumn.get(record));
break;
case DOUBLE:
Unsafe.getUnsafe().putDouble(bufPtr,values.getDouble(0));
values.putDouble(0,valueColumn.getDouble(record));
break;
case FLOAT:
Unsafe.getUnsafe().putFloat(bufPtr,values.getFloat(0));
values.putFloat(0,valueColumn.getFloat(record));
break;
case SYMBOL:
case INT:
Unsafe.getUnsafe().putInt(bufPtr,values.getInt(0));
values.putInt(0,valueColumn.getInt(record));
break;
case LONG:
case DATE:
Unsafe.getUnsafe().putLong(bufPtr,values.getLong(0));
values.putLong(0,valueColumn.getLong(record));
break;
case SHORT:
Unsafe.getUnsafe().putShort(bufPtr,values.getShort(0));
values.putShort(0,valueColumn.getShort(record));
break;
default :
throw new JournalRuntimeException("String_Node_Str" + valueColumn.getType());
}
}
}
Program: 31286
Project: 31286
Buggy source:
public Record get(Record master){
  MapValues values=getByMaster(master);
  if (values == null || values.getByte(1) == 1) {
    return null;
  }
  values.putByte(1,(byte)1);
  return slaveCursor.recordAt(values.getLong(0));
}

Fixed version (ground truth):
public Record get(Record master){
  MapValues values=getByMaster(master);
  if (values == null || values.get(1) == 1) {
    return null;
  }
  values.putByte(1,(byte)1);
  return slaveCursor.recordAt(values.getLong(0));
}
Program: 31287
Project: 31287
Buggy source:
private void rehash(){
  int capacity=keyCapacity << 1;
  mask=capacity - 1;
  DirectLongList pointers=new DirectLongList(capacity);
  pointers.setPos(capacity);
  pointers.zero(-1);
  for (int i=0, k=this.offsets.size(); i < k; i++) {
    long offset=this.offsets.get(i);
    if (offset == -1) {
      continue;
    }
    int index=Hash.hashMem(kStart + offset + keyBlockOffset,Unsafe.getUnsafe().getInt(kStart + offset) - keyBlockOffset) & mask;
    while (pointers.get(index) != -1) {
      index=(index + 1) & mask;
    }
    pointers.set(index,offset);
  }
  this.offsets.free();
  this.offsets=pointers;
  this.free+=(capacity - keyCapacity) * loadFactor;
  this.keyCapacity=capacity;
}

Fixed version (ground truth):
private void rehash(){
  int capacity=keyCapacity << 1;
  mask=capacity - 1;
  DirectLongList pointers=new DirectLongList(capacity);
  pointers.setPos(capacity);
  pointers.zero(-1);
  for (int i=0, k=this.offsets.size(); i < k; i++) {
    long offset=this.offsets.get(i);
    if (offset == -1) {
      continue;
    }
    int index=Hash.hashMem(kStart + offset + keyDataOffset,Unsafe.getUnsafe().getInt(kStart + offset) - keyDataOffset) & mask;
    while (pointers.get(index) != -1) {
      index=(index + 1) & mask;
    }
    pointers.set(index,offset);
  }
  this.offsets.free();
  this.offsets=pointers;
  this.free+=(capacity - keyCapacity) * loadFactor;
  this.keyCapacity=capacity;
}
Program: 31288
Project: 31288
Buggy source:
public MapValues getValues(KeyWriter keyWriter){
  keyWriter.commit();
  kPos=keyWriter.startAddr;
  int index=Hash.hashMem(keyWriter.startAddr + keyBlockOffset,keyWriter.len - keyBlockOffset) & mask;
  long offset=offsets.get(index);
  if (offset == -1) {
    return null;
  }
 else   if (eq(keyWriter,offset)) {
    return values.of(kStart + offset,false);
  }
 else {
    return probeReadOnly(keyWriter,index);
  }
}

Fixed version (ground truth):
public MapValues getValues(KeyWriter keyWriter){
  keyWriter.commit();
  kPos=keyWriter.startAddr;
  int index=Hash.hashMem(keyWriter.startAddr + keyDataOffset,keyWriter.len - keyDataOffset) & mask;
  long offset=offsets.get(index);
  if (offset == -1) {
    return null;
  }
 else   if (eq(keyWriter,offset)) {
    return values.of(kStart + offset,false);
  }
 else {
    return probeReadOnly(keyWriter,index);
  }
}
Program: 31289
Project: 31289
Buggy source:
private boolean eq(KeyWriter keyWriter,long offset){
  long a=kStart + offset;
  long b=keyWriter.startAddr;
  if (Unsafe.getUnsafe().getInt(a) != Unsafe.getUnsafe().getInt(b)) {
    return false;
  }
  long lim=b + keyWriter.len;
  a+=keyBlockOffset;
  b+=keyBlockOffset;
  while (b < lim - 8) {
    if (Unsafe.getUnsafe().getLong(a) != Unsafe.getUnsafe().getLong(b)) {
      return false;
    }
    a+=8;
    b+=8;
  }
  while (b < lim) {
    if (Unsafe.getUnsafe().getByte(a++) != Unsafe.getUnsafe().getByte(b++)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean eq(KeyWriter keyWriter,long offset){
  long a=kStart + offset;
  long b=keyWriter.startAddr;
  if (Unsafe.getUnsafe().getInt(a) != Unsafe.getUnsafe().getInt(b)) {
    return false;
  }
  long lim=b + keyWriter.len;
  a+=keyDataOffset;
  b+=keyDataOffset;
  while (b < lim - 8) {
    if (Unsafe.getUnsafe().getLong(a) != Unsafe.getUnsafe().getLong(b)) {
      return false;
    }
    a+=8;
    b+=8;
  }
  while (b < lim) {
    if (Unsafe.getUnsafe().getByte(a++) != Unsafe.getUnsafe().getByte(b++)) {
      return false;
    }
  }
  return true;
}
Program: 31290
Project: 31290
Buggy source:
public MapValues getOrCreateValues(KeyWriter keyWriter){
  keyWriter.commit();
  int index=Hash.hashMem(keyWriter.startAddr + keyBlockOffset,keyWriter.len - keyBlockOffset) & mask;
  long offset=offsets.get(index);
  if (offset == -1) {
    offsets.set(index,keyWriter.startAddr - kStart);
    if (--free == 0) {
      rehash();
    }
    size++;
    return values.of(keyWriter.startAddr,true);
  }
 else   if (eq(keyWriter,offset)) {
    kPos=keyWriter.startAddr;
    return values.of(kStart + offset,false);
  }
 else {
    return probe0(keyWriter,index);
  }
}

Fixed version (ground truth):
public MapValues getOrCreateValues(KeyWriter keyWriter){
  keyWriter.commit();
  int index=Hash.hashMem(keyWriter.startAddr + keyDataOffset,keyWriter.len - keyDataOffset) & mask;
  long offset=offsets.get(index);
  if (offset == -1) {
    offsets.set(index,keyWriter.startAddr - kStart);
    if (--free == 0) {
      rehash();
    }
    size++;
    return values.of(keyWriter.startAddr,true);
  }
 else   if (eq(keyWriter,offset)) {
    kPos=keyWriter.startAddr;
    return values.of(kStart + offset,false);
  }
 else {
    return probe0(keyWriter,index);
  }
}
Program: 31291
Project: 31291
Buggy source:
private void copyToBuffer(long ptr){
  int l=toByteLen(Unsafe.getUnsafe().getInt(ptr));
  if (l >= bufPtrLen) {
    if (bufPtr != 0) {
      Unsafe.getUnsafe().freeMemory(bufPtr);
    }
    bufPtrLen=Numbers.ceilPow2(l);
    bufPtr=Unsafe.getUnsafe().allocateMemory(bufPtrLen);
    cs.of(bufPtr + 4,bufPtr + bufPtrLen);
  }
  Unsafe.getUnsafe().copyMemory(ptr,bufPtr,l);
}

Fixed version (ground truth):
private void copyToBuffer(long ptr){
  int l=toByteLen(Unsafe.getUnsafe().getInt(ptr));
  if (l >= bufPtrLen) {
    if (bufPtr != 0) {
      Unsafe.getUnsafe().freeMemory(bufPtr);
    }
    bufPtrLen=Numbers.ceilPow2(l);
    bufPtr=Unsafe.getUnsafe().allocateMemory(bufPtrLen);
    cs.of(bufPtr + 4,bufPtr + bufPtrLen);
  }
 else {
    cs.of(bufPtr + 4,bufPtr + l);
  }
  Unsafe.getUnsafe().copyMemory(ptr,bufPtr,l);
}
Program: 31292
Project: 31292
Buggy source:
@Override public void toSink(CharSink sink){
}

Fixed version (ground truth):
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put(functions.size()).put(',');
  sink.putQuoted("String_Node_Str").put(':').put(parentSource);
  sink.put('}');
}
Program: 31293
Project: 31293
Buggy source:
RecordCursor prepareCursor(JournalReaderFactory factory) throws JournalException ;

Fixed version (ground truth):
RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException ;
Program: 31294
Project: 31294
Buggy source:
@Override public void close() throws IOException {
  Misc.free(this.map);
  Misc.free(recordSource);
}

Fixed version (ground truth):
@Override public void close(){
  Misc.free(this.map);
  Misc.free(recordSource);
}
Program: 31295
Project: 31295
Buggy source:
@Override public void close() throws IOException {
  Misc.free(recordHolder);
  Misc.free(delayedHolder);
  Misc.free(master);
  Misc.free(slave);
}

Fixed version (ground truth):
@Override public void close(){
  Misc.free(recordHolder);
  Misc.free(delayedHolder);
  Misc.free(master);
  Misc.free(slave);
}
Program: 31296
Project: 31296
Buggy source:
@Override public void close() throws IOException {
}

Fixed version (ground truth):
@Override public void close(){
}
Program: 31297
Project: 31297
Buggy source:
@Override public void close() throws IOException {
  Misc.free(recordMap);
  Misc.free(master);
  Misc.free(slave);
}

Fixed version (ground truth):
@Override public void close(){
  Misc.free(recordMap);
  Misc.free(master);
  Misc.free(slave);
}
Program: 31298
Project: 31298
Buggy source:
@Override public void close() throws IOException {
  Misc.free(recordSource);
}

Fixed version (ground truth):
@Override public void close(){
  Misc.free(recordSource);
}
Program: 31299
Project: 31299
Buggy source:
@Override public Record next(){
  DirectMapEntry entry=mapCursor.next();
  if (interceptors != null) {
    for (int i=0, n=interceptors.size(); i < n; i++) {
      interceptors.getQuick(i).beforeRecord(entry.values());
    }
  }
  return record.of(entry);
}

Fixed version (ground truth):
@Override public Record next(){
  DirectMapEntry entry=mapCursor.next();
  if (interceptors != null) {
    notifyInterceptors(entry);
  }
  return record.of(entry);
}
Program: 31300
Project: 31300
Buggy source:
@Override public StorageFacade getStorageFacade(){
  return recordCursor.getStorageFacade();
}

Fixed version (ground truth):
@Override public StorageFacade getStorageFacade(){
  return storageFacade;
}
Program: 31301
Project: 31301
Buggy source:
@Override public boolean supportsRowIdAccess(){
  return false;
}

Fixed version (ground truth):
@Override public boolean supportsRowIdAccess(){
  return true;
}
Program: 31302
Project: 31302
Buggy source:
@Override public void recordAt(Record record,long atRowId){
}

Fixed version (ground truth):
@Override public void recordAt(Record record,long atRowId){
  DirectMapEntry entry=map.entryAt(atRowId);
  if (interceptors != null) {
    notifyInterceptors(entry);
  }
  ((DirectMapRecord)record).of(entry);
}
Program: 31303
Project: 31303
Buggy source:
@Override public Record newRecord(){
  return null;
}

Fixed version (ground truth):
@Override public Record newRecord(){
  return new DirectMapRecord(storageFacade);
}
Program: 31307
Project: 31307
Buggy source:
@Override public long getRowId(){
  return rowid;
}

Fixed version (ground truth):
@Override public long getRowId(){
  return Rows.toRowID(partitionIndex,rowid);
}
Program: 31308
Project: 31308
Buggy source:
@Override public void recordAt(Record record,long atRowId){
  ((JournalRecord)record).rowid=atRowId;
}

Fixed version (ground truth):
@Override public void recordAt(Record record,long atRowId){
  ((JournalRecord)record).rowid=Rows.toLocalRowID(atRowId);
  setPartition((JournalRecord)record,atRowId);
}
Program: 31309
Project: 31309
Buggy source:
@SuppressWarnings("String_Node_Str") private boolean nextSlice(){
  while (partitionCursor.hasNext()) {
    PartitionSlice slice=partitionCursor.next();
    cursor=rowSource.prepareCursor(slice);
    if (cursor == null) {
      return false;
    }
    if (cursor.hasNext()) {
      rec.partition=slice.partition;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private boolean nextSlice(){
  while (partitionCursor.hasNext()) {
    PartitionSlice slice=partitionCursor.next();
    cursor=rowSource.prepareCursor(slice);
    if (cursor == null) {
      return false;
    }
    if (cursor.hasNext()) {
      rec.partition=slice.partition;
      rec.partitionIndex=slice.partition.getPartitionIndex();
      return true;
    }
  }
  return false;
}
Program: 31310
Project: 31310
Buggy source:
private Record getParentRecord(){
  return parent.recordAt(prevRowId);
}

Fixed version (ground truth):
private Record getParentRecord(){
  parent.recordAt(record,prevRowId);
  return record;
}
Program: 31311
Project: 31311
Buggy source:
@Override public void setParent(RecordCursor cursor){
  parent=cursor;
}

Fixed version (ground truth):
@Override public void setParent(RecordCursor cursor){
  parent=cursor;
  this.record=cursor.newRecord();
}
Program: 31312
Project: 31312
Buggy source:
@Before public void setUp() throws Exception {
  try (JournalWriter w=factory.bulkWriter(new JournalStructure("String_Node_Str").$int("String_Node_Str").$double("String_Node_Str").$float("String_Node_Str").$byte("String_Node_Str").$long("String_Node_Str").$str("String_Node_Str").$bool("String_Node_Str").$sym("String_Node_Str").$short("String_Node_Str").$date("String_Node_Str").$ts().partitionBy(PartitionType.DAY).$())){
    Rnd rnd=new Rnd();
    int n=24 * 3;
    int timestep=60 * 60 * 1000;
    String[] sym={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    String[] str=new String[16];
    for (int i=0; i < str.length; i++) {
      str[i]=rnd.nextString(rnd.nextPositiveInt() % 10);
    }
    long t=Dates.toMillis(2016,5,1,10,20);
    for (int i=0; i < n; i++) {
      JournalEntryWriter ew=w.entryWriter(t+=timestep);
      ew.putInt(0,rnd.nextInt() % 15);
      ew.putDouble(1,rnd.nextDouble());
      ew.putFloat(2,rnd.nextFloat());
      ew.put(3,(byte)rnd.nextInt());
      ew.putLong(4,rnd.nextLong() % 30);
      ew.putStr(5,str[rnd.nextPositiveInt() % str.length]);
      ew.putBool(6,rnd.nextBoolean());
      ew.putSym(7,sym[rnd.nextPositiveInt() % sym.length]);
      ew.putShort(8,(short)(rnd.nextInt() % 20));
      ew.putDate(9,rnd.nextLong());
      ew.append();
    }
    w.commit();
  }
 }

Fixed version (ground truth):
@BeforeClass public static void setUp() throws Exception {
  try (JournalWriter w=factory.bulkWriter(new JournalStructure("String_Node_Str").$int("String_Node_Str").$double("String_Node_Str").$float("String_Node_Str").$byte("String_Node_Str").$long("String_Node_Str").$str("String_Node_Str").$bool("String_Node_Str").$sym("String_Node_Str").$short("String_Node_Str").$date("String_Node_Str").$ts().partitionBy(PartitionType.DAY).$())){
    Rnd rnd=new Rnd();
    int n=24 * 3;
    int timestep=60 * 60 * 1000;
    String[] sym={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    String[] str=new String[16];
    for (int i=0; i < str.length; i++) {
      str[i]=rnd.nextString(rnd.nextPositiveInt() % 10);
    }
    long t=Dates.toMillis(2016,5,1,10,20);
    for (int i=0; i < n; i++) {
      JournalEntryWriter ew=w.entryWriter(t+=timestep);
      ew.putInt(0,rnd.nextInt() % 15);
      ew.putDouble(1,rnd.nextDouble());
      ew.putFloat(2,rnd.nextFloat());
      ew.put(3,(byte)rnd.nextInt());
      ew.putLong(4,rnd.nextLong() % 30);
      ew.putStr(5,str[rnd.nextPositiveInt() % str.length]);
      ew.putBool(6,rnd.nextBoolean());
      ew.putSym(7,sym[rnd.nextPositiveInt() % sym.length]);
      ew.putShort(8,(short)(rnd.nextInt() % 20));
      ew.putDate(9,rnd.nextLong());
      ew.append();
    }
    w.commit();
  }
 }