nus-yam/ex-repair huggingface dataset:
Program: 92754
Project: 92754
Buggy source:
public void setPluginParentClassLoader(ClassLoader parentClassLoader){
  if (parentClassLoader != null) {
    this.pluginParentClassLoader=parentClassLoader;
  }
 else {
    this.pluginParentClassLoader=ClassLoader.getSystemClassLoader().getParent();
  }
}

Fixed version (ground truth):
/** 
 * 插件中可能需要公用某些依赖库以减小体积，当你有这个需求的时候，请使用本API.
 * @param parentClassLoader classLoader
 */
public void setPluginParentClassLoader(ClassLoader parentClassLoader){
  if (parentClassLoader != null) {
    this.pluginParentClassLoader=parentClassLoader;
  }
 else {
    this.pluginParentClassLoader=ClassLoader.getSystemClassLoader().getParent();
  }
}
Program: 92755
Project: 92755
Buggy source:
public void ensureApplicationCreated(){
  if (application != null && !isApplicationOnCreated) {
synchronized (this) {
      try {
        application.onCreate();
        if (receivers != null && receivers.size() > 0) {
          for (          ResolveInfo resolveInfo : receivers) {
            if (resolveInfo.activityInfo != null) {
              try {
                BroadcastReceiver broadcastReceiver=(BroadcastReceiver)classLoader.loadClass(resolveInfo.activityInfo.name).newInstance();
                application.registerReceiver(broadcastReceiver,resolveInfo.filter);
              }
 catch (              Throwable e) {
                e.printStackTrace();
              }
            }
          }
        }
      }
 catch (      Throwable ignored) {
      }
      isApplicationOnCreated=true;
    }
  }
}

Fixed version (ground truth):
public void ensureApplicationCreated(){
  if (isApplicationCreated()) {
synchronized (this) {
      try {
        application.onCreate();
        if (receivers != null && receivers.size() > 0) {
          for (          ResolveInfo resolveInfo : receivers) {
            if (resolveInfo.activityInfo != null) {
              try {
                BroadcastReceiver broadcastReceiver=(BroadcastReceiver)classLoader.loadClass(resolveInfo.activityInfo.name).newInstance();
                application.registerReceiver(broadcastReceiver,resolveInfo.filter);
              }
 catch (              Throwable e) {
                e.printStackTrace();
                Trace.store("String_Node_Str" + resolveInfo.activityInfo.name);
              }
            }
          }
        }
      }
 catch (      Throwable ignored) {
      }
      isApplicationOnCreated=true;
    }
  }
}
Program: 92756
Project: 92756
Buggy source:
public boolean isApplicationCreated(){
  return application != null && isApplicationOnCreated;
}

Fixed version (ground truth):
public boolean isApplicationCreated(){
  return application != null || isApplicationOnCreated;
}
Program: 92758
Project: 92758
Buggy source:
private void replaceIntentTargetIfNeed(Context from,Intent intent){
  if (!intent.hasExtra(Globals.FLAG_ACTIVITY_FROM_PLUGIN) && currentPlugin != null) {
    ComponentName componentName=intent.getComponent();
    if (componentName != null) {
      String pkgName=componentName.getPackageName();
      String activityName=componentName.getClassName();
      if (pkgName != null) {
        CreateActivityData createActivityData=new CreateActivityData(activityName,currentPlugin.getPackageName());
        ActivityInfo activityInfo=currentPlugin.findActivityByClassName(activityName);
        intent.setClass(from,PluginManager.getSingleton().getActivitySelector().selectDynamicActivity(activityInfo));
        intent.putExtra(Globals.FLAG_ACTIVITY_FROM_PLUGIN,createActivityData);
      }
    }
  }
}

Fixed version (ground truth):
private void replaceIntentTargetIfNeed(Context from,Intent intent){
  if (!intent.hasExtra(Globals.FLAG_ACTIVITY_FROM_PLUGIN) && currentPlugin != null) {
    ComponentName componentName=intent.getComponent();
    if (componentName != null) {
      String pkgName=componentName.getPackageName();
      String activityName=componentName.getClassName();
      if (pkgName != null) {
        CreateActivityData createActivityData=new CreateActivityData(activityName,currentPlugin.getPackageName());
        ActivityInfo activityInfo=currentPlugin.findActivityByClassName(activityName);
        intent.setClass(from,PluginManager.getSingleton().getActivitySelector().selectDynamicActivity(activityInfo));
        intent.putExtra(Globals.FLAG_ACTIVITY_FROM_PLUGIN,createActivityData);
        intent.setExtrasClassLoader(currentPlugin.getClassLoader());
      }
    }
  }
}
Program: 92759
Project: 92759
Buggy source:
public int read(byte b[]) throws IOException {
  return read(b,0,b.length);
}

Fixed version (ground truth):
public int read(byte[] b) throws IOException {
  return read(b,0,b.length);
}
Program: 92760
Project: 92760
Buggy source:
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Integer.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  ensureCapacity(index,length);
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    byteArray[i + start]=(byte)(ZERO + remainder);
    i--;
  }
  return length;
}

Fixed version (ground truth):
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Long.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  ensureCapacity(index,length);
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    byteArray[i + start]=(byte)(ZERO + remainder);
    i--;
  }
  return length;
}
Program: 92761
Project: 92761
Buggy source:
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Integer.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  ensureCapacity(index,length);
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    byteBuffer.put(i + start,(byte)(ZERO + remainder));
    i--;
  }
  return length;
}

Fixed version (ground truth):
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Long.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  ensureCapacity(index,length);
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    byteBuffer.put(i + start,(byte)(ZERO + remainder));
    i--;
  }
  return length;
}
Program: 92762
Project: 92762
Buggy source:
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Integer.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  if (SHOULD_BOUNDS_CHECK) {
    boundsCheck0(index,length);
  }
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    putByteWithoutBoundsCheck(i + start,(byte)(ZERO + remainder));
    i--;
  }
  return length;
}

Fixed version (ground truth):
public int putLongAscii(final int index,final long value){
  if (value == 0) {
    putByte(index,ZERO);
    return 1;
  }
  if (value == Long.MIN_VALUE) {
    putBytes(index,MIN_LONG_VALUE);
    return MIN_LONG_VALUE.length;
  }
  int start=index;
  long quotient=value;
  int length=1;
  if (value < 0) {
    putByte(index,MINUS_SIGN);
    start++;
    length++;
    quotient=-quotient;
  }
  int i=endOffset(quotient);
  length+=i;
  if (SHOULD_BOUNDS_CHECK) {
    boundsCheck0(index,length);
  }
  while (i >= 0) {
    final long remainder=quotient % 10L;
    quotient=quotient / 10L;
    putByteWithoutBoundsCheck(i + start,(byte)(ZERO + remainder));
    i--;
  }
  return length;
}
Program: 92763
Project: 92763
Buggy source:
/** 
 * {@inheritDoc}
 */
public Integer put(final Integer key,final Integer value){
  return put((int)key,(int)value);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Integer put(final Integer key,final Integer value){
  final int existingValue=put((int)key,(int)value);
  return existingValue == missingValue ? null : existingValue;
}
Program: 92764
Project: 92764
Buggy source:
/** 
 * {@inheritDoc}
 */
public Integer get(final Object key){
  final int primitiveResult=get((int)key);
  return primitiveResult == missingValue ? null : primitiveResult;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Integer get(final Object key){
  final int value=get((int)key);
  return value == missingValue ? null : value;
}
Program: 92765
Project: 92765
Buggy source:
/** 
 * Unblock a multi-producer ring buffer where a producer has died during the act of offering. The operation will scan from the consumer position up to the producer position. If no action is required at the position then none will be taken.
 * @return true of an unblocking action was taken otherwise false.
 */
boolean unblock();

Fixed version (ground truth):
/** 
 * Unblock a multi-producer ring buffer when a producer has died during the act of offering. The operation will scan from the consumer position up to the producer position. If no action is required at the position then none will be taken.
 * @return true of an unblocking action was taken otherwise false.
 */
boolean unblock();
Program: 92766
Project: 92766
Buggy source:
/** 
 * Read as many messages as are available to end of the ring buffer to up a supplied maximum. If the ring buffer wraps or encounters a type of record, such a a padding record, then an implementation may choose to return an expect the caller to try again. The   {@link #size()} method may be called todetermine of a backlog of message bytes remains in the ring buffer.
 * @param handler           to be called for processing each message in turn.
 * @param messageCountLimit the number of messages will be read in a single invocation.
 * @return the number of messages that have been processed.
 */
int read(MessageHandler handler,int messageCountLimit);

Fixed version (ground truth):
/** 
 * Read as many messages as are available to end of the ring buffer to up a supplied maximum. If the ring buffer wraps or encounters a type of record, such a a padding record, then an implementation may choose to return and expect the caller to try again. The   {@link #size()} method may be called todetermine of a backlog of message bytes remains in the ring buffer.
 * @param handler           to be called for processing each message in turn.
 * @param messageCountLimit the number of messages will be read in a single invocation.
 * @return the number of messages that have been processed.
 */
int read(MessageHandler handler,int messageCountLimit);
Program: 92767
Project: 92767
Buggy source:
/** 
 * Size of the buffer backlog in bytes between producers and consumers. The value includes the size of headers. This method gives a concurrent snapshot of the buffer whereby a concurrent read or write may be partially complete and thus should be take as an indication.
 * @return size of the backlog of bytes in the buffer between producers and consumers.
 */
int size();

Fixed version (ground truth):
/** 
 * Size of the buffer backlog in bytes between producers and consumers. The value includes the size of headers. This method gives a concurrent snapshot of the buffer whereby a concurrent read or write may be partially complete and thus the value should be taken as an indication.
 * @return size of the backlog of bytes in the buffer between producers and consumers.
 */
int size();
Program: 92768
Project: 92768
Buggy source:
/** 
 * The position in bytes from start up of the producers.  The figure includes the headers. This is the range they are working with but could still be in the act of working with.
 * @return number of bytes produced by the producers in claimed space.
 */
long producerPosition();

Fixed version (ground truth):
/** 
 * The position in bytes from start up of the producers. The figure includes the headers. This is the range they are working with but could still be in the act of working with.
 * @return number of bytes produced by the producers in claimed space.
 */
long producerPosition();
Program: 92769
Project: 92769
Buggy source:
/** 
 * The position in bytes from start up for the consumers.  The figure includes the headers.
 * @return the count of bytes consumed by the consumers.
 */
long consumerPosition();

Fixed version (ground truth):
/** 
 * The position in bytes from start up for the consumers. The figure includes the headers.
 * @return the count of bytes consumed by the consumers.
 */
long consumerPosition();
Program: 92770
Project: 92770
Buggy source:
/** 
 * Add amount to the current value associated with this key. If no such value exists use   {@link #missingValue()} ascurrent value and associate key with  {@link #missingValue()} + amount unless amount is 0, in which case mapremains unchanged.
 * @param key    new or existing
 * @param amount to be added
 * @return the previous value associated with the specified key, or{@link #missingValue()} if there was no mapping for the key.
 */
public int getAndAdd(final int key,int amount){
  final int[] entries=this.entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=Hashing.evenHash(key,mask);
  int oldValue=missingValue;
  int candidateKey;
  while ((candidateKey=entries[index]) != missingValue) {
    if (candidateKey == key) {
      oldValue=entries[index + 1];
      break;
    }
    index=next(index,mask);
  }
  if (amount == 0) {
    return oldValue;
  }
  final int newValue=oldValue + amount;
  entries[index + 1]=newValue;
  if (oldValue == missingValue) {
    ++size;
    entries[index]=key;
    increaseCapacity();
  }
 else   if (newValue == missingValue) {
    entries[index]=missingValue;
    size--;
    compactChain(index);
  }
  return oldValue;
}

Fixed version (ground truth):
/** 
 * Add amount to the current value associated with this key. If no such value exists use   {@link #missingValue()} ascurrent value and associate key with  {@link #missingValue()} + amount unless amount is 0, in which case mapremains unchanged.
 * @param key    new or existing
 * @param amount to be added
 * @return the previous value associated with the specified key, or{@link #missingValue()} if there was no mapping for the key.
 */
public int getAndAdd(final int key,int amount){
  final int[] entries=this.entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=Hashing.evenHash(key,mask);
  int oldValue=missingValue;
  int candidateKey;
  while ((candidateKey=entries[index]) != missingValue) {
    if (candidateKey == key) {
      oldValue=entries[index + 1];
      break;
    }
    index=next(index,mask);
  }
  if (amount != 0) {
    final int newValue=oldValue + amount;
    entries[index + 1]=newValue;
    if (oldValue == missingValue) {
      ++size;
      entries[index]=key;
      increaseCapacity();
    }
 else     if (newValue == missingValue) {
      entries[index]=missingValue;
      size--;
      compactChain(index);
    }
  }
  return oldValue;
}
Program: 92771
Project: 92771
Buggy source:
/** 
 * See   {@link #addAll(IntHashSet)}
 */
public boolean removeAll(final IntHashSet coll){
  Objects.requireNonNull(coll);
  boolean acc=false;
  int t;
  for (IntIterator it=coll.iterator(); it.hasNext(); acc|=remove(t)) {
    t=it.nextValue();
  }
  return acc;
}

Fixed version (ground truth):
/** 
 * Alias for   {@link #removeAll(Collection)} for the specialized case when removing another IntHashSet,avoids boxing and allocations
 * @param coll containing the values to be removed.
 * @return <tt>true</tt> if this set changed as a result of the call
 */
public boolean removeAll(final IntHashSet coll){
  boolean acc=false;
  int value;
  for (final IntIterator iter=coll.iterator(); iter.hasNext(); acc|=remove(value)) {
    value=iter.nextValue();
  }
  return acc;
}
Program: 92772
Project: 92772
Buggy source:
private static <T>boolean disjunction(final Collection<T> coll,final Predicate<T> predicate){
  Objects.requireNonNull(coll);
  boolean acc=false;
  for (  final T t : coll) {
    acc|=predicate.test(t);
  }
  return acc;
}

Fixed version (ground truth):
private static <T>boolean disjunction(final Collection<T> coll,final Predicate<T> predicate){
  boolean acc=false;
  for (  final T t : coll) {
    acc|=predicate.test(t);
  }
  return acc;
}
Program: 92773
Project: 92773
Buggy source:
/** 
 * IntHashSet specialised variant of {this#containsAll(Collection)}.
 * @param other int hash set to compare against.
 * @return true if every element in other is in this.
 */
public boolean containsAll(final IntHashSet other){
  Objects.requireNonNull(other);
  final int missingValue=other.missingValue;
  for (  final int value : other.values) {
    if (value != missingValue && !contains(value)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * IntHashSet specialised variant of {this#containsAll(Collection)}.
 * @param other int hash set to compare against.
 * @return true if every element in other is in this.
 */
public boolean containsAll(final IntHashSet other){
  final int missingValue=other.missingValue;
  for (  final int value : other.values) {
    if (value != missingValue && !contains(value)) {
      return false;
    }
  }
  return true;
}
Program: 92774
Project: 92774
Buggy source:
/** 
 * Alias for   {@link #addAll(Collection)} for the specialized case when adding another IntHashSet,avoids boxing and allocations
 */
public boolean addAll(final IntHashSet coll){
  Objects.requireNonNull(coll);
  boolean acc=false;
  int t;
  for (IntIterator it=coll.iterator(); it.hasNext(); acc|=add(t)) {
    t=it.nextValue();
  }
  return acc;
}

Fixed version (ground truth):
/** 
 * Alias for   {@link #addAll(Collection)} for the specialized case when adding another IntHashSet,avoids boxing and allocations
 * @param coll containing the values to be added.
 * @return <tt>true</tt> if this set changed as a result of the call
 */
public boolean addAll(final IntHashSet coll){
  boolean acc=false;
  int value;
  for (final IntIterator iter=coll.iterator(); iter.hasNext(); acc|=add(value)) {
    value=iter.nextValue();
  }
  return acc;
}
Program: 92775
Project: 92775
Buggy source:
/** 
 * Fast Path set difference for comparison with another IntHashSet. <p> NB: garbage free in the identical case, allocates otherwise.
 * @param other the other set to subtract
 * @return null if identical, otherwise the set of differences
 */
public IntHashSet difference(final IntHashSet other){
  Objects.requireNonNull(other);
  IntHashSet difference=null;
  final int missingValue=this.missingValue;
  for (  final int value : values) {
    if (value != missingValue && !other.contains(value)) {
      if (difference == null) {
        difference=new IntHashSet(size,missingValue);
      }
      difference.add(value);
    }
  }
  return difference;
}

Fixed version (ground truth):
/** 
 * Fast Path set difference for comparison with another IntHashSet. <p> NB: garbage free in the identical case, allocates otherwise.
 * @param other the other set to subtract
 * @return null if identical, otherwise the set of differences
 */
public IntHashSet difference(final IntHashSet other){
  IntHashSet difference=null;
  final int missingValue=this.missingValue;
  for (  final int value : values) {
    if (value != missingValue && !other.contains(value)) {
      if (difference == null) {
        difference=new IntHashSet(size,missingValue);
      }
      difference.add(value);
    }
  }
  return difference;
}
Program: 92776
Project: 92776
Buggy source:
@Test public void addingSubsetDoesNothing(){
  addTwoElements(testSet);
  final IntHashSet subset=new IntHashSet(100,-1);
  subset.add(1);
  HashSet subSetCollection=new HashSet<>(subset);
  assertFalse(testSet.addAll(subset));
  assertFalse(testSet.addAll(subSetCollection));
  assertContainsElements(testSet);
}

Fixed version (ground truth):
@Test public void addingSubsetDoesNothing(){
  addTwoElements(testSet);
  final IntHashSet subset=new IntHashSet(100,-1);
  subset.add(1);
  final HashSet<Integer> subSetCollection=new HashSet<>(subset);
  assertFalse(testSet.addAll(subset));
  assertFalse(testSet.addAll(subSetCollection));
  assertContainsElements(testSet);
}
Program: 92777
Project: 92777
Buggy source:
@Test public void addingEqualSetDoesNothing(){
  addTwoElements(testSet);
  final IntHashSet equal=new IntHashSet(100,-1);
  addTwoElements(equal);
  HashSet<Integer> equalCollection=new HashSet<>(equal);
  assertFalse(testSet.addAll(equal));
  assertFalse(testSet.addAll(equalCollection));
  assertContainsElements(testSet);
}

Fixed version (ground truth):
@Test public void addingEqualSetDoesNothing(){
  addTwoElements(testSet);
  final IntHashSet equal=new IntHashSet(100,-1);
  addTwoElements(equal);
  final HashSet<Integer> equalCollection=new HashSet<>(equal);
  assertFalse(testSet.addAll(equal));
  assertFalse(testSet.addAll(equalCollection));
  assertContainsElements(testSet);
}
Program: 92778
Project: 92778
Buggy source:
/** 
 * Read all the errors in a log since a given timestamp.
 * @param buffer         containing the {@link DistinctErrorLog}.
 * @param consumer       to be called for each exception encountered.
 * @param sinceTimestamp for filtering errors that have been recorded since this time.
 * @return the number of entries that has been read.
 */
public static int read(final AtomicBuffer buffer,final ErrorConsumer consumer,final long sinceTimestamp){
  int entries=0;
  int offset=0;
  final int capacity=buffer.capacity();
  while (offset < capacity) {
    final int length=buffer.getIntVolatile(offset + LENGTH_OFFSET);
    if (0 == length) {
      break;
    }
    final long lastObservationTimestamp=buffer.getLongVolatile(offset + LAST_OBSERVATION_TIMESTAMP_OFFSET);
    if (lastObservationTimestamp >= sinceTimestamp) {
      ++entries;
      consumer.accept(buffer.getInt(offset + OBSERVATION_COUNT_OFFSET),buffer.getLong(offset + FIRST_OBSERVATION_TIMESTAMP_OFFSET),lastObservationTimestamp,buffer.getStringUtf8(offset + ENCODED_ERROR_OFFSET,length - ENCODED_ERROR_OFFSET));
    }
    offset+=align(length,RECORD_ALIGNMENT);
  }
  return entries;
}

Fixed version (ground truth):
/** 
 * Read all the errors in a log since a given timestamp.
 * @param buffer         containing the {@link DistinctErrorLog}.
 * @param consumer       to be called for each exception encountered.
 * @param sinceTimestamp for filtering errors that have been recorded since this time.
 * @return the number of entries that has been read.
 */
public static int read(final AtomicBuffer buffer,final ErrorConsumer consumer,final long sinceTimestamp){
  int entries=0;
  int offset=0;
  final int capacity=buffer.capacity();
  while (offset < capacity) {
    final int length=buffer.getIntVolatile(offset + LENGTH_OFFSET);
    if (0 == length) {
      break;
    }
    final long lastObservationTimestamp=buffer.getLongVolatile(offset + LAST_OBSERVATION_TIMESTAMP_OFFSET);
    if (lastObservationTimestamp >= sinceTimestamp) {
      ++entries;
      consumer.accept(buffer.getInt(offset + OBSERVATION_COUNT_OFFSET),buffer.getLong(offset + FIRST_OBSERVATION_TIMESTAMP_OFFSET),lastObservationTimestamp,buffer.getStringUtf8(offset + ENCODED_ERROR_OFFSET - BitUtil.SIZE_OF_INT,length - ENCODED_ERROR_OFFSET));
    }
    offset+=align(length,RECORD_ALIGNMENT);
  }
  return entries;
}
Program: 92779
Project: 92779
Buggy source:
@Test public void shouldReadSummarisedObservation(){
  final ErrorConsumer consumer=mock(ErrorConsumer.class);
  final long timestampOne=7;
  final long timestampTwo=10;
  final RuntimeException error=new RuntimeException("String_Node_Str");
  when(clock.time()).thenReturn(timestampOne).thenReturn(timestampTwo);
  log.record(error);
  log.record(error);
  assertThat(ErrorLogReader.read(buffer,consumer),is(1));
  verify(consumer).accept(eq(2),eq(timestampOne),eq(timestampTwo),any(String.class));
}

Fixed version (ground truth):
@Test public void shouldReadSummarisedObservation(){
  final ErrorConsumer consumer=mock(ErrorConsumer.class);
  final long timestampOne=7;
  final long timestampTwo=10;
  final RuntimeException error=new RuntimeException("String_Node_Str");
  final StringWriter stringWriter=new StringWriter();
  error.printStackTrace(new PrintWriter(stringWriter));
  final String errorAsString=stringWriter.toString();
  when(clock.time()).thenReturn(timestampOne).thenReturn(timestampTwo);
  log.record(error);
  log.record(error);
  assertThat(ErrorLogReader.read(buffer,consumer),is(1));
  verify(consumer).accept(eq(2),eq(timestampOne),eq(timestampTwo),eq(errorAsString));
}
Program: 92780
Project: 92780
Buggy source:
public static boolean compile(final DiagnosticCollector<JavaFileObject> diagnostics,final JavaCompiler.CompilationTask task){
  final Boolean succeeded=task.call();
  if (!succeeded) {
    for (    final Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
      System.err.println(diagnostic.getCode());
      System.err.println(diagnostic.getKind());
      final JavaFileObject source=diagnostic.getSource();
      System.err.printf("String_Node_Str",diagnostic.getLineNumber(),diagnostic.getColumnNumber(),source);
      System.out.println("String_Node_Str" + diagnostic.getStartPosition());
      System.out.println("String_Node_Str" + diagnostic.getEndPosition());
      System.out.println("String_Node_Str" + diagnostic.getPosition());
      try {
        final String content=source.getCharContent(true).toString();
        final int begin=content.lastIndexOf('\n',(int)diagnostic.getStartPosition());
        final int end=content.indexOf('\n',(int)diagnostic.getEndPosition());
        System.err.println(content.substring(begin,end));
        System.err.println(diagnostic.getMessage(null));
      }
 catch (      final IOException ex) {
        LangUtil.rethrowUnchecked(ex);
      }
    }
  }
  return succeeded;
}

Fixed version (ground truth):
public static boolean compile(final DiagnosticCollector<JavaFileObject> diagnostics,final JavaCompiler.CompilationTask task){
  final Boolean succeeded=task.call();
  if (!succeeded) {
    for (    final Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
      System.err.println(diagnostic.getCode());
      System.err.println(diagnostic.getKind());
      final JavaFileObject source=diagnostic.getSource();
      System.err.printf("String_Node_Str",diagnostic.getLineNumber(),diagnostic.getColumnNumber(),source);
      System.err.println("String_Node_Str" + diagnostic.getStartPosition());
      System.err.println("String_Node_Str" + diagnostic.getEndPosition());
      System.err.println("String_Node_Str" + diagnostic.getPosition());
      try {
        final String content=source.getCharContent(true).toString();
        final int begin=content.lastIndexOf('\n',(int)diagnostic.getStartPosition());
        final int end=content.indexOf('\n',(int)diagnostic.getEndPosition());
        System.err.println(diagnostic.getMessage(null));
        System.err.println(content.substring(Math.max(0,begin),end));
      }
 catch (      final IOException ex) {
        LangUtil.rethrowUnchecked(ex);
      }
    }
  }
  return succeeded;
}
Program: 92781
Project: 92781
Buggy source:
private static <T>boolean disjunction(final Collection<T> collection,final Predicate<T> predicate){
  Objects.requireNonNull(collection);
  boolean acc=false;
  for (  final T t : collection) {
    acc|=predicate.test(t);
  }
  return acc;
}

Fixed version (ground truth):
private static <T>boolean disjunction(final Collection<T> coll,final Predicate<T> predicate){
  Objects.requireNonNull(coll);
  boolean acc=false;
  for (  final T t : coll) {
    acc|=predicate.test(t);
  }
  return acc;
}
Program: 92782
Project: 92782
Buggy source:
private void rehash(@DoNotSub final int newCapacity){
  final int[] oldEntries=entries;
  @DoNotSub final int length=entries.length;
  capacity(newCapacity);
  for (@DoNotSub int i=0; i < length; i+=2) {
    final int key=oldEntries[i];
    if (key != missingValue) {
      put(key,oldEntries[i + 1]);
    }
  }
}

Fixed version (ground truth):
private void rehash(@DoNotSub final int newCapacity){
  final int[] oldEntries=entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int length=entries.length;
  capacity(newCapacity);
  for (@DoNotSub int i=0; i < length; i+=2) {
    final int key=oldEntries[i];
    if (key != missingValue) {
      put(key,oldEntries[i + 1]);
    }
  }
}
Program: 92783
Project: 92783
Buggy source:
protected void findNext(){
  final int[] entries=Int2IntHashMap.this.entries;
  @DoNotSub final int mask=entries.length - 1;
  for (@DoNotSub int i=positionCounter - 2; i >= stopCounter; i-=2) {
    @DoNotSub final int index=i & mask;
    if (entries[index] != missingValue) {
      positionCounter=i;
      return;
    }
  }
  throw new NoSuchElementException();
}

Fixed version (ground truth):
protected void findNext(){
  final int[] entries=Int2IntHashMap.this.entries;
  final int missingValue=Int2IntHashMap.this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  for (@DoNotSub int i=positionCounter - 2; i >= stopCounter; i-=2) {
    @DoNotSub final int index=i & mask;
    if (entries[index] != missingValue) {
      positionCounter=i;
      return;
    }
  }
  throw new NoSuchElementException();
}
Program: 92784
Project: 92784
Buggy source:
public int remove(final int key){
  final int[] entries=this.entries;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=Hashing.evenHash(key,mask);
  int oldValue=missingValue;
  int candidateKey;
  while ((candidateKey=entries[index]) != missingValue) {
    if (candidateKey == key) {
      @DoNotSub final int valueIndex=index + 1;
      oldValue=entries[valueIndex];
      entries[index]=missingValue;
      entries[valueIndex]=missingValue;
      size--;
      compactChain(index);
      break;
    }
    index=next(index,mask);
  }
  return oldValue;
}

Fixed version (ground truth):
public int remove(final int key){
  final int[] entries=this.entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=Hashing.evenHash(key,mask);
  int oldValue=missingValue;
  int candidateKey;
  while ((candidateKey=entries[index]) != missingValue) {
    if (candidateKey == key) {
      @DoNotSub final int valueIndex=index + 1;
      oldValue=entries[valueIndex];
      entries[index]=missingValue;
      entries[valueIndex]=missingValue;
      size--;
      compactChain(index);
      break;
    }
    index=next(index,mask);
  }
  return oldValue;
}
Program: 92785
Project: 92785
Buggy source:
private void capacity(@DoNotSub final int newCapacity){
  resizeThreshold=(int)(newCapacity * loadFactor);
  entries=new int[newCapacity * 2];
  size=0;
  Arrays.fill(entries,missingValue);
}

Fixed version (ground truth):
private void capacity(@DoNotSub int newCapacity){
  @DoNotSub final int entriesLength=newCapacity * 2;
  if (entriesLength < 0) {
    throw new IllegalStateException("String_Node_Str" + size);
  }
  resizeThreshold=(int)(newCapacity * loadFactor);
  entries=new int[entriesLength];
  size=0;
  Arrays.fill(entries,missingValue);
}
Program: 92786
Project: 92786
Buggy source:
/** 
 * Get the minimum value stored in the map. If the map is empty then it will return   {@link #missingValue()}
 * @return the minimum value stored in the map.
 */
public int minValue(){
  int min=size == 0 ? missingValue : Integer.MAX_VALUE;
  final int[] entries=this.entries;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=1; i < length; i+=2) {
    final int value=entries[i];
    if (value != missingValue) {
      min=Math.min(min,value);
    }
  }
  return min;
}

Fixed version (ground truth):
/** 
 * Get the minimum value stored in the map. If the map is empty then it will return   {@link #missingValue()}
 * @return the minimum value stored in the map.
 */
public int minValue(){
  final int missingValue=this.missingValue;
  int min=size == 0 ? missingValue : Integer.MAX_VALUE;
  final int[] entries=this.entries;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=1; i < length; i+=2) {
    final int value=entries[i];
    if (value != missingValue) {
      min=Math.min(min,value);
    }
  }
  return min;
}
Program: 92787
Project: 92787
Buggy source:
private void increaseCapacity(){
  if (size > resizeThreshold) {
    @DoNotSub final int newCapacity=entries.length;
    if (newCapacity < 0) {
      throw new IllegalStateException("String_Node_Str" + size);
    }
    rehash(newCapacity);
  }
}

Fixed version (ground truth):
private void increaseCapacity(){
  if (size > resizeThreshold) {
    @DoNotSub final int newCapacity=entries.length;
    rehash(newCapacity);
  }
}
Program: 92788
Project: 92788
Buggy source:
private void compactChain(@DoNotSub int deleteIndex){
  final int[] entries=this.entries;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=deleteIndex;
  while (true) {
    index=next(index,mask);
    if (entries[index] == missingValue) {
      break;
    }
    @DoNotSub final int hash=Hashing.evenHash(entries[index],mask);
    if ((index < hash && (hash <= deleteIndex || deleteIndex <= index)) || (hash <= deleteIndex && deleteIndex <= index)) {
      entries[deleteIndex]=entries[index];
      entries[deleteIndex + 1]=entries[index + 1];
      entries[index]=missingValue;
      entries[index + 1]=missingValue;
      deleteIndex=index;
    }
  }
}

Fixed version (ground truth):
private void compactChain(@DoNotSub int deleteIndex){
  final int[] entries=this.entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  @DoNotSub int index=deleteIndex;
  while (true) {
    index=next(index,mask);
    if (entries[index] == missingValue) {
      break;
    }
    @DoNotSub final int hash=Hashing.evenHash(entries[index],mask);
    if ((index < hash && (hash <= deleteIndex || deleteIndex <= index)) || (hash <= deleteIndex && deleteIndex <= index)) {
      entries[deleteIndex]=entries[index];
      entries[deleteIndex + 1]=entries[index + 1];
      entries[index]=missingValue;
      entries[index + 1]=missingValue;
      deleteIndex=index;
    }
  }
}
Program: 92789
Project: 92789
Buggy source:
/** 
 * Get the maximum value stored in the map. If the map is empty then it will return   {@link #missingValue()}
 * @return the maximum value stored in the map.
 */
public int maxValue(){
  int max=size == 0 ? missingValue : Integer.MIN_VALUE;
  final int[] entries=this.entries;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=1; i < length; i+=2) {
    final int value=entries[i];
    if (value != missingValue) {
      max=Math.max(max,value);
    }
  }
  return max;
}

Fixed version (ground truth):
/** 
 * Get the maximum value stored in the map. If the map is empty then it will return   {@link #missingValue()}
 * @return the maximum value stored in the map.
 */
public int maxValue(){
  final int missingValue=this.missingValue;
  int max=size == 0 ? missingValue : Integer.MIN_VALUE;
  final int[] entries=this.entries;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=1; i < length; i+=2) {
    final int value=entries[i];
    if (value != missingValue) {
      max=Math.max(max,value);
    }
  }
  return max;
}
Program: 92790
Project: 92790
Buggy source:
public boolean hasNext(){
  final int[] entries=Int2IntHashMap.this.entries;
  @DoNotSub final int mask=entries.length - 1;
  boolean hasNext=false;
  for (@DoNotSub int i=positionCounter - 2; i >= stopCounter; i-=2) {
    @DoNotSub final int index=i & mask;
    if (entries[index] != missingValue) {
      hasNext=true;
      break;
    }
  }
  return hasNext;
}

Fixed version (ground truth):
public boolean hasNext(){
  final int[] entries=Int2IntHashMap.this.entries;
  final int missingValue=Int2IntHashMap.this.missingValue;
  @DoNotSub final int mask=entries.length - 1;
  boolean hasNext=false;
  for (@DoNotSub int i=positionCounter - 2; i >= stopCounter; i-=2) {
    @DoNotSub final int index=i & mask;
    if (entries[index] != missingValue) {
      hasNext=true;
      break;
    }
  }
  return hasNext;
}
Program: 92791
Project: 92791
Buggy source:
/** 
 * Primitive specialised forEach implementation. <p> NB: Renamed from forEach to avoid overloading on parameter types of lambda expression, which doesn't interplay well with type inference in lambda expressions.
 * @param consumer a callback called for each key/value pair in the map.
 */
public void intForEach(final IntIntConsumer consumer){
  final int[] entries=this.entries;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=0; i < length; i+=2) {
    final int key=entries[i];
    if (key != missingValue) {
      consumer.accept(entries[i],entries[i + 1]);
    }
  }
}

Fixed version (ground truth):
/** 
 * Primitive specialised forEach implementation. <p> NB: Renamed from forEach to avoid overloading on parameter types of lambda expression, which doesn't interplay well with type inference in lambda expressions.
 * @param consumer a callback called for each key/value pair in the map.
 */
public void intForEach(final IntIntConsumer consumer){
  final int[] entries=this.entries;
  final int missingValue=this.missingValue;
  @DoNotSub final int length=entries.length;
  for (@DoNotSub int i=0; i < length; i+=2) {
    final int key=entries[i];
    if (key != missingValue) {
      consumer.accept(entries[i],entries[i + 1]);
    }
  }
}
Program: 92792
Project: 92792
Buggy source:
public int read(final byte[] dstBytes,final int dstOffset,final int length) throws IOException {
  int bytesRead=-1;
  if (position < this.length) {
    bytesRead=Math.min(length,available());
    buffer.getBytes(this.offset + position + bytesRead,dstBytes,dstOffset,bytesRead);
    position+=bytesRead;
  }
  return bytesRead;
}

Fixed version (ground truth):
public int read(final byte[] dstBytes,final int dstOffset,final int length) throws IOException {
  int bytesRead=-1;
  if (position < this.length) {
    bytesRead=Math.min(length,available());
    buffer.getBytes(offset + position,dstBytes,dstOffset,bytesRead);
    position+=bytesRead;
  }
  return bytesRead;
}
Program: 92793
Project: 92793
Buggy source:
/** 
 * An int specialised version of {this#remove(Object)}.
 * @param value the value to remove
 * @return true if the value was present, false otherwise
 */
public boolean remove(final int value){
  @DoNotSub int index=Hashing.intHash(value,mask);
  while (values[index] != missingValue) {
    if (values[index] == value) {
      values[index]=missingValue;
      compactChain(index);
      size--;
      return true;
    }
    index=next(index);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * An int specialised version of {this#remove(Object)}.
 * @param value the value to remove
 * @return true if the value was present, false otherwise
 */
public boolean remove(final int value){
  @DoNotSub int index=Hashing.intHash(value,mask);
  final int[] values=this.values;
  while (values[index] != missingValue) {
    if (values[index] == value) {
      values[index]=missingValue;
      compactChain(index);
      size--;
      return true;
    }
    index=next(index);
  }
  return false;
}
Program: 92794
Project: 92794
Buggy source:
@DoNotSub private void compactChain(final int deleteIndex){
  final int[] values=this.values;
  @DoNotSub int index=deleteIndex;
  while (true) {
    @DoNotSub final int previousIndex=index;
    index=next(index);
    if (values[index] == missingValue) {
      return;
    }
    values[previousIndex]=values[index];
    values[index]=missingValue;
  }
}

Fixed version (ground truth):
@DoNotSub private void compactChain(int deleteIndex){
  final int[] values=this.values;
  @DoNotSub int index=deleteIndex;
  while (true) {
    index=next(index);
    if (values[index] == missingValue) {
      return;
    }
    @DoNotSub final int hash=Hashing.intHash(values[index],mask);
    if ((index < hash && (hash <= deleteIndex || deleteIndex <= index)) || (hash <= deleteIndex && deleteIndex <= index)) {
      values[deleteIndex]=values[index];
      values[index]=missingValue;
      deleteIndex=index;
    }
  }
}
Program: 92795
Project: 92795
Buggy source:
/** 
 * An int specialised version of {this#remove(Object)}.
 * @param value the value to remove
 * @return true if the value was present, false otherwise
 */
public boolean remove(final int value){
  @DoNotSub int index=Hashing.intHash(value,mask);
  while (values[index] != missingValue) {
    if (values[index] == value) {
      values[index]=missingValue;
      compactChain(index);
      return true;
    }
    index=next(index);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * An int specialised version of {this#remove(Object)}.
 * @param value the value to remove
 * @return true if the value was present, false otherwise
 */
public boolean remove(final int value){
  @DoNotSub int index=Hashing.intHash(value,mask);
  while (values[index] != missingValue) {
    if (values[index] == value) {
      values[index]=missingValue;
      compactChain(index);
      size--;
      return true;
    }
    index=next(index);
  }
  return false;
}
Program: 92796
Project: 92796
Buggy source:
@SuppressWarnings("String_Node_Str") public Int2IntHashMap(@DoNotSub final int initialCapacity,@DoNotSub final double loadFactor,final int missingValue){
  this.loadFactor=loadFactor;
  this.missingValue=missingValue;
  capacity(BitUtil.findNextPositivePowerOfTwo(initialCapacity));
  final PrimitiveIterator keyIterator=new PrimitiveIterator(0);
  keySet=new MapDelegatingSet<>(this,keyIterator::reset,this::containsValue);
  values=new MapDelegatingSet<>(this,valueIterator::reset,this::containsKey);
  final EntryIterator entryIterator=new EntryIterator();
  entrySet=new MapDelegatingSet<>(this,entryIterator::reset,(e) -> containsKey(((Entry<Long,Long>)e).getKey()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Int2IntHashMap(@DoNotSub final int initialCapacity,@DoNotSub final double loadFactor,final int missingValue){
  this.loadFactor=loadFactor;
  this.missingValue=missingValue;
  capacity(BitUtil.findNextPositivePowerOfTwo(initialCapacity));
  final PrimitiveIterator keyIterator=new PrimitiveIterator(0);
  valueIterator=new PrimitiveIterator(1);
  keySet=new MapDelegatingSet<>(this,keyIterator::reset,this::containsValue);
  values=new MapDelegatingSet<>(this,valueIterator::reset,this::containsKey);
  final EntryIterator entryIterator=new EntryIterator();
  entrySet=new MapDelegatingSet<>(this,entryIterator::reset,(e) -> containsKey(((Entry<Long,Long>)e).getKey()));
}
Program: 92797
Project: 92797
Buggy source:
private EntryIterator(){
  super(0);
}

Fixed version (ground truth):
private EntryIterator(){
  super();
}
Program: 92798
Project: 92798
Buggy source:
protected AbstractIterator(@DoNotSub final int startIndex){
  this.startIndex=startIndex;
  index=startIndex;
}

Fixed version (ground truth):
public AbstractIterator(){
  reset();
}
Program: 92799
Project: 92799
Buggy source:
private PrimitiveIterator(@DoNotSub final int startIndex){
  super(startIndex);
}

Fixed version (ground truth):
private PrimitiveIterator(@DoNotSub final int offset){
  this.offset=offset;
}
Program: 92800
Project: 92800
Buggy source:
public boolean hasNext(){
  while (entries[index] == missingValue) {
    nextIndex();
    if (index == startIndex) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean hasNext(){
  final int[] entries=Int2IntHashMap.this.entries;
  for (@DoNotSub int i=positionCounter - 2; i >= stopCounter; i-=2) {
    @DoNotSub final int index=i & mask;
    if (entries[index] != missingValue) {
      return true;
    }
  }
  return false;
}
Program: 92801
Project: 92801
Buggy source:
private EntryIterator reset(){
  index=startIndex;
  return this;
}

Fixed version (ground truth):
public EntryIterator reset(){
  super.reset();
  key=missingValue;
  value=missingValue;
  return this;
}
Program: 92802
Project: 92802
Buggy source:
public int nextValue(){
  final int entry=entries[index];
  nextIndex();
  return entry;
}

Fixed version (ground truth):
public int nextValue(){
  findNext();
  return entries[getKeyPosition() + offset];
}
Program: 92803
Project: 92803
Buggy source:
@Test public void entrySetShouldContainEntries(){
  map.put(1,1);
  map.put(2,3);
  final Set<Entry<Integer,Integer>> entrySet=map.entrySet();
  assertEquals(2,entrySet.size());
  assertFalse(entrySet.isEmpty());
  final Iterator<Entry<Integer,Integer>> it=entrySet.iterator();
  assertTrue(it.hasNext());
  assertEntryIs(it.next(),1,1);
  assertTrue(it.hasNext());
  assertEntryIs(it.next(),2,3);
  assertFalse(it.hasNext());
}

Fixed version (ground truth):
@Test public void entrySetShouldContainEntries(){
  addTwoElements();
  final Set<Entry<Integer,Integer>> entrySet=map.entrySet();
  assertEquals(2,entrySet.size());
  assertFalse(entrySet.isEmpty());
  final Iterator<Entry<Integer,Integer>> it=entrySet.iterator();
  assertTrue(it.hasNext());
  assertEntryIs(it.next(),2,3);
  assertTrue(it.hasNext());
  assertEntryIs(it.next(),1,1);
  assertFalse(it.hasNext());
}
Program: 92804
Project: 92804
Buggy source:
@Test public void shouldPutAllMembersOfAnotherHashMap(){
  map.put(1,1);
  map.put(2,3);
  final Map<Integer,Integer> other=new HashMap<>();
  other.put(1,2);
  other.put(3,4);
  map.putAll(other);
  assertEquals(3,map.size());
  assertEquals(2,map.get(1));
  assertEquals(3,map.get(2));
  assertEquals(4,map.get(3));
}

Fixed version (ground truth):
@Test public void shouldPutAllMembersOfAnotherHashMap(){
  addTwoElements();
  final Map<Integer,Integer> other=new HashMap<>();
  other.put(1,2);
  other.put(3,4);
  map.putAll(other);
  assertEquals(3,map.size());
  assertEquals(2,map.get(1));
  assertEquals(3,map.get(2));
  assertEquals(4,map.get(3));
}
Program: 92805
Project: 92805
Buggy source:
/** 
 * {@inheritDoc}
 */
public Object[] toArray(){
  final int[] values=this.values;
  final Object[] array=new Object[values.length];
  for (@DoNotSub int i=0; i < values.length; i++) {
    array[i]=values[i];
  }
  return array;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Object[] toArray(){
  final Object[] arrayCopy=new Object[size];
  copyValues(arrayCopy);
  return arrayCopy;
}