nus-yam/ex-repair huggingface dataset:
Program: 1399
Project: 1399
Buggy source:
@Override public boolean offer(Object o){
  long x=MurmurHash.hash64(o);
switch (format) {
case NORMAL:
    final long idx=x >>> (64 - p);
  final int runLength=Long.numberOfLeadingZeros((x << this.p) | (1 << (this.p - 1)) + 1) + 1;
if (registerSet.get((int)idx) < runLength) {
  registerSet.set((int)idx,runLength);
  return true;
}
 else {
  return false;
}
case SPARCE:
int k=encodeHash(x,p,sp);
try {
Varint.writeUnsignedVarInt(k,dataOutput);
boolean ret=tmpSet.add(rawOutput.toByteArray());
rawOutput.reset();
if (tmpSet.size() > sparseSortThreshold) {
sparseSet=merge(sparseSet,sort(tmpSet));
tmpSet.clear();
System.out.println("String_Node_Str" + sparseSet.size() + "String_Node_Str"+ (m * 6));
if (sparseSet.size() > sparseMaxThreshold) {
  format=Format.NORMAL;
  convertToNormal();
}
}
return ret;
}
 catch (IOException e) {
e.printStackTrace();
}
break;
default :
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean offer(Object o){
  long x=MurmurHash.hash64(o);
switch (format) {
case NORMAL:
    final long idx=x >>> (64 - p);
  final int runLength=Long.numberOfLeadingZeros((x << this.p) | (1 << (this.p - 1)) + 1) + 1;
if (registerSet.get((int)idx) < runLength) {
  registerSet.set((int)idx,runLength);
  return true;
}
 else {
  return false;
}
case SPARCE:
int k=encodeHash(x,p,sp);
try {
Varint.writeUnsignedVarInt(k,dataOutput);
boolean ret=tmpSet.add(rawOutput.toByteArray());
rawOutput.reset();
if (tmpSet.size() > sparseSortThreshold) {
sparseSet=merge(sparseSet,sort(tmpSet));
tmpSet.clear();
if (sparseSet.size() > sparseMaxThreshold) {
  convertToNormal();
}
}
return ret;
}
 catch (IOException e) {
e.printStackTrace();
}
break;
default :
break;
}
return false;
}
Program: 1400
Project: 1400
Buggy source:
private void convertToNormal(){
  for (  byte[] bytes : sparseSet) {
    DataInput dataInput=new DataInputStream(new ByteArrayInputStream(bytes));
    try {
      int k=Varint.readUnsignedVarInt(dataInput);
      int idx=getIndex(k,p);
      int r=decodeRunLength(k);
      final int runLength=Long.numberOfLeadingZeros((idx << this.p) | (1 << (this.p - 1)) + 1) + 1;
      if (registerSet.get(idx) < r) {
        registerSet.set(idx,runLength);
      }
      tmpSet.clear();
      sparseSet=null;
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void convertToNormal(){
  for (  byte[] bytes : sparseSet) {
    DataInput dataInput=new DataInputStream(new ByteArrayInputStream(bytes));
    try {
      int k=Varint.readUnsignedVarInt(dataInput);
      int idx=getIndex(k,p);
      int r=decodeRunLength(k);
      if (registerSet.get(idx) < r) {
        registerSet.set(idx,r);
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  format=Format.NORMAL;
  tmpSet.clear();
  sparseSet=null;
}
Program: 1401
Project: 1401
Buggy source:
private int getIndex(int k,int p){
  if ((k & 1L) != 0) {
    return (k >>> 6 & ((1 << p) - 1));
  }
 else {
    return (k >>> 1 & ((1 << p) - 1));
  }
}

Fixed version (ground truth):
private int getIndex(int k,int p){
  if ((k & 1L) != 0) {
    return (k >>> 6 & ((1 << p) - 1));
  }
 else {
    return (k >>> 1 & ((1 << (p + 1)) - 1));
  }
}
Program: 1402
Project: 1402
Buggy source:
public HyperLogLogPlus(int p,int sp,RegisterSet registerSet){
  this.p=p;
  this.sp=sp;
  this.m=(int)Math.pow(2,p);
  this.sm=(int)Math.pow(2,sp);
  this.registerSet=registerSet;
  int bitSize=6;
switch (bitSize) {
case 4:
    alphaMM=0.673 * m * m;
  break;
case 5:
alphaMM=0.697 * m * m;
break;
case 6:
alphaMM=0.709 * m * m;
break;
default :
alphaMM=(0.7213 / (1 + 1.079 / m)) * m * m;
}
}

Fixed version (ground truth):
public HyperLogLogPlus(int p,int sp,RegisterSet registerSet){
  this.p=p;
  this.sp=sp;
  this.m=(int)Math.pow(2,p);
  this.sm=(int)Math.pow(2,sp);
  this.registerSet=registerSet;
switch (p) {
case 4:
    alphaMM=0.673 * m * m;
  break;
case 5:
alphaMM=0.697 * m * m;
break;
case 6:
alphaMM=0.709 * m * m;
break;
default :
alphaMM=(0.7213 / (1 + 1.079 / m)) * m * m;
}
}
Program: 1403
Project: 1403
Buggy source:
@Test public void testMerge() throws CardinalityMergeException {
  int numToMerge=1;
  int bits=14;
  int cardinality=1000000;
  HyperLogLogPlus[] hyperLogLogs=new HyperLogLogPlus[numToMerge];
  HyperLogLogPlus baseline=new HyperLogLogPlus(bits,25);
  for (int i=0; i < numToMerge; i++) {
    hyperLogLogs[i]=new HyperLogLogPlus(bits,25);
    for (int j=0; j < cardinality; j++) {
      double val=Math.random();
      hyperLogLogs[i].offer(val);
      baseline.offer(val);
    }
  }
  long expectedCardinality=numToMerge * cardinality;
  HyperLogLogPlus hll=hyperLogLogs[0];
  hyperLogLogs=Arrays.asList(hyperLogLogs).subList(1,hyperLogLogs.length).toArray(new HyperLogLogPlus[0]);
  long mergedEstimate=hll.merge(hyperLogLogs).cardinality();
  double se=expectedCardinality * (1.04 / Math.sqrt(Math.pow(2,bits)));
  System.out.println("String_Node_Str" + mergedEstimate + "String_Node_Str"+ (expectedCardinality - (3 * se))+ "String_Node_Str"+ (expectedCardinality + (3 * se)));
  assertTrue(mergedEstimate >= expectedCardinality - (3 * se));
  assertTrue(mergedEstimate <= expectedCardinality + (3 * se));
}

Fixed version (ground truth):
@Test public void testMerge() throws CardinalityMergeException {
  int numToMerge=4;
  int bits=18;
  int cardinality=1000000;
  HyperLogLogPlus[] hyperLogLogs=new HyperLogLogPlus[numToMerge];
  HyperLogLogPlus baseline=new HyperLogLogPlus(bits,25);
  for (int i=0; i < numToMerge; i++) {
    hyperLogLogs[i]=new HyperLogLogPlus(bits,25);
    for (int j=0; j < cardinality; j++) {
      double val=Math.random();
      hyperLogLogs[i].offer(val);
      baseline.offer(val);
    }
  }
  long expectedCardinality=numToMerge * cardinality;
  HyperLogLogPlus hll=hyperLogLogs[0];
  hyperLogLogs=Arrays.asList(hyperLogLogs).subList(1,hyperLogLogs.length).toArray(new HyperLogLogPlus[0]);
  long mergedEstimate=hll.merge(hyperLogLogs).cardinality();
  double se=expectedCardinality * (1.04 / Math.sqrt(Math.pow(2,bits)));
  System.out.println("String_Node_Str" + mergedEstimate + "String_Node_Str"+ (expectedCardinality - (3 * se))+ "String_Node_Str"+ (expectedCardinality + (3 * se)));
  assertTrue(mergedEstimate >= expectedCardinality - (3 * se));
  assertTrue(mergedEstimate <= expectedCardinality + (3 * se));
}
Program: 1404
Project: 1404
Buggy source:
@Test public void testHighCardinality(){
  long start=System.currentTimeMillis();
  HyperLogLogPlus hyperLogLog=new HyperLogLogPlus(14,25);
  int size=100000000;
  for (int i=0; i < size; i++) {
    hyperLogLog.offer(TestICardinality.streamElement(i));
  }
  System.out.println("String_Node_Str" + (System.currentTimeMillis() - start));
  long estimate=hyperLogLog.cardinality();
  double err=Math.abs(estimate - size) / (double)size;
  System.out.println(err);
  assertTrue(err < .1);
}

Fixed version (ground truth):
@Test public void testHighCardinality(){
  long start=System.currentTimeMillis();
  HyperLogLogPlus hyperLogLogPlus=new HyperLogLogPlus(18,25);
  int size=10000000;
  for (int i=0; i < size; i++) {
    hyperLogLogPlus.offer(TestICardinality.streamElement(i));
  }
  System.out.println("String_Node_Str" + size + "String_Node_Str"+ hyperLogLogPlus.cardinality()+ "String_Node_Str"+ (System.currentTimeMillis() - start));
  long estimate=hyperLogLogPlus.cardinality();
  double err=Math.abs(estimate - size) / (double)size;
  System.out.println(err);
  assertTrue(err < .1);
}
Program: 1405
Project: 1405
Buggy source:
@Test public void testOnSquares(){
  QDigest digest=new QDigest(1000);
  for (int j=0; j < 10; ++j) {
    for (long i=0; i < 100000; ++i) {
      digest.offer(i * i);
    }
  }
  for (double i=0; i < 1; i+=0.1)   System.out.println(i + "String_Node_Str" + digest.getQuantile(i)+ "String_Node_Str"+ (i * 10000L) * (i * 10000L));
}

Fixed version (ground truth):
@Test public void testOnSquares(){
  double compressionFactor=1000;
  QDigest digest=new QDigest(compressionFactor);
  int max=100000;
  for (int j=0; j < 10; ++j) {
    for (long i=0; i < max; ++i) {
      digest.offer(i * i);
    }
  }
  int logCapacity=1;
  for (long scale=1; scale < max; scale*=2, logCapacity++)   ;
  double eps=logCapacity / compressionFactor;
  for (double i=0; i < 1; i+=0.1) {
    double answer=digest.getQuantile(i);
    System.out.println(i + "String_Node_Str" + answer+ "String_Node_Str"+ (i * max) * (i * max));
    double actualRank=Math.min(1.0,Math.sqrt(answer) / max);
    assertTrue(actualRank + "String_Node_Str" + (i - eps)+ "String_Node_Str"+ (i + eps),actualRank > i - eps && actualRank < i + eps);
  }
}
Program: 1406
Project: 1406
Buggy source:
public static HyperLogLog build(byte[] bytes) throws IOException {
  ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
  DataInputStream oi=new DataInputStream(bais);
  int bits=oi.readInt();
  int size=oi.readInt();
  byte[] longArrayBytes=new byte[size];
  oi.readFully(longArrayBytes);
  return new HyperLogLog(new RegisterSet((int)Math.pow(2,bits),getBits(longArrayBytes)));
}

Fixed version (ground truth):
public static HyperLogLog build(byte[] bytes) throws IOException {
  ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
  DataInputStream oi=new DataInputStream(bais);
  int bits=oi.readInt();
  int size=oi.readInt();
  byte[] longArrayBytes=new byte[size];
  oi.readFully(longArrayBytes);
  return new HyperLogLog(bits,new RegisterSet((int)Math.pow(2,bits),getBits(longArrayBytes)));
}
Program: 1407
Project: 1407
Buggy source:
/** 
 * Merges estimators to produce an estimator for their combined streams
 * @param estimators
 * @return merged estimator or null if no estimators were provided
 */
public static HyperLogLog mergeEstimators(HyperLogLog... estimators){
  HyperLogLog merged=null;
  RegisterSet mergedSet=mergeRegisters(estimators);
  if (mergedSet != null)   merged=new HyperLogLog(mergedSet);
  return merged;
}

Fixed version (ground truth):
/** 
 * Merges estimators to produce an estimator for their combined streams
 * @param estimators
 * @return merged estimator or null if no estimators were provided
 */
public static HyperLogLog mergeEstimators(HyperLogLog... estimators){
  HyperLogLog merged=null;
  RegisterSet mergedSet=mergeRegisters(estimators);
  if (mergedSet != null)   merged=new HyperLogLog(estimators[0].log2m,mergedSet);
  return merged;
}
Program: 1408
Project: 1408
Buggy source:
/** 
 * Creates a new HyperLogLog instance using the given registers.  Used for unmarshalling a serialized instance and for merging multiple counters together.
 * @param registerSet - the initial values for the register set
 */
public HyperLogLog(RegisterSet registerSet){
  this.registerSet=registerSet;
  this.log2m=(int)(Math.sqrt(Math.sqrt(registerSet.count)));
  this.m=(int)Math.pow(2,this.log2m);
switch (log2m) {
case 4:
    alphaMM=0.673 * m * m;
  break;
case 5:
alphaMM=0.697 * m * m;
break;
case 6:
alphaMM=0.709 * m * m;
break;
default :
alphaMM=(0.7213 / (1 + 1.079 / m)) * m * m;
}
}

Fixed version (ground truth):
/** 
 * Creates a new HyperLogLog instance using the given registers.  Used for unmarshalling a serialized instance and for merging multiple counters together.
 * @param registerSet - the initial values for the register set
 */
public HyperLogLog(int log2m,RegisterSet registerSet){
  this.registerSet=registerSet;
  this.log2m=log2m;
  this.m=(int)Math.pow(2,this.log2m);
switch (log2m) {
case 4:
    alphaMM=0.673 * m * m;
  break;
case 5:
alphaMM=0.697 * m * m;
break;
case 6:
alphaMM=0.709 * m * m;
break;
default :
alphaMM=(0.7213 / (1 + 1.079 / m)) * m * m;
}
}
Program: 1409
Project: 1409
Buggy source:
private static void registerMemoryStats(final MetricRegistry stats,final MemoryUsage usage){
  if (usage != null) {
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return usage.getCommitted();
      }
    }
);
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return usage.getMax();
      }
    }
);
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return usage.getUsed();
      }
    }
);
  }
}

Fixed version (ground truth):
private static void registerMemoryStats(final MetricRegistry stats,final MemoryReporter mem){
  if (mem.getUsage() != null) {
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return mem.getUsage().getCommitted();
      }
    }
);
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return mem.getUsage().getMax();
      }
    }
);
    stats.register(new AbstractGauge<Long>("String_Node_Str"){
      @Override public Long read(){
        return mem.getUsage().getUsed();
      }
    }
);
  }
}
Program: 1411
Project: 1411
Buggy source:
/** 
 * @return a WindowedHistogram with different value in each underlying Histogram
 */
private WindowedHistogram<?> createFullHistogram(Amount<Long,Time> duration,int slices,FakeTicker ticker){
  long sliceDuration=duration.as(Time.NANOSECONDS) / slices;
  WindowedApproxHistogram wh=new WindowedApproxHistogram(duration,slices,DEFAULT_MAX_MEMORY,ticker);
  ticker.advance(Amount.of(1L,Time.NANOSECONDS));
  for (int i=1; i <= slices; i++) {
    for (int j=0; j < 1000; j++) {
      wh.add(i);
    }
    ticker.advance(Amount.of(sliceDuration,Time.NANOSECONDS));
  }
  return wh;
}

Fixed version (ground truth):
/** 
 * @return a WindowedHistogram with different value in each underlying Histogram
 */
private WindowedHistogram<?> createFullHistogram(Amount<Long,Time> duration,int slices,FakeTicker ticker){
  long sliceDuration=duration.as(Time.NANOSECONDS) / slices;
  WindowedApproxHistogram wh=new WindowedApproxHistogram(duration,slices,DEFAULT_MAX_MEMORY,ticker);
  ticker.advance(Amount.of(1L,Time.NANOSECONDS));
  return fillHistogram(wh,Amount.of(sliceDuration,Time.NANOSECONDS),slices,ticker);
}
Program: 1413
Project: 1413
Buggy source:
@Override public synchronized long getQuantile(double q){
  if (count == 0) {
    return 0L;
  }
  int buf0Size=Math.min(bufferSize,leafCount);
  int buf1Size=Math.max(0,leafCount - buf0Size);
  long sum=0;
  long target=(long)(count * q);
  int i=0;
  Arrays.sort(buffer[0],0,buf0Size);
  Arrays.sort(buffer[1],0,buf1Size);
  Arrays.fill(indices,0);
  while (sum < target) {
    i=smallest(buf0Size,buf1Size,indices);
    indices[i]++;
    sum+=weight(i);
  }
  return buffer[i][indices[i] - 1];
}

Fixed version (ground truth):
@Override public synchronized long getQuantile(double q){
  if (count == 0) {
    return 0L;
  }
  int buf0Size=Math.min(bufferSize,leafCount);
  int buf1Size=Math.max(0,leafCount - buf0Size);
  long sum=0;
  long target=(long)(count * q);
  int i=0;
  Arrays.sort(buffer[0],0,buf0Size);
  Arrays.sort(buffer[1],0,buf1Size);
  Arrays.fill(indices,0);
  do {
    i=smallest(buf0Size,buf1Size,indices);
    indices[i]++;
    sum+=weight(i);
  }
 while (sum < target);
  return buffer[i][indices[i] - 1];
}
Program: 1414
Project: 1414
Buggy source:
/** 
 * Bind a long value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindLong(int index,long value){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_long(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a long value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindLong(int index,long value){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_long(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1415
Project: 1415
Buggy source:
/** 
 * Bind a byte array value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindBlob(int index,byte[] value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_blob(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a byte array value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindBlob(int index,byte[] value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_blob(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1416
Project: 1416
Buggy source:
/** 
 * Clears all existing bindings. Unset bindings are treated as NULL.
 */
public void clearBindings(){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_clear_bindings();
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Clears all existing bindings. Unset bindings are treated as NULL.
 */
public void clearBindings(){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_clear_bindings();
  }
  finally {
    releaseReference();
  }
}
Program: 1417
Project: 1417
Buggy source:
/** 
 * Bind a double value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindDouble(int index,double value){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_double(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a double value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindDouble(int index,double value){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_double(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1418
Project: 1418
Buggy source:
/** 
 * Bind a String value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindString(int index,String value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_string(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a String value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindString(int index,String value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_string(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1419
Project: 1419
Buggy source:
/** 
 * Bind a NULL value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind null to
 */
public void bindNull(int index){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_null(index);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a NULL value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind null to
 */
public void bindNull(int index){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_null(index);
  }
  finally {
    releaseReference();
  }
}
Program: 1420
Project: 1420
Buggy source:
/** 
 * Release this program's resources, making it invalid.
 */
public void close(){
  if (!mDatabase.isOpen()) {
    return;
  }
  mDatabase.lock();
  try {
    releaseReference();
  }
  finally {
    mDatabase.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Release this program's resources, making it invalid.
 */
public void close(){
  if (mClosed) {
    return;
  }
  if (!mDatabase.isOpen()) {
    return;
  }
  mDatabase.lock();
  try {
    releaseReference();
  }
  finally {
    mDatabase.unlock();
  }
  mClosed=true;
}
Program: 1421
Project: 1421
Buggy source:
/** 
 * Bind a long value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindLong(int index,long value){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_long(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a long value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindLong(int index,long value){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_long(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1422
Project: 1422
Buggy source:
/** 
 * Bind a byte array value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindBlob(int index,byte[] value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_blob(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a byte array value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindBlob(int index,byte[] value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_blob(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1423
Project: 1423
Buggy source:
/** 
 * Clears all existing bindings. Unset bindings are treated as NULL.
 */
public void clearBindings(){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_clear_bindings();
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Clears all existing bindings. Unset bindings are treated as NULL.
 */
public void clearBindings(){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_clear_bindings();
  }
  finally {
    releaseReference();
  }
}
Program: 1424
Project: 1424
Buggy source:
/** 
 * Bind a double value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindDouble(int index,double value){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_double(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a double value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindDouble(int index,double value){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_double(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1425
Project: 1425
Buggy source:
/** 
 * Bind a String value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindString(int index,String value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_string(index,value);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a String value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind
 * @param value The value to bind
 */
public void bindString(int index,String value){
  if (value == null) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str");
  }
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_string(index,value);
  }
  finally {
    releaseReference();
  }
}
Program: 1426
Project: 1426
Buggy source:
/** 
 * Bind a NULL value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind null to
 */
public void bindNull(int index){
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_null(index);
  }
  finally {
    releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Bind a NULL value to this statement. The value remains bound until  {@link #clearBindings} is called.
 * @param index The 1-based index to the parameter to bind null to
 */
public void bindNull(int index){
  if (mClosed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!mDatabase.isOpen()) {
    throw new IllegalStateException("String_Node_Str" + mDatabase.getPath() + "String_Node_Str");
  }
  acquireReference();
  try {
    native_bind_null(index);
  }
  finally {
    releaseReference();
  }
}
Program: 1427
Project: 1427
Buggy source:
/** 
 * Release this program's resources, making it invalid.
 */
public void close(){
  if (!mDatabase.isOpen()) {
    return;
  }
  mDatabase.lock();
  try {
    releaseReference();
  }
  finally {
    mDatabase.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Release this program's resources, making it invalid.
 */
public void close(){
  if (mClosed) {
    return;
  }
  if (!mDatabase.isOpen()) {
    return;
  }
  mDatabase.lock();
  try {
    releaseReference();
  }
  finally {
    mDatabase.unlock();
  }
  mClosed=true;
}
Program: 1429
Project: 1429
Buggy source:
/** 
 * Convenience method for replacing a row in the database.
 * @param table the table in which to replace the row
 * @param nullColumnHack SQL doesn't allow inserting a completely empty row,so if initialValues is empty this row will explicitly be assigned a NULL value
 * @param initialValues this map contains the initial column values forthe row. The key
 * @return the row ID of the newly inserted row, or -1 if an error occurred
 */
public long replace(String table,String nullColumnHack,ContentValues initialValues){
  try {
    return insertWithOnConflict(table,nullColumnHack,initialValues,CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str" + initialValues,e);
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for replacing a row in the database.
 * @param table the table in which to replace the row
 * @param nullColumnHack SQL doesn't allow inserting a completely empty row,so if initialValues is empty this row will explicitly be assigned a NULL value
 * @param initialValues this map contains the initial column values forthe row. The key
 * @return the row ID of the newly inserted row, or -1 if an error occurred
 */
public long replace(String table,String nullColumnHack,ContentValues initialValues){
  try {
    return insertWithOnConflict(table,nullColumnHack,initialValues,CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str" + table,e);
    return -1;
  }
}
Program: 1432
Project: 1432
Buggy source:
/** 
 * Convenience method for inserting a row into the database.
 * @param table the table to insert the row into
 * @param nullColumnHack SQL doesn't allow inserting a completely empty row,so if initialValues is empty this column will explicitly be assigned a NULL value
 * @param values this map contains the initial column values for therow. The keys should be the column names and the values the column values
 * @return the row ID of the newly inserted row, or -1 if an error occurred
 */
public long insert(String table,String nullColumnHack,ContentValues values){
  try {
    return insertWithOnConflict(table,nullColumnHack,values,CONFLICT_NONE);
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str" + values,e);
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for inserting a row into the database.
 * @param table the table to insert the row into
 * @param nullColumnHack SQL doesn't allow inserting a completely empty row,so if initialValues is empty this column will explicitly be assigned a NULL value
 * @param values this map contains the initial column values for therow. The keys should be the column names and the values the column values
 * @return the row ID of the newly inserted row, or -1 if an error occurred
 */
public long insert(String table,String nullColumnHack,ContentValues values){
  try {
    return insertWithOnConflict(table,nullColumnHack,values,CONFLICT_NONE);
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str" + table,e);
    return -1;
  }
}
Program: 1433
Project: 1433
Buggy source:
/** 
 * Copy data from cursor to CursorWindow
 * @param position start position of data
 * @param window
 */
public void fillWindow(int position,android.database.CursorWindow window){
  if (position < 0 || position >= getCount()) {
    return;
  }
  window.acquireReference();
  try {
    int oldpos=mPos;
    mPos=position - 1;
    window.clear();
    window.setStartPosition(position);
    int columnNum=getColumnCount();
    window.setNumColumns(columnNum);
    while (moveToNext() && window.allocRow()) {
      for (int i=0; i < columnNum; i++) {
        String field=getString(i);
        if (field != null) {
          if (!window.putString(field,mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
 else {
          if (!window.putNull(mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
      }
    }
    mPos=oldpos;
  }
 catch (  IllegalStateException e) {
  }
 finally {
    window.releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Copy data from cursor to CursorWindow
 * @param position start position of data
 * @param window
 */
public void fillWindow(int position,android.database.CursorWindow window){
  DatabaseUtils.cursorFillWindow(this,position,window);
}
Program: 1434
Project: 1434
Buggy source:
@Override public void fillWindow(int position,CursorWindow window){
  if (position < 0 || position > getCount()) {
    return;
  }
  window.acquireReference();
  try {
    moveToPosition(position - 1);
    window.clear();
    window.setStartPosition(position);
    int columnNum=getColumnCount();
    window.setNumColumns(columnNum);
    while (moveToNext() && window.allocRow()) {
      for (int i=0; i < columnNum; i++) {
        String field=getString(i);
        if (field != null) {
          if (!window.putString(field,getPosition(),i)) {
            window.freeLastRow();
            break;
          }
        }
 else {
          if (!window.putNull(getPosition(),i)) {
            window.freeLastRow();
            break;
          }
        }
      }
    }
  }
 catch (  IllegalStateException e) {
  }
 finally {
    window.releaseReference();
  }
}

Fixed version (ground truth):
@Override public void fillWindow(int position,CursorWindow window){
  DatabaseUtils.cursorFillWindow(this,position,window);
}
Program: 1435
Project: 1435
Buggy source:
private void addEvent(String title,String password){
  SQLiteDatabase db=eventsData.getWritableDatabase(password);
  ContentValues values=new ContentValues();
  values.put(EventDataSQLHelper.TIME,System.currentTimeMillis());
  values.put(EventDataSQLHelper.TITLE,title);
  db.insert(EventDataSQLHelper.TABLE,null,values);
}

Fixed version (ground truth):
private void addEvent(String title,SQLiteDatabase db){
  ContentValues values=new ContentValues();
  values.put(EventDataSQLHelper.TIME,System.currentTimeMillis());
  values.put(EventDataSQLHelper.TITLE,title);
  db.insert(EventDataSQLHelper.TABLE,null,values);
}
Program: 1436
Project: 1436
Buggy source:
private Cursor getEvents(String password){
  SQLiteDatabase db=eventsData.getReadableDatabase(password);
  Cursor cursor=db.query(EventDataSQLHelper.TABLE,null,null,null,null,null,null);
  startManagingCursor(cursor);
  return cursor;
}

Fixed version (ground truth):
private Cursor getEvents(SQLiteDatabase db){
  Cursor cursor=db.query(EventDataSQLHelper.TABLE,null,null,null,null,null,null);
  startManagingCursor(cursor);
  return cursor;
}
Program: 1437
Project: 1437
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  SQLiteDatabase.loadLibs(this);
  String password="String_Node_Str";
  eventsData=new EventDataSQLHelper(this);
  SQLiteDatabase db=eventsData.getWritableDatabase(password);
  addEvent("String_Node_Str",password);
  Cursor cursor=getEvents(password);
  showEvents(cursor);
  db.close();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  SQLiteDatabase.loadLibs(this);
  String password="String_Node_Str";
  eventsData=new EventDataSQLHelper(this);
  SQLiteDatabase db=eventsData.getWritableDatabase(password);
  for (int i=1; i < 100; i++)   addEvent("String_Node_Str" + i,db);
  db.close();
  db=eventsData.getReadableDatabase(password);
  Cursor cursor=getEvents(db);
  showEvents(cursor);
  db.close();
}
Program: 1438
Project: 1438
Buggy source:
/** 
 * Copy data from cursor to CursorWindow
 * @param position start position of data
 * @param window
 */
public void fillWindow(int position,CursorWindow window){
  if (position < 0 || position > getCount()) {
    return;
  }
  window.acquireReference();
  try {
    int oldpos=mPos;
    mPos=position - 1;
    window.clear();
    window.setStartPosition(position);
    int columnNum=getColumnCount();
    window.setNumColumns(columnNum);
    while (moveToNext() && window.allocRow()) {
      for (int i=0; i < columnNum; i++) {
        String field=getString(i);
        if (field != null) {
          if (!window.putString(field,mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
 else {
          if (!window.putNull(mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
      }
    }
    mPos=oldpos;
  }
 catch (  IllegalStateException e) {
  }
 finally {
    window.releaseReference();
  }
}

Fixed version (ground truth):
/** 
 * Copy data from cursor to CursorWindow
 * @param position start position of data
 * @param window
 */
public void fillWindow(int position,android.database.CursorWindow window){
  if (position < 0 || position > getCount()) {
    return;
  }
  window.acquireReference();
  try {
    int oldpos=mPos;
    mPos=position - 1;
    window.clear();
    window.setStartPosition(position);
    int columnNum=getColumnCount();
    window.setNumColumns(columnNum);
    while (moveToNext() && window.allocRow()) {
      for (int i=0; i < columnNum; i++) {
        String field=getString(i);
        if (field != null) {
          if (!window.putString(field,mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
 else {
          if (!window.putNull(mPos,i)) {
            window.freeLastRow();
            break;
          }
        }
      }
    }
    mPos=oldpos;
  }
 catch (  IllegalStateException e) {
  }
 finally {
    window.releaseReference();
  }
}
Program: 1439
Project: 1439
Buggy source:
public boolean requery(){
  if (mSelfObserver != null && mSelfObserverRegistered == false) {
    mSelfObserverRegistered=true;
  }
  mDataSetObservable.notifyChanged();
  return true;
}

Fixed version (ground truth):
public boolean requery(){
  if (mSelfObserver != null && mSelfObserverRegistered == false) {
    mContentResolver.registerContentObserver(mNotifyUri,true,mSelfObserver);
    mSelfObserverRegistered=true;
  }
  mDataSetObservable.notifyChanged();
  return true;
}
Program: 1440
Project: 1440
Buggy source:
/** 
 * @hide
 */
public void deactivateInternal(){
  if (mSelfObserver != null) {
    mSelfObserverRegistered=false;
  }
  mDataSetObservable.notifyInvalidated();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public void deactivateInternal(){
  if (mSelfObserver != null) {
    mContentResolver.unregisterContentObserver(mSelfObserver);
    mSelfObserverRegistered=false;
  }
  mDataSetObservable.notifyInvalidated();
}
Program: 1441
Project: 1441
Buggy source:
/** 
 * Gets a SelfDataChangeOberserver that can be sent to a remote process to receive change notifications over IPC.
 * @return A SelfContentObserver hooked up to this Cursor
 */
public synchronized IContentObserver getObserver(){
  if (mObserverBridge == null) {
    mObserverBridge=new SelfContentObserver(this);
  }
  return mObserverBridge.getContentObserver();
}

Fixed version (ground truth):
/** 
 * Gets a SelfDataChangeOberserver that can be sent to a remote process to receive change notifications over IPC.
 * @return A SelfContentObserver hooked up to this Cursor
 */
public synchronized IContentObserver getObserver(){
  if (mObserverBridge == null) {
    mObserverBridge=new SelfContentObserver(this);
  }
  return null;
}
Program: 1442
Project: 1442
Buggy source:
private Bitmap getBitmapFromUrl(String url){
  Bitmap bitmap=null;
  try {
    URLConnection conn=new URL(url).openConnection();
    conn.setConnectTimeout(CONNECT_TIMEOUT);
    conn.setReadTimeout(READ_TIMEOUT);
    bitmap=BitmapFactory.decodeStream((InputStream)conn.getContent());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return bitmap;
}

Fixed version (ground truth):
private Bitmap getBitmapFromUrl(String url){
  Bitmap bitmap=null;
  try {
    URLConnection conn=new URL(url).openConnection();
    conn.setConnectTimeout(CONNECT_TIMEOUT);
    conn.setReadTimeout(READ_TIMEOUT);
    BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=8;
    Rect rect=new Rect(-1,-1,-1,-1);
    bitmap=BitmapFactory.decodeStream((InputStream)conn.getContent(),rect,options);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return bitmap;
}
Program: 1443
Project: 1443
Buggy source:
@Test public void toShortMessageWithFullConstructor() throws DeliveryReceiptException {
  DeliveryReceipt dlr=new DeliveryReceipt("String_Node_Str",1,1,new DateTime(0),new DateTime(0),SmppConstants.STATE_ENROUTE,0,"String_Node_Str");
  String receipt=dlr.toShortMessage();
  Assert.assertEquals("String_Node_Str",receipt);
}

Fixed version (ground truth):
@Test public void toShortMessageWithFullConstructor() throws DeliveryReceiptException {
  DeliveryReceipt dlr=new DeliveryReceipt("String_Node_Str",1,1,new DateTime(0L,DateTimeZone.UTC),new DateTime(0L,DateTimeZone.UTC),SmppConstants.STATE_ENROUTE,0,"String_Node_Str");
  String receipt=dlr.toShortMessage();
  Assert.assertEquals("String_Node_Str",receipt);
}
Program: 1444
Project: 1444
Buggy source:
@Override public int docID(){
  return primeDoc;
}

Fixed version (ground truth):
@Override public int docID(){
  return print(DOC_ID,primeDoc);
}
Program: 1445
Project: 1445
Buggy source:
@Override public int advance(int target) throws IOException {
  if (target == NO_MORE_DOCS) {
    return scorer.advance(NO_MORE_DOCS);
  }
  int doc=scorer.docID();
  int odoc=doc;
  if (isScorerExhausted(doc)) {
    return primeDoc=doc;
  }
  if (target > doc || doc == -1) {
    doc=scorer.advance(target);
    if (isScorerExhausted(doc)) {
      return primeDoc=doc;
    }
  }
 else   if (isScorerExhausted(doc)) {
    return primeDoc == -1 ? primeDoc=doc : primeDoc;
  }
  int gatherAllHitsSuperDoc=gatherAllHitsSuperDoc(doc);
  return gatherAllHitsSuperDoc;
}

Fixed version (ground truth):
@Override public int advance(int target) throws IOException {
  if (target == NO_MORE_DOCS) {
    return print(ADVANCE,primeDoc=scorer.advance(NO_MORE_DOCS));
  }
  int doc=scorer.docID();
  int odoc=doc;
  if (isScorerExhausted(doc)) {
    return print(ADVANCE,primeDoc=doc);
  }
  if (target > doc || doc == -1) {
    doc=scorer.advance(target);
    if (isScorerExhausted(doc)) {
      return print(ADVANCE,primeDoc=doc);
    }
  }
 else   if (isScorerExhausted(doc)) {
    return print(ADVANCE,primeDoc == -1 ? primeDoc=doc : primeDoc);
  }
  return print(ADVANCE,gatherAllHitsSuperDoc(doc));
}
Program: 1446
Project: 1446
Buggy source:
@Override public int nextDoc() throws IOException {
  int doc=scorer.docID();
  int odoc=doc;
  if (isScorerExhausted(doc)) {
    return primeDoc=doc;
  }
  if (doc == -1) {
    doc=scorer.nextDoc();
    if (isScorerExhausted(doc)) {
      return primeDoc=doc;
    }
  }
 else   if (isScorerExhausted(doc)) {
    return primeDoc == -1 ? primeDoc=doc : primeDoc;
  }
  int gatherAllHitsSuperDoc=gatherAllHitsSuperDoc(doc);
  return gatherAllHitsSuperDoc;
}

Fixed version (ground truth):
@Override public int nextDoc() throws IOException {
  int doc=scorer.docID();
  int odoc=doc;
  if (isScorerExhausted(doc)) {
    return primeDoc=doc;
  }
  if (doc == -1) {
    doc=scorer.nextDoc();
    if (isScorerExhausted(doc)) {
      return print(NEXT_DOC,primeDoc=doc);
    }
  }
 else   if (isScorerExhausted(doc)) {
    return print(NEXT_DOC,primeDoc == -1 ? primeDoc=doc : primeDoc);
  }
  return print(NEXT_DOC,gatherAllHitsSuperDoc(doc));
}
Program: 1448
Project: 1448
Buggy source:
public void init() throws IOException {
  initIndexWriterConfig();
  initIndexReader(IndexReader.open(getDirectory(),true));
}

Fixed version (ground truth):
public void init() throws IOException {
  initIndexWriterConfig();
  DirectIODirectory directory=getDirectory();
  if (!IndexReader.indexExists(directory)) {
    IndexWriterConfig conf=new IndexWriterConfig(Version.LUCENE_35,new KeywordAnalyzer());
    new IndexWriter(directory,conf).close();
  }
  initIndexReader(IndexReader.open(directory,true));
}
Program: 1449
Project: 1449
Buggy source:
private void waitForTheTableToEnable(String cluster,String table) throws BlurException {
  LOG.info("String_Node_Str" + table + "String_Node_Str");
}

Fixed version (ground truth):
private void waitForTheTableToEnable(String cluster,String table) throws BlurException {
  LOG.info("String_Node_Str" + table + "String_Node_Str");
  while (true) {
    if (_clusterStatus.isEnabled(false,cluster,table)) {
      return;
    }
    try {
      Thread.sleep(3000);
    }
 catch (    InterruptedException e) {
      LOG.error("String_Node_Str" + table + "String_Node_Str",e);
      throw new BException("String_Node_Str" + table + "String_Node_Str",e);
    }
  }
}
Program: 1450
Project: 1450
Buggy source:
private void waitForTheTableToDisengage(String cluster,String table) throws BlurException, TException {
  LOG.info("String_Node_Str" + table + "String_Node_Str");
}

Fixed version (ground truth):
private void waitForTheTableToDisengage(String cluster,String table) throws BlurException, TException {
}
Program: 1452
Project: 1452
Buggy source:
@Override public boolean isEnabled(boolean useCache,String cluster,String table){
  if (useCache) {
    Boolean enabled=_enabledMap.get(getClusterTableKey(cluster,table));
    if (enabled == null) {
      throw new RuntimeException("String_Node_Str" + table + "String_Node_Str");
    }
 else {
      return enabled;
    }
  }
  LOG.debug("String_Node_Str");
  String tablePathIsEnabled=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  try {
    if (_zk.exists(tablePathIsEnabled,false) == null) {
      return false;
    }
  }
 catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isEnabled(boolean useCache,String cluster,String table){
  if (useCache) {
    Boolean enabled=_enabledMap.get(getClusterTableKey(cluster,table));
    if (enabled == null) {
      return false;
    }
 else {
      return enabled;
    }
  }
  LOG.debug("String_Node_Str");
  String tablePathIsEnabled=ZookeeperPathConstants.getTableEnabledPath(cluster,table);
  try {
    if (_zk.exists(tablePathIsEnabled,false) == null) {
      return false;
    }
  }
 catch (  KeeperException e) {
    throw new RuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
  return true;
}