nus-yam/ex-repair huggingface dataset:
Program: 22579
Project: 22579
Buggy source:
public PFCDictionarySectionMap(CountInputStream input,File f) throws IOException {
  this.f=f;
  startOffset=input.getTotalBytes();
  CRCInputStream crcin=new CRCInputStream(input,new CRC8());
  int type=crcin.read();
  if (type != TYPE_INDEX) {
    throw new IllegalFormatException("String_Node_Str");
  }
  numstrings=(int)VByte.decode(crcin);
  dataSize=VByte.decode(crcin);
  blocksize=(int)VByte.decode(crcin);
  if (!crcin.readCRCAndCheck()) {
    throw new CRCException("String_Node_Str");
  }
  blocks=SequenceFactory.createStream(input,f);
  long base=input.getTotalBytes();
  IOUtil.skip(crcin,dataSize + 4);
  endOffset=input.getTotalBytes();
  ch=new FileInputStream(f).getChannel();
  int block=0;
  int buffer=0;
  long numBlocks=blocks.getNumberOfElements();
  long bytePos=0;
  long numBuffers=1 + numBlocks / BLOCKS_PER_BYTEBUFFER;
  buffers=new ByteBuffer[(int)numBuffers];
  posFirst=new long[(int)numBuffers];
  while (block < numBlocks - 1) {
    int nextBlock=(int)Math.min(numBlocks - 1,block + BLOCKS_PER_BYTEBUFFER);
    long nextBytePos=blocks.get(nextBlock);
    buffers[buffer]=ch.map(MapMode.READ_ONLY,base + bytePos,nextBytePos - bytePos);
    buffers[buffer].order(ByteOrder.LITTLE_ENDIAN);
    posFirst[buffer]=bytePos;
    bytePos=nextBytePos;
    block+=BLOCKS_PER_BYTEBUFFER;
    buffer++;
  }
}

Fixed version (ground truth):
public PFCDictionarySectionMap(CountInputStream input,File f) throws IOException {
  this.f=f;
  startOffset=input.getTotalBytes();
  CRCInputStream crcin=new CRCInputStream(input,new CRC8());
  int type=crcin.read();
  if (type != TYPE_INDEX) {
    throw new IllegalFormatException("String_Node_Str");
  }
  numstrings=(int)VByte.decode(crcin);
  dataSize=VByte.decode(crcin);
  blocksize=(int)VByte.decode(crcin);
  if (!crcin.readCRCAndCheck()) {
    throw new CRCException("String_Node_Str");
  }
  blocks=SequenceFactory.createStream(input,f);
  long base=input.getTotalBytes();
  IOUtil.skip(crcin,dataSize + 4);
  endOffset=input.getTotalBytes();
  ch=FileChannel.open(Paths.get(f.toString()));
  int block=0;
  int buffer=0;
  long numBlocks=blocks.getNumberOfElements();
  long bytePos=0;
  long numBuffers=1 + numBlocks / BLOCKS_PER_BYTEBUFFER;
  buffers=new ByteBuffer[(int)numBuffers];
  posFirst=new long[(int)numBuffers];
  while (block < numBlocks - 1) {
    int nextBlock=(int)Math.min(numBlocks - 1,block + BLOCKS_PER_BYTEBUFFER);
    long nextBytePos=blocks.get(nextBlock);
    buffers[buffer]=ch.map(MapMode.READ_ONLY,base + bytePos,nextBytePos - bytePos);
    buffers[buffer].order(ByteOrder.LITTLE_ENDIAN);
    posFirst[buffer]=bytePos;
    bytePos=nextBytePos;
    block+=BLOCKS_PER_BYTEBUFFER;
    buffer++;
  }
}
Program: 22580
Project: 22580
Buggy source:
@Override public void close() throws IOException {
  ch.close();
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  blocks.close();
  buffers=null;
  System.gc();
  ch.close();
}
Program: 22581
Project: 22581
Buggy source:
@Override public void loadOrCreateIndex(ProgressListener listener){
  ControlInfo ci=new ControlInformation();
  String indexName=hdtFileName + HDTVersion.get_index_suffix("String_Node_Str");
  indexName=indexName.replaceAll("String_Node_Str","String_Node_Str");
  String versionName=indexName;
  File ff=new File(indexName);
  if (!ff.isFile() || !ff.canRead()) {
    indexName=hdtFileName + ("String_Node_Str");
    indexName=indexName.replaceAll("String_Node_Str","String_Node_Str");
    ff=new File(indexName);
  }
  try {
    CountInputStream in=new CountInputStream(new BufferedInputStream(new FileInputStream(ff)));
    ci.load(in);
    if (isMapped) {
      triples.mapIndex(in,new File(indexName),ci,listener);
    }
 else {
      triples.loadIndex(in,ci,listener);
    }
    in.close();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    triples.generateIndex(listener);
    try {
      FileOutputStream out=new FileOutputStream(versionName);
      ci.clear();
      triples.saveIndex(out,ci,listener);
      out.close();
    }
 catch (    IOException e2) {
    }
  }
}

Fixed version (ground truth):
@Override public void loadOrCreateIndex(ProgressListener listener){
  ControlInfo ci=new ControlInformation();
  String indexName=hdtFileName + HDTVersion.get_index_suffix("String_Node_Str");
  indexName=indexName.replaceAll("String_Node_Str","String_Node_Str");
  String versionName=indexName;
  File ff=new File(indexName);
  if (!ff.isFile() || !ff.canRead()) {
    indexName=hdtFileName + ("String_Node_Str");
    indexName=indexName.replaceAll("String_Node_Str","String_Node_Str");
    ff=new File(indexName);
  }
  CountInputStream in=null;
  try {
    in=new CountInputStream(new BufferedInputStream(new FileInputStream(ff)));
    ci.load(in);
    if (isMapped) {
      triples.mapIndex(in,new File(indexName),ci,listener);
    }
 else {
      triples.loadIndex(in,ci,listener);
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    triples.generateIndex(listener);
    FileOutputStream out=null;
    try {
      out=new FileOutputStream(versionName);
      ci.clear();
      triples.saveIndex(out,ci,listener);
      out.close();
    }
 catch (    IOException e2) {
    }
 finally {
      IOUtil.closeQuietly(out);
    }
  }
 finally {
    IOUtil.closeQuietly(in);
  }
}
Program: 22582
Project: 22582
Buggy source:
@Override public void close() throws IOException {
  seqY.close();
  seqY=null;
  seqZ.close();
  seqZ=null;
  if (indexZ != null) {
    indexZ.close();
    indexZ=null;
  }
  if (predicateCount != null) {
    predicateCount.close();
    predicateCount=null;
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  seqY.close();
  seqY=null;
  seqZ.close();
  seqZ=null;
  if (indexZ != null) {
    indexZ.close();
    indexZ=null;
  }
  if (predicateCount != null) {
    predicateCount.close();
    predicateCount=null;
  }
  if (predicateIndex != null) {
    predicateIndex.close();
    predicateIndex=null;
  }
}
Program: 22584
Project: 22584
Buggy source:
private static HDTId getID(Node n,NodeDictionary dict,PrefixMapping prefixMapping){
  int id=dict.getIntID(n,prefixMapping,TripleComponentRole.SUBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.SUBJECT,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.PREDICATE);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.PREDICATE,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.OBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.OBJECT,dict);
  }
  return null;
}

Fixed version (ground truth):
private static HDTId getID(Node n,NodeDictionary dict,PrefixMapping prefixMapping){
  int id=dict.getIntID(n,prefixMapping,TripleComponentRole.SUBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.SUBJECT,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.PREDICATE);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.PREDICATE,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.OBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.OBJECT,dict);
  }
  return new HDTId(id,null,dict);
}
Program: 22585
Project: 22585
Buggy source:
@Override public IteratorTripleID search(TripleID pattern){
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    if (this.predicateIndex != null) {
      return new BitmapTriplesIteratorYFOQ(this,pattern);
    }
 else {
      return new BitmapTriplesIteratorY(this,pattern);
    }
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}

Fixed version (ground truth):
@Override public IteratorTripleID search(TripleID pattern){
  if (getNumberOfElements() == 0) {
    return new EmptyTriplesIterator(order);
  }
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    if (this.predicateIndex != null) {
      return new BitmapTriplesIteratorYFOQ(this,pattern);
    }
 else {
      return new BitmapTriplesIteratorY(this,pattern);
    }
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}
Program: 22586
Project: 22586
Buggy source:
@Test public void testCase(){
  List<Iterator<Integer>> list=new ArrayList<>();
  list.add(listA.iterator());
  list.add(listB.iterator());
  list.add(listC.iterator());
  Iterator<Integer> it=new MultiMerge<Integer>(list.iterator(),new IntegerComparator());
  it=new SortedReduceIterator<>(it,new ReducerLeft<Integer>());
  Iterator<Integer> itE=listOutB.iterator();
  while (it.hasNext()) {
    assertEquals(itE.hasNext(),it.hasNext());
    int val=it.next();
    int valE=itE.next();
    System.out.println(val);
    assertEquals(val,valE);
  }
  assertEquals(itE.hasNext(),it.hasNext());
}

Fixed version (ground truth):
@Test public void testCase(){
  List<Iterator<Integer>> list=new ArrayList<>();
  list.add(listA.iterator());
  list.add(listB.iterator());
  list.add(listC.iterator());
  Iterator<Integer> it=new MultiMerge<Integer>(list.iterator(),new IntegerComparator());
  it=new SortedReduceIterator<>(it,new ReducerLeft<Integer>());
  Iterator<Integer> itE=listOutB.iterator();
  while (it.hasNext()) {
    assertEquals(itE.hasNext(),it.hasNext());
    int val=it.next();
    int valE=itE.next();
    assertEquals(val,valE);
  }
  assertEquals(itE.hasNext(),it.hasNext());
}
Program: 22587
Project: 22587
Buggy source:
public ReorderTransformationHDT(HDTGraph graph){
  this.stats=graph.getStatisticsHandler();
  numTriples=graph.size();
  initializeMatcher();
  Dictionary dict=graph.getHDT().getDictionary();
  TERM_S=dict.getNsubjects() / numTriples;
  TERM_P=dict.getNpredicates() / numTriples;
  TERM_O=dict.getNobjects() / numTriples;
}

Fixed version (ground truth):
public ReorderTransformationHDT(HDTGraph graph){
  this.stats=graph.getStatisticsHandler();
  numTriples=graph.size();
  initializeMatcher();
  Dictionary dict=graph.getHDT().getDictionary();
  TERM_S=dict.getNsubjects() / Math.max(numTriples,1);
  TERM_P=dict.getNpredicates() / Math.max(numTriples,1);
  TERM_O=dict.getNobjects() / Math.max(numTriples,1);
}
Program: 22589
Project: 22589
Buggy source:
public static final Var asVar(Node node){
  if (Var.isVar(node))   return Var.alloc(node);
  return null;
}

Fixed version (ground truth):
public static Var asVar(Node node){
  if (Var.isVar(node))   return Var.alloc(node);
  return null;
}
Program: 22590
Project: 22590
Buggy source:
@Override public Node get1(Var var){
  try {
    HDTId id=idBinding.get(var);
    if (id == null)     return null;
    Node n=id.getNode();
    if (n == null) {
      n=id.getDictionary().getNode(id);
      id.setNode(n);
    }
    return n;
  }
 catch (  Exception ex) {
    Log.fatal(this,String.format("String_Node_Str",var),ex);
    return null;
  }
}

Fixed version (ground truth):
@Override public Node get1(Var var){
  try {
    HDTId id=idBinding.get(var);
    if (id == null)     return null;
    return id.getNode();
  }
 catch (  Exception ex) {
    Log.fatal(this,String.format("String_Node_Str",var),ex);
    return null;
  }
}
Program: 22591
Project: 22591
Buggy source:
public HDTId(int id,TripleComponentRole role,NodeDictionary dict){
  super();
  this.id=id;
  this.role=role;
  this.node=null;
  this.dict=dict;
}

Fixed version (ground truth):
/** 
 * "Does not exist" id.  Guaranteed to be not equal to any other HDTId. 
 */
public HDTId(Node node){
  this(-1,null,null);
  this.node=node;
}
Program: 22592
Project: 22592
Buggy source:
public Node getNode(){
  return node;
}

Fixed version (ground truth):
public Node getNode(){
  if (node == null) {
    node=dict.getNode(id,role);
  }
  return node;
}
Program: 22593
Project: 22593
Buggy source:
public static Function<Binding,BindingHDTId> convFromBinding(final NodeDictionary dictionary,final ExecutionContext ctx){
  return new Function<Binding,BindingHDTId>(){
    PrefixMapping mapping=NodeDictionary.getMapping(ctx);
    @Override public BindingHDTId apply(    Binding binding){
      if (binding instanceof BindingHDTNode)       return ((BindingHDTNode)binding).getBindingId();
      BindingHDTId b=new BindingHDTId(binding);
      Iterator<Var> vars=binding.vars();
      for (; vars.hasNext(); ) {
        Var v=vars.next();
        Node n=binding.get(v);
        if (n == null)         continue;
        HDTId id=getID(n,dictionary,mapping);
        b.put(v,id);
      }
      return b;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Transform from generic Jena bindings to HDTId bindings. 
 */
public static Function<Binding,BindingHDTId> convFromBinding(NodeDictionary dictionary,ExecutionContext ctx){
  return new Function<Binding,BindingHDTId>(){
    PrefixMapping mapping=NodeDictionary.getMapping(ctx);
    @Override public BindingHDTId apply(    Binding binding){
      if (binding instanceof BindingHDTNode)       return ((BindingHDTNode)binding).getBindingId();
      BindingHDTId b=new BindingHDTId(binding);
      Iterator<Var> vars=binding.vars();
      for (; vars.hasNext(); ) {
        Var v=vars.next();
        Node n=binding.get(v);
        if (n == null)         continue;
        HDTId id=getID(n,dictionary,mapping);
        b.put(v,id);
      }
      return b;
    }
  }
;
}
Program: 22594
Project: 22594
Buggy source:
private static HDTId getID(Node n,NodeDictionary dict,PrefixMapping prefixMapping){
  int id=dict.getIntID(n,prefixMapping,TripleComponentRole.SUBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.SUBJECT,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.PREDICATE);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.PREDICATE,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.OBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.OBJECT,dict);
  }
  return null;
}

Fixed version (ground truth):
private static HDTId getID(Node n,NodeDictionary dict,PrefixMapping prefixMapping){
  int id=dict.getIntID(n,prefixMapping,TripleComponentRole.SUBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.SUBJECT,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.PREDICATE);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.PREDICATE,dict);
  }
  id=dict.getIntID(n,prefixMapping,TripleComponentRole.OBJECT);
  if (id > 0) {
    return new HDTId(id,TripleComponentRole.OBJECT,dict);
  }
  return new HDTId(n);
}
Program: 22595
Project: 22595
Buggy source:
private static Function<BindingHDTId,Binding> convToBinding(final NodeDictionary dictionary){
  return new Function<BindingHDTId,Binding>(){
    @Override public Binding apply(    BindingHDTId bindingIds){
      return new BindingHDTNode(bindingIds);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Transform from HDTId bindings to generic Jena bindings. 
 */
public static Binding convToBinding(BindingHDTId binding){
  return new BindingHDTNode(binding);
}
Program: 22596
Project: 22596
Buggy source:
protected static QueryIterator execute(HDTGraph graph,BasicPattern pattern,QueryIterator input,Predicate<Tuple<HDTId>> filter,ExecutionContext execCxt){
  numBGPs++;
  Iterator<BindingHDTId> chain=Iter.map(input,HDTSolverLib.convFromBinding(graph.getNodeDictionary(),execCxt));
  List<Abortable> killList=new ArrayList<Abortable>();
  Map<Var,VarAppearance> mapVar=new HashMap<Var,VarAppearance>();
  for (  Triple triplePattern : pattern) {
    addVarAppearance(mapVar,triplePattern.getSubject(),TripleComponentRole.SUBJECT);
    addVarAppearance(mapVar,triplePattern.getObject(),TripleComponentRole.OBJECT);
  }
  for (  Triple triplePattern : pattern) {
    chain=solve(graph,triplePattern,chain,filter,mapVar,execCxt);
    chain=IterAbortable.makeAbortable(chain,killList);
  }
  Iterator<Binding> iterBinding=converter.convert(graph.getNodeDictionary(),chain);
  return new QueryIterHDT(iterBinding,killList,input,execCxt);
}

Fixed version (ground truth):
protected static QueryIterator execute(HDTGraph graph,BasicPattern pattern,QueryIterator input,Predicate<Tuple<HDTId>> filter,ExecutionContext execCxt){
  numBGPs++;
  Iterator<BindingHDTId> chain=Iter.map(input,convFromBinding(graph.getNodeDictionary(),execCxt));
  List<Abortable> killList=new ArrayList<Abortable>();
  Map<Var,VarAppearance> mapVar=new HashMap<Var,VarAppearance>();
  for (  Triple triplePattern : pattern) {
    addVarAppearance(mapVar,triplePattern.getSubject(),TripleComponentRole.SUBJECT);
    addVarAppearance(mapVar,triplePattern.getObject(),TripleComponentRole.OBJECT);
  }
  for (  Triple triplePattern : pattern) {
    chain=solve(graph,triplePattern,chain,filter,mapVar,execCxt);
    chain=IterAbortable.makeAbortable(chain,killList);
  }
  Iterator<Binding> iterBinding=Iter.map(chain,HDTSolverLib::convToBinding);
  return new QueryIterHDT(iterBinding,killList,input,execCxt);
}
Program: 22597
Project: 22597
Buggy source:
@Override public BindingHDTId apply(TripleID triple){
  BindingHDTId output=new BindingHDTId(input);
  if (var[0] != null && !output.containsKey(var[0])) {
    output.put(var[0],new HDTId(triple.getSubject(),TripleComponentRole.SUBJECT,dictionary));
  }
  if (var[1] != null && !output.containsKey(var[1])) {
    output.put(var[1],new HDTId(triple.getPredicate(),TripleComponentRole.PREDICATE,dictionary));
  }
  if (var[2] != null && !output.containsKey(var[2])) {
    output.put(var[2],new HDTId(triple.getObject(),TripleComponentRole.OBJECT,dictionary));
  }
  return output;
}

Fixed version (ground truth):
@Override public BindingHDTId apply(TripleID triple){
  BindingHDTId output=new BindingHDTId(input);
  if (var[0] != null && !insert(var[0],new HDTId(triple.getSubject(),TripleComponentRole.SUBJECT,dictionary),output)) {
    return null;
  }
  if (var[1] != null && !insert(var[1],new HDTId(triple.getPredicate(),TripleComponentRole.PREDICATE,dictionary),output)) {
    return null;
  }
  if (var[2] != null && !insert(var[2],new HDTId(triple.getObject(),TripleComponentRole.OBJECT,dictionary),output)) {
    return null;
  }
  return output;
}
Program: 22599
Project: 22599
Buggy source:
/** 
 * Check whether all the components of the triple are empty (zero).
 * @return
 */
public boolean isEmpty(){
  return !(subject != 0 || predicate != 0 || object != 0);
}

Fixed version (ground truth):
/** 
 * Check whether all the components of the triple are empty (zero).
 * @return
 */
public boolean isEmpty(){
  return subject == 0 && predicate == 0 && object == 0;
}
Program: 22600
Project: 22600
Buggy source:
public boolean equals(TripleID other){
  return !(subject != other.subject || predicate != other.predicate || object != other.object);
}

Fixed version (ground truth):
public boolean equals(TripleID other){
  return subject == other.subject && predicate == other.predicate && object == other.object;
}
Program: 22601
Project: 22601
Buggy source:
@Override public IteratorTripleString search(CharSequence subject,CharSequence predicate,CharSequence object) throws NotFoundException {
  TripleID triple=new TripleID(dictionary.stringToId(subject,TripleComponentRole.SUBJECT),dictionary.stringToId(predicate,TripleComponentRole.PREDICATE),dictionary.stringToId(object,TripleComponentRole.OBJECT));
  if (triple.getSubject() == -1 || triple.getPredicate() == -1 || triple.getObject() == -1) {
    throw new NotFoundException("String_Node_Str");
  }
  return new DictionaryTranslateIterator(triples.search(triple),dictionary,subject,predicate,object);
}

Fixed version (ground truth):
@Override public IteratorTripleString search(CharSequence subject,CharSequence predicate,CharSequence object) throws NotFoundException {
  TripleID triple=new TripleID(dictionary.stringToId(subject,TripleComponentRole.SUBJECT),dictionary.stringToId(predicate,TripleComponentRole.PREDICATE),dictionary.stringToId(object,TripleComponentRole.OBJECT));
  if (triple.isNoMatch()) {
    throw new NotFoundException("String_Node_Str");
  }
  return new DictionaryTranslateIterator(triples.search(triple),dictionary,subject,predicate,object);
}
Program: 22602
Project: 22602
Buggy source:
@Override public IteratorTripleID search(TripleID pattern){
  if (getNumberOfElements() == 0) {
    return new EmptyTriplesIterator(order);
  }
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    if (this.predicateIndex != null) {
      return new BitmapTriplesIteratorYFOQ(this,pattern);
    }
 else {
      return new BitmapTriplesIteratorY(this,pattern);
    }
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}

Fixed version (ground truth):
@Override public IteratorTripleID search(TripleID pattern){
  if (getNumberOfElements() == 0 || pattern.isNoMatch()) {
    return new EmptyTriplesIterator(order);
  }
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    if (this.predicateIndex != null) {
      return new BitmapTriplesIteratorYFOQ(this,pattern);
    }
 else {
      return new BitmapTriplesIteratorY(this,pattern);
    }
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}
Program: 22603
Project: 22603
Buggy source:
private static Graph toHDT(Graph graph){
  return toHDT(ModelFactory.createModelForGraph(graph)).getGraph();
}

Fixed version (ground truth):
private static HDTGraph toHDT(Graph graph){
  Model model=ModelFactory.createModelForGraph(graph);
  IteratorTripleString tripleIter=new JenaModelIterator(model);
  HDT hdt;
  try {
    hdt=HDTManager.generateHDT(tripleIter,"String_Node_Str",new HDTSpecification(),null);
  }
 catch (  IOException|ParserException e) {
    throw new RuntimeException(e);
  }
  return new HDTGraph(hdt,true);
}
Program: 22604
Project: 22604
Buggy source:
@Override protected void format(StringBuffer sbuff,Var var){
  HDTId id=idBinding.get(var);
  String extra="String_Node_Str";
  if (id != null)   extra="String_Node_Str" + id;
  Node node=get(var);
  sbuff.append("String_Node_Str" + var.getVarName() + extra+ "String_Node_Str"+ node.toString()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override protected void format(StringBuffer sbuff,Var var){
  HDTId id=idBinding.get(var);
  String extra="String_Node_Str";
  if (id != null)   extra="String_Node_Str" + id;
  Node node=get(var);
  sbuff.append("String_Node_Str").append(var.getVarName()).append(extra).append("String_Node_Str").append(node).append("String_Node_Str");
}
Program: 22606
Project: 22606
Buggy source:
/** 
 * Read from a line, where each component is separated by space.
 * @param line
 */
public void read(String line) throws ParserException {
  int split, posa, posb;
  this.clear();
  line=line.replaceAll("String_Node_Str","String_Node_Str");
  posa=0;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   return;
  if (line.charAt(posa) == '<')   posa++;
  if (line.charAt(posb - 1) == '>')   posb--;
  this.setSubject(line.substring(posa,posb));
  posa=split + 1;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   return;
  if (line.charAt(posa) == '<')   posa++;
  if (posb > posa && line.charAt(posb - 1) == '>')   posb--;
  this.setPredicate(line.substring(posa,posb));
  posa=split + 1;
  posb=line.length();
  if (line.charAt(posb - 1) == '.')   posb--;
  if (line.charAt(posb - 1) == ' ')   posb--;
  if (line.charAt(posa) == '<') {
    posa++;
    if (posb > posa && line.charAt(posb - 1) == '>')     posb--;
  }
  this.setObject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
}

Fixed version (ground truth):
/** 
 * Read from a line, where each component is separated by space.
 * @param line
 */
public void read(String line) throws ParserException {
  int split, posa, posb;
  this.clear();
  line=line.replaceAll("String_Node_Str","String_Node_Str");
  posa=0;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   return;
  if (line.charAt(posa) == '<')   posa++;
  if (line.charAt(posb - 1) == '>')   posb--;
  this.setSubject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
  posa=split + 1;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   return;
  if (line.charAt(posa) == '<')   posa++;
  if (posb > posa && line.charAt(posb - 1) == '>')   posb--;
  this.setPredicate(UnicodeEscape.unescapeString(line.substring(posa,posb)));
  posa=split + 1;
  posb=line.length();
  if (line.charAt(posb - 1) == '.')   posb--;
  if (line.charAt(posb - 1) == ' ')   posb--;
  if (line.charAt(posa) == '<') {
    posa++;
    if (posb > posa && line.charAt(posb - 1) == '>')     posb--;
  }
  this.setObject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
}
Program: 22607
Project: 22607
Buggy source:
/** 
 * Read from a line, where each component is separated by space.
 * @param line
 */
private static void parseTriplePattern(TripleString dest,String line) throws ParserException {
  int split, posa, posb;
  dest.clear();
  posa=0;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   throw new ParserException("String_Node_Str");
  dest.setSubject(line.substring(posa,posb));
  posa=split + 1;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   throw new ParserException("String_Node_Str");
  dest.setPredicate(line.substring(posa,posb));
  posa=split + 1;
  posb=line.length();
  if (line.charAt(posb - 1) == '.')   posb--;
  if (line.charAt(posb - 1) == ' ')   posb--;
  dest.setObject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
}

Fixed version (ground truth):
/** 
 * Read from a line, where each component is separated by space.
 * @param line
 */
private static void parseTriplePattern(TripleString dest,String line) throws ParserException {
  int split, posa, posb;
  dest.clear();
  posa=0;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   throw new ParserException("String_Node_Str");
  dest.setSubject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
  posa=split + 1;
  posb=split=line.indexOf(' ',posa);
  if (posb == -1)   throw new ParserException("String_Node_Str");
  dest.setPredicate(UnicodeEscape.unescapeString(line.substring(posa,posb)));
  posa=split + 1;
  posb=line.length();
  if (line.charAt(posb - 1) == '.')   posb--;
  if (line.charAt(posb - 1) == ' ')   posb--;
  dest.setObject(UnicodeEscape.unescapeString(line.substring(posa,posb)));
}
Program: 22608
Project: 22608
Buggy source:
public static String format(Node node){
  if (node.isURI()) {
    return node.getURI();
  }
 else   if (node.isLiteral()) {
    RDFDatatype t=node.getLiteralDatatype();
    if (t == null || XSDDatatype.XSDstring.getURI().equals(t.getURI())) {
      return '"' + node.getLiteralLexicalForm() + '"';
    }
 else     if (RDFLangString.rdfLangString.equals(t)) {
      return '"' + node.getLiteralLexicalForm() + "String_Node_Str"+ node.getLiteralLanguage();
    }
 else {
      return '"' + node.getLiteralLexicalForm() + "String_Node_Str"+ t.getURI()+ '>';
    }
  }
 else   if (node.isBlank()) {
    return "String_Node_Str" + node.getBlankNodeLabel();
  }
 else {
    throw new IllegalArgumentException(String.valueOf(node));
  }
}

Fixed version (ground truth):
public static String format(Node node){
  if (node.isURI()) {
    return node.getURI();
  }
 else   if (node.isLiteral()) {
    RDFDatatype t=node.getLiteralDatatype();
    if (t == null || XSDDatatype.XSDstring.getURI().equals(t.getURI())) {
      return '"' + node.getLiteralLexicalForm() + '"';
    }
 else     if (RDFLangString.rdfLangString.equals(t)) {
      return '"' + node.getLiteralLexicalForm() + "String_Node_Str"+ node.getLiteralLanguage().toLowerCase();
    }
 else {
      return '"' + node.getLiteralLexicalForm() + "String_Node_Str"+ t.getURI()+ '>';
    }
  }
 else   if (node.isBlank()) {
    return "String_Node_Str" + node.getBlankNodeLabel();
  }
 else {
    throw new IllegalArgumentException(String.valueOf(node));
  }
}
Program: 22609
Project: 22609
Buggy source:
@Override public char charAt(int index){
  return (char)buffer[index];
}

Fixed version (ground truth):
@Override public char charAt(int index){
  return (char)(buffer[index] & 0xff);
}
Program: 22610
Project: 22610
Buggy source:
private void ensureSize(int size){
  if (size > buffer.length) {
    buffer=Arrays.copyOf(buffer,size);
  }
}

Fixed version (ground truth):
private void ensureSize(int size){
  if (size > buffer.length) {
    buffer=Arrays.copyOf(buffer,Math.max(size,buffer.length * 2));
  }
}
Program: 22611
Project: 22611
Buggy source:
public static String nodeToStr(Node node){
  if (node == null || node.isVariable()) {
    return "String_Node_Str";
  }
 else   if (node.isURI()) {
    return node.getURI();
  }
 else   if (node.isLiteral()) {
    RDFDatatype t=node.getLiteralDatatype();
    if (t == null || XSDDatatype.XSDstring.getURI().equals(t.getURI())) {
      return "String_Node_Str" + node.getLiteralLexicalForm() + "String_Node_Str";
    }
 else     if (RDFLangString.rdfLangString.equals(t)) {
      return "String_Node_Str" + node.getLiteralLexicalForm() + "String_Node_Str"+ node.getLiteralLanguage();
    }
 else {
      return "String_Node_Str" + node.getLiteralLexicalForm() + "String_Node_Str"+ t.getURI()+ "String_Node_Str";
    }
  }
 else {
    return node.toString();
  }
}

Fixed version (ground truth):
public static String nodeToStr(Node node){
  if (node == null || node.isVariable()) {
    return "String_Node_Str";
  }
 else {
    return JenaNodeFormatter.format(node);
  }
}
Program: 22612
Project: 22612
Buggy source:
public void doParse(InputStream input,String baseUri,RDFNotation notation,RDFCallback callback) throws ParserException {
  this.callback=callback;
  try {
switch (notation) {
case NTRIPLES:
      LangNTriples langNtriples=RiotReader.createParserNTriples(input,this);
    langNtriples.parse();
  break;
case RDFXML:
LangRDFXML langRdfxml=RiotReader.createParserRDFXML(input,baseUri,this);
langRdfxml.parse();
break;
case N3:
case TURTLE:
LangTurtle langTurtle=RiotReader.createParserTurtle(input,baseUri,this);
langTurtle.parse();
break;
default :
throw new NotImplementedException("String_Node_Str" + notation);
}
}
 catch (Exception e) {
e.printStackTrace();
throw new ParserException();
}
}

Fixed version (ground truth):
public void doParse(InputStream input,String baseUri,RDFNotation notation,RDFCallback callback) throws ParserException {
  this.callback=callback;
  try {
switch (notation) {
case NTRIPLES:
      LangNTriples langNtriples=RiotParsers.createParserNTriples(input,this);
    langNtriples.parse();
  break;
case RDFXML:
LangRDFXML langRdfxml=RiotParsers.createParserRDFXML(input,baseUri,this);
langRdfxml.parse();
break;
case N3:
case TURTLE:
LangTurtle langTurtle=RiotParsers.createParserTurtle(input,baseUri,this);
langTurtle.parse();
break;
default :
throw new NotImplementedException("String_Node_Str" + notation);
}
}
 catch (Exception e) {
e.printStackTrace();
throw new ParserException();
}
}
Program: 22613
Project: 22613
Buggy source:
public static Node createLiteral(CharSequence x){
  String str=x.toString();
  int len=str.length();
  String literal="String_Node_Str";
  String datatype="String_Node_Str";
  String lang="String_Node_Str";
  char next='\0';
  for (int i=len - 1; i > 0; i--) {
    char cur=str.charAt(i);
    if (cur == '"') {
      if (next == '@') {
        literal=str.substring(1,i);
        lang=str.substring(i + 2,len);
        return new Node_Literal(LiteralLabelFactory.create(literal,lang));
      }
 else {
        literal=str.substring(1,i);
        return new Node_Literal(LiteralLabelFactory.create(literal,"String_Node_Str",false));
      }
    }
 else     if (cur == '^' && next == '^' && str.charAt(i - 1) == '"') {
      literal=str.substring(1,i - 1);
      if (str.charAt(i + 2) == '<' && str.charAt(len - 1) == '>') {
        datatype=str.substring(i + 3,len - 1);
      }
 else {
        datatype=str.substring(i + 2,len);
      }
      return new Node_Literal(LiteralLabelFactory.create(literal,"String_Node_Str",TypeMapper.getInstance().getTypeByName(datatype)));
    }
    next=cur;
  }
  return new Node_Literal(LiteralLabelFactory.create(str.substring(1,len - 2),"String_Node_Str",false));
}

Fixed version (ground truth):
public static Node createLiteral(CharSequence x){
  String str=x.toString();
  int len=str.length();
  String literal="String_Node_Str";
  String datatype="String_Node_Str";
  String lang="String_Node_Str";
  char next='\0';
  for (int i=len - 1; i > 0; i--) {
    char cur=str.charAt(i);
    if (cur == '"') {
      if (next == '@') {
        literal=str.substring(1,i);
        lang=str.substring(i + 2,len);
        return new Node_Literal(LiteralLabelFactory.create(literal,lang));
      }
 else {
        literal=str.substring(1,i);
        return new Node_Literal(LiteralLabelFactory.create(literal,"String_Node_Str",false));
      }
    }
 else     if (cur == '^' && next == '^' && str.charAt(i - 1) == '"') {
      literal=str.substring(1,i - 1);
      if (str.charAt(i + 2) == '<' && str.charAt(len - 1) == '>') {
        datatype=str.substring(i + 3,len - 1);
      }
 else {
        datatype=str.substring(i + 2,len);
      }
      RDFDatatype rdfDataType=TypeMapper.getInstance().getTypeByName(datatype);
      if (rdfDataType == null) {
        rdfDataType=new CustomDatatype(datatype);
        TypeMapper.getInstance().registerDatatype(rdfDataType);
      }
      return new Node_Literal(LiteralLabelFactory.create(literal,"String_Node_Str",rdfDataType));
    }
    next=cur;
  }
  return new Node_Literal(LiteralLabelFactory.create(str.substring(1,len - 2),"String_Node_Str",false));
}
Program: 22615
Project: 22615
Buggy source:
@Override public IteratorTripleID search(TripleID pattern){
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    return new BitmapTriplesIteratorY(this,pattern);
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}

Fixed version (ground truth):
@Override public IteratorTripleID search(TripleID pattern){
  TripleID reorderedPat=new TripleID(pattern);
  TripleOrderConvert.swapComponentOrder(reorderedPat,TripleComponentOrder.SPO,order);
  String patternString=reorderedPat.getPatternString();
  if (patternString.equals("String_Node_Str")) {
    if (this.predicateIndex != null) {
      return new BitmapTriplesIteratorYFOQ(this,pattern);
    }
 else {
      return new BitmapTriplesIteratorY(this,pattern);
    }
  }
  if (indexZ != null && bitmapIndexZ != null) {
    if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZFOQ(this,pattern);
    }
  }
 else {
    if (patternString.equals("String_Node_Str")) {
      return new SequentialSearchIteratorTripleID(pattern,new BitmapTriplesIteratorZ(this,pattern));
    }
    if (patternString.equals("String_Node_Str")) {
      return new BitmapTriplesIteratorZ(this,pattern);
    }
  }
  IteratorTripleID bitIt=new BitmapTriplesIterator(this,pattern);
  if (patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str") || patternString.equals("String_Node_Str")|| patternString.equals("String_Node_Str")) {
    return bitIt;
  }
 else {
    return new SequentialSearchIteratorTripleID(pattern,bitIt);
  }
}
Program: 22616
Project: 22616
Buggy source:
@Override public long estimatedNumResults(){
  return adjZ.getNumberOfElements();
}

Fixed version (ground truth):
@Override public long estimatedNumResults(){
  return triples.predicateCount.get(patY - 1);
}
Program: 22617
Project: 22617
Buggy source:
public static final int strcmp(CharSequence str,ByteBuffer buffer,int offset){
  byte[] buf=null;
  int len;
  if (str instanceof CompactString) {
    buf=((CompactString)str).getData();
    len=buf.length;
  }
 else   if (str instanceof String) {
    buf=((String)str).getBytes(ByteStringUtil.STRING_ENCODING);
    len=buf.length;
  }
 else   if (str instanceof ReplazableString) {
    buf=((ReplazableString)str).buffer;
    len=((ReplazableString)str).used;
  }
 else {
    throw new NotImplementedException();
  }
  int i=0;
  int n=Math.min(len,buffer.capacity() - offset);
  while (i < n) {
    int v1=buf[i] & 0xFF;
    int v2=buffer.get(offset + i) & 0xFF;
    if (v1 != v2) {
      return v1 - v2;
    }
    if (v1 == 0) {
      return 0;
    }
    i++;
  }
  if (buffer.capacity() - offset - i > 0) {
    byte v=buffer.get(offset + i);
    if (v == 0) {
      return 0;
    }
 else {
      return -1;
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
public static final int strcmp(CharSequence str,ByteBuffer buffer,int offset){
  byte[] buf=null;
  int len;
  if (str instanceof DelayedString) {
    str=((DelayedString)str).getInternal();
  }
  if (str instanceof CompactString) {
    buf=((CompactString)str).getData();
    len=buf.length;
  }
 else   if (str instanceof String) {
    buf=((String)str).getBytes(ByteStringUtil.STRING_ENCODING);
    len=buf.length;
  }
 else   if (str instanceof ReplazableString) {
    buf=((ReplazableString)str).buffer;
    len=((ReplazableString)str).used;
  }
 else {
    throw new NotImplementedException();
  }
  int i=0;
  int n=Math.min(len,buffer.capacity() - offset);
  while (i < n) {
    int v1=buf[i] & 0xFF;
    int v2=buffer.get(offset + i) & 0xFF;
    if (v1 != v2) {
      return v1 - v2;
    }
    if (v1 == 0) {
      return 0;
    }
    i++;
  }
  if (buffer.capacity() - offset - i > 0) {
    byte v=buffer.get(offset + i);
    if (v == 0) {
      return 0;
    }
 else {
      return -1;
    }
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 22618
Project: 22618
Buggy source:
public static String nodeToStr(Node node){
  if (node == null || node.isVariable()) {
    return "String_Node_Str";
  }
 else   if (node.isURI()) {
    return node.getURI();
  }
 else {
    return node.toString();
  }
}

Fixed version (ground truth):
public static String nodeToStr(Node node){
  if (node == null || node.isVariable()) {
    return "String_Node_Str";
  }
 else   if (node.isURI()) {
    return node.getURI();
  }
 else   if (node.isLiteral()) {
    RDFDatatype t=node.getLiteralDatatype();
    if (t != null) {
      return "String_Node_Str" + node.getLiteralLexicalForm() + "String_Node_Str"+ t.getURI()+ "String_Node_Str";
    }
    return node.toString();
  }
 else {
    return node.toString();
  }
}
Program: 22619
Project: 22619
Buggy source:
@Override public CharSequence next(){
  if (!buffer.hasRemaining()) {
    buffer=buffers[++bytebufferIndex].duplicate();
    buffer.rewind();
  }
  try {
    if ((id % blocksize) == 0) {
      tempString.replace(buffer,0);
    }
 else {
      long delta=VByte.decode(buffer);
      tempString.replace(buffer,(int)delta);
    }
    id++;
    return tempString.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public CharSequence next(){
  if (!buffer.hasRemaining()) {
    buffer=buffers[++bytebufferIndex].duplicate();
    buffer.rewind();
  }
  try {
    if ((id % blocksize) == 0) {
      tempString.replace(buffer,0);
    }
 else {
      long delta=VByte.decode(buffer);
      tempString.replace(buffer,(int)delta);
    }
    id++;
    return new CompactString(tempString);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 22620
Project: 22620
Buggy source:
@Override public Iterator<CharSequence> getSortedEntries(){
  return new Iterator<CharSequence>(){
    int id=0;
    ReplazableString tempString=new ReplazableString();
    int bytebufferIndex=0;
    ByteBuffer buffer=buffers[0].duplicate();
    @Override public boolean hasNext(){
      return id < getNumberOfElements();
    }
    @Override public CharSequence next(){
      if (!buffer.hasRemaining()) {
        buffer=buffers[++bytebufferIndex].duplicate();
        buffer.rewind();
      }
      try {
        if ((id % blocksize) == 0) {
          tempString.replace(buffer,0);
        }
 else {
          long delta=VByte.decode(buffer);
          tempString.replace(buffer,(int)delta);
        }
        id++;
        return tempString.toString();
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<CharSequence> getSortedEntries(){
  return new Iterator<CharSequence>(){
    int id=0;
    ReplazableString tempString=new ReplazableString();
    int bytebufferIndex=0;
    ByteBuffer buffer=buffers[0].duplicate();
    @Override public boolean hasNext(){
      return id < getNumberOfElements();
    }
    @Override public CharSequence next(){
      if (!buffer.hasRemaining()) {
        buffer=buffers[++bytebufferIndex].duplicate();
        buffer.rewind();
      }
      try {
        if ((id % blocksize) == 0) {
          tempString.replace(buffer,0);
        }
 else {
          long delta=VByte.decode(buffer);
          tempString.replace(buffer,(int)delta);
        }
        id++;
        return new CompactString(tempString);
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
  }
;
}
Program: 22621
Project: 22621
Buggy source:
@Override public int compare(CharSequence s1,CharSequence s2){
  if (s1 == s2) {
    return 0;
  }
  if (s1 instanceof CompactString && s2 instanceof CompactString) {
    CompactString cs1=(CompactString)s1;
    CompactString cs2=(CompactString)s2;
    return cs1.compareTo(cs2);
  }
  if (s1 instanceof String && s2 instanceof String) {
    String rs1=(String)s1;
    String rs2=(String)s2;
    return rs1.compareTo(rs2);
  }
  if (s1 instanceof ReplazableString && s2 instanceof ReplazableString) {
    ReplazableString cs1=(ReplazableString)s1;
    ReplazableString cs2=(ReplazableString)s2;
    return cs1.compareTo(cs2);
  }
  int len1=s1.length();
  int len2=s2.length();
  int n=Math.min(len1,len2);
  int k=0;
  while (k < n) {
    char c1=s1.charAt(k);
    char c2=s2.charAt(k);
    if (c1 != c2) {
      return c2 - c1;
    }
    k++;
  }
  return len2 - len1;
}

Fixed version (ground truth):
@Override public int compare(CharSequence s1,CharSequence s2){
  if (s1 == s2) {
    return 0;
  }
  if (s1 instanceof CompactString && s2 instanceof CompactString) {
    CompactString cs1=(CompactString)s1;
    CompactString cs2=(CompactString)s2;
    return cs1.compareTo(cs2);
  }
  if (s1 instanceof String && s2 instanceof String) {
    String rs1=(String)s1;
    String rs2=(String)s2;
    return rs1.compareTo(rs2);
  }
  if (s1 instanceof ReplazableString && s2 instanceof ReplazableString) {
    ReplazableString cs1=(ReplazableString)s1;
    ReplazableString cs2=(ReplazableString)s2;
    return cs1.compareTo(cs2);
  }
  return s1.toString().compareTo(s2.toString());
}
Program: 22622
Project: 22622
Buggy source:
public CharSequence subSequence(int start,int end){
  if (start < 0 || end > (this.length()) || (end - start) < 0) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str"+ length());
  }
  byte[] newdata=new byte[end - start];
  System.arraycopy(data,start,newdata,0,end - start);
  return new CompactString(newdata);
}

Fixed version (ground truth):
public CharSequence subSequence(int start,int end){
  System.err.println("String_Node_Str");
  if (start < 0 || end > (this.length()) || (end - start) < 0) {
    throw new IllegalArgumentException("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str"+ length());
  }
  byte[] newdata=new byte[end - start];
  System.arraycopy(data,start,newdata,0,end - start);
  return new CompactString(newdata);
}
Program: 22623
Project: 22623
Buggy source:
@Override public int compareTo(CompactString other){
  int n=Math.min(this.data.length,other.data.length);
  int k=0;
  while (k < n) {
    byte c1=this.data[k];
    byte c2=other.data[k];
    if (c1 != c2) {
      return c1 - c2;
    }
    k++;
  }
  return this.data.length - other.data.length;
}

Fixed version (ground truth):
@Override public int compareTo(CompactString other){
  int n=Math.min(this.data.length,other.data.length);
  int k=0;
  while (k < n) {
    int c1=this.data[k] & 0xFF;
    int c2=other.data[k] & 0xFF;
    if (c1 != c2) {
      return c1 - c2;
    }
    k++;
  }
  return this.data.length - other.data.length;
}