nus-yam/ex-repair huggingface dataset:
Program: 55249
Project: 55249
Buggy source:
/** 
 * Unassigns a cloud instance from the job.
 * @param instance the cloud instance which will be unassigned
 * @return the unassigned cloud instance
 */
public boolean unassignInstanceFromJob(final AbstractInstance instance){
synchronized (this.assignedInstances) {
    return this.assignedInstances.remove(instance);
  }
}

Fixed version (ground truth):
/** 
 * Unassigns a cloud instance from the job.
 * @param instance the cloud instance which will be unassigned
 * @return <code>true</code> if the given cloud instance has been assigned to the job, <code>false</code> otherwise
 */
public boolean unassignInstanceFromJob(final AbstractInstance instance){
synchronized (this.assignedInstances) {
    return (this.assignedInstances.remove(instance) != null);
  }
}
Program: 55250
Project: 55250
Buggy source:
/** 
 * Unassigns all currently assigned instances from that job and returns them.
 * @return the list of instances previously assigned to this job. The list is possibly empty.
 */
public List<EC2CloudInstance> unassignAllInstancesFromJob(){
  final List<EC2CloudInstance> unassignedInstances;
synchronized (this.assignedInstances) {
    unassignedInstances=new ArrayList<EC2CloudInstance>(this.assignedInstances);
    this.assignedInstances.clear();
  }
  return unassignedInstances;
}

Fixed version (ground truth):
/** 
 * Unassigns all currently assigned instances from that job and returns them.
 * @return the list of instances previously assigned to this job. The list is possibly empty.
 */
public List<EC2CloudInstance> unassignAllInstancesFromJob(){
  final List<EC2CloudInstance> unassignedInstances;
synchronized (this.assignedInstances) {
    unassignedInstances=new ArrayList<EC2CloudInstance>(this.assignedInstances.values());
    this.assignedInstances.clear();
  }
  return unassignedInstances;
}
Program: 55251
Project: 55251
Buggy source:
/** 
 * Assigns a cloud instance to the job.
 * @param instance the cloud instance which will be assigned
 */
public void assignInstanceToJob(final EC2CloudInstance instance){
synchronized (this.assignedInstances) {
    this.assignedInstances.add(instance);
  }
}

Fixed version (ground truth):
/** 
 * Assigns a cloud instance to the job.
 * @param instance the cloud instance which will be assigned
 */
public void assignInstanceToJob(final EC2CloudInstance instance){
synchronized (this.assignedInstances) {
    this.assignedInstances.put(instance.getInstanceConnectionInfo(),instance);
  }
}
Program: 55252
Project: 55252
Buggy source:
/** 
 * Returns the cloud instance matching the given connection information.
 * @param instanceConnectionInfo the  {@link InstanceConnectionInfo} object identifying the instance
 * @return the cloud instance matching the given connection information or <code>null</code> if no matching instanceexists
 */
public EC2CloudInstance getInstanceByConnectionInfo(final InstanceConnectionInfo instanceConnectionInfo){
  if (instanceConnectionInfo == null) {
    return null;
  }
synchronized (this.assignedInstances) {
    final Iterator<EC2CloudInstance> it=this.assignedInstances.iterator();
    while (it.hasNext()) {
      final EC2CloudInstance ci=it.next();
      if (instanceConnectionInfo.equals(ci.getInstanceConnectionInfo())) {
        return ci;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the cloud instance matching the given connection information.
 * @param instanceConnectionInfo the  {@link InstanceConnectionInfo} object identifying the instance
 * @return the cloud instance matching the given connection information or <code>null</code> if no matching instanceexists
 */
public EC2CloudInstance getInstanceByConnectionInfo(final InstanceConnectionInfo instanceConnectionInfo){
  if (instanceConnectionInfo == null) {
    return null;
  }
synchronized (this.assignedInstances) {
    return this.assignedInstances.get(instanceConnectionInfo);
  }
}
Program: 55253
Project: 55253
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  final Kryo kryo=threadLocalKryo.get();
  kryo.reset();
  final RPCEnvelope envelope=kryo.readObject(input,RPCEnvelope.class);
  final RPCMessage msg=envelope.getRPCMessage();
  if (fragmentationID != msg.getMessageID()) {
    Log.error("String_Node_Str");
    return;
  }
  if (msg instanceof RPCRequest) {
    processIncomingRPCRequest(remoteSocketAddress,(RPCRequest)msg);
  }
 else   if (msg instanceof RPCResponse) {
    processIncomingRPCResponse((RPCResponse)msg);
  }
 else {
    processIncomingRPCCleanup(remoteSocketAddress,(RPCCleanup)msg);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  final Kryo k=kryo.get();
  k.reset();
  final RPCEnvelope envelope=k.readObject(input,RPCEnvelope.class);
  final RPCMessage msg=envelope.getRPCMessage();
  if (fragmentationID != msg.getMessageID()) {
    Log.error("String_Node_Str");
    return;
  }
  if (msg instanceof RPCRequest) {
    processIncomingRPCRequest(remoteSocketAddress,(RPCRequest)msg);
  }
 else   if (msg instanceof RPCResponse) {
    processIncomingRPCResponse((RPCResponse)msg);
  }
 else {
    processIncomingRPCCleanup(remoteSocketAddress,(RPCCleanup)msg);
  }
}
Program: 55255
Project: 55255
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected Kryo initialValue(){
  final Kryo kryo=new Kryo();
  if (kryoTypesToRegister != null) {
    kryo.setAutoReset(false);
    kryo.setRegistrationRequired(true);
    for (    final Class<?> kryoType : kryoTypesToRegister) {
      kryo.register(kryoType);
    }
  }
  return kryo;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected Kryo initialValue(){
  final Kryo kryo=new Kryo();
  if (kryoTypesToRegister != null) {
    kryo.setAutoReset(false);
    kryo.setRegistrationRequired(true);
    kryo.setReferences(false);
    for (    final Class<?> kryoType : kryoTypesToRegister) {
      kryo.register(kryoType);
    }
  }
  return kryo;
}
Program: 55256
Project: 55256
Buggy source:
void processIncomingRPCMessage(final InetSocketAddress remoteSocketAddress,final Input input,final int fragmentationID){
  final ThreadLocal<Kryo> threadLocalKryo=this.kryo;
  final Runnable runnable=new Runnable(){
    /** 
 * {@inheritDoc}
 */
    @Override public void run(){
      final Kryo kryo=threadLocalKryo.get();
      kryo.reset();
      final RPCEnvelope envelope=kryo.readObject(input,RPCEnvelope.class);
      final RPCMessage msg=envelope.getRPCMessage();
      if (fragmentationID != msg.getMessageID()) {
        Log.error("String_Node_Str");
        return;
      }
      if (msg instanceof RPCRequest) {
        processIncomingRPCRequest(remoteSocketAddress,(RPCRequest)msg);
      }
 else       if (msg instanceof RPCResponse) {
        processIncomingRPCResponse((RPCResponse)msg);
      }
 else {
        processIncomingRPCCleanup(remoteSocketAddress,(RPCCleanup)msg);
      }
    }
  }
;
  this.rpcHandlers.execute(runnable);
}

Fixed version (ground truth):
void processIncomingRPCMessage(final InetSocketAddress remoteSocketAddress,final Input input,final int fragmentationID){
  final Runnable runnable=new Runnable(){
    /** 
 * {@inheritDoc}
 */
    @Override public void run(){
      final Kryo k=kryo.get();
      k.reset();
      final RPCEnvelope envelope=k.readObject(input,RPCEnvelope.class);
      final RPCMessage msg=envelope.getRPCMessage();
      if (fragmentationID != msg.getMessageID()) {
        Log.error("String_Node_Str");
        return;
      }
      if (msg instanceof RPCRequest) {
        processIncomingRPCRequest(remoteSocketAddress,(RPCRequest)msg);
      }
 else       if (msg instanceof RPCResponse) {
        processIncomingRPCResponse((RPCResponse)msg);
      }
 else {
        processIncomingRPCCleanup(remoteSocketAddress,(RPCCleanup)msg);
      }
    }
  }
;
  this.rpcHandlers.execute(runnable);
}
Program: 55257
Project: 55257
Buggy source:
/** 
 * Stops the discovery service.
 */
public static synchronized void stopDiscoveryService(){
  if (discoveryService != null) {
    if (discoveryService.isRunning()) {
      discoveryService.stopService();
    }
  }
}

Fixed version (ground truth):
/** 
 * Stops the discovery service.
 */
public static synchronized void stopDiscoveryService(){
  if (discoveryService != null && discoveryService.isRunning()) {
    discoveryService.stopService();
  }
}
Program: 55261
Project: 55261
Buggy source:
/** 
 * Submits the job assigned to this job client to the job manager.
 * @return a <code>JobSubmissionResult</code> object encapsulating the results of the job submission
 * @throws IOException thrown in case of submission errors while transmitting the data to the job manager
 */
public JobSubmissionResult submitJob() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.submitJob(this.jobGraph);
  }
}

Fixed version (ground truth):
/** 
 * Submits the job assigned to this job client to the job manager.
 * @return a <code>JobSubmissionResult</code> object encapsulating the results of the job submission
 * @throws IOException thrown in case of submission errors while transmitting the data to the job manager
 */
public JobSubmissionResult submitJob() throws IOException {
  return this.jobSubmitClient.submitJob(this.jobGraph);
}
Program: 55262
Project: 55262
Buggy source:
/** 
 * Cancels the job assigned to this job client.
 * @return a <code>JobCancelResult</code> object encapsulating the result of the job cancel request
 * @throws IOException thrown if an error occurred while transmitting the request to the job manager
 */
public JobCancelResult cancelJob() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.cancelJob(this.jobGraph.getJobID());
  }
}

Fixed version (ground truth):
/** 
 * Cancels the job assigned to this job client.
 * @return a <code>JobCancelResult</code> object encapsulating the result of the job cancel request
 * @throws IOException thrown if an error occurred while transmitting the request to the job manager
 */
public JobCancelResult cancelJob() throws IOException {
  return this.jobSubmitClient.cancelJob(this.jobGraph.getJobID());
}
Program: 55263
Project: 55263
Buggy source:
/** 
 * Retrieves the current status of the job assigned to this job client.
 * @return a <code>JobProgressResult</code> object including the current job progress
 * @throws IOException thrown if an error occurred while transmitting the request
 */
public JobProgressResult getJobProgress() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.getJobProgress(this.jobGraph.getJobID());
  }
}

Fixed version (ground truth):
/** 
 * Retrieves the current status of the job assigned to this job client.
 * @return a <code>JobProgressResult</code> object including the current job progress
 * @throws IOException thrown if an error occurred while transmitting the request
 */
public JobProgressResult getJobProgress() throws IOException {
  return this.jobSubmitClient.getJobProgress(this.jobGraph.getJobID());
}
Program: 55265
Project: 55265
Buggy source:
/** 
 * Closes the <code>JobClient</code> by destroying the RPC stub object.
 */
public void close(){
synchronized (this.rpcService) {
    this.rpcService.shutDown();
  }
}

Fixed version (ground truth):
/** 
 * Closes the <code>JobClient</code> by destroying the RPC stub object.
 */
public void close(){
  this.rpcService.shutDown();
}
Program: 55266
Project: 55266
Buggy source:
/** 
 * Returns the recommended interval in seconds in which a client is supposed to poll for progress information.
 * @return the interval in seconds
 * @throws IOException thrown if an error occurred while transmitting the request
 */
public int getRecommendedPollingInterval() throws IOException {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.getRecommendedPollingInterval();
  }
}

Fixed version (ground truth):
/** 
 * Returns the recommended interval in seconds in which a client is supposed to poll for progress information.
 * @return the interval in seconds
 * @throws IOException thrown if an error occurred while transmitting the request
 */
public int getRecommendedPollingInterval() throws IOException {
  return this.jobSubmitClient.getRecommendedPollingInterval();
}
Program: 55267
Project: 55267
Buggy source:
/** 
 * Converts the timestamp of an event from its "milliseconds since beginning the epoch" representation into a unified string representation.
 * @param timestamp the timestamp in milliseconds since the beginning of "the epoch"
 * @return the string unified representation of the timestamp
 */
public static String timestampToString(final long timestamp){
  return DATA_FORMATTER.format(new Date(timestamp));
}

Fixed version (ground truth):
/** 
 * Converts the timestamp of an event from its "milliseconds since beginning the epoch" representation into a unified string representation.
 * @param timestamp the timestamp in milliseconds since the beginning of "the epoch"
 * @return the string unified representation of the timestamp
 */
public static String timestampToString(final long timestamp){
  return DATA_FORMATTER.get().format(new Date(timestamp));
}
Program: 55269
Project: 55269
Buggy source:
/** 
 * Auxiliary method implementing Tarjan's algorithm for strongly-connected components to determine whether the job graph is acyclic.
 */
private boolean tarjan(final AbstractJobVertex jv,Integer index,final HashMap<AbstractJobVertex,Integer> indexMap,final HashMap<AbstractJobVertex,Integer> lowLinkMap,final Stack<AbstractJobVertex> stack){
  indexMap.put(jv,Integer.valueOf(index));
  lowLinkMap.put(jv,Integer.valueOf(index));
  index=Integer.valueOf(index.intValue() + 1);
  stack.push(jv);
  for (int i=0; i < jv.getNumberOfForwardConnections(); i++) {
    final AbstractJobVertex jv2=jv.getForwardConnection(i).getConnectedVertex();
    if (!indexMap.containsKey(jv2) || stack.contains(jv2)) {
      if (!indexMap.containsKey(jv2)) {
        if (!tarjan(jv2,index,indexMap,lowLinkMap,stack)) {
          return false;
        }
      }
      if (lowLinkMap.get(jv) > lowLinkMap.get(jv2)) {
        lowLinkMap.put(jv,Integer.valueOf(lowLinkMap.get(jv2)));
      }
    }
  }
  if (lowLinkMap.get(jv).equals(indexMap.get(jv))) {
    int count=0;
    while (stack.size() > 0) {
      final AbstractJobVertex jv2=stack.pop();
      if (jv == jv2) {
        break;
      }
      count++;
    }
    if (count > 0) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Auxiliary method implementing Tarjan's algorithm for strongly-connected components to determine whether the job graph is acyclic.
 */
private boolean tarjan(final AbstractJobVertex jv,Integer index,final HashMap<AbstractJobVertex,Integer> indexMap,final HashMap<AbstractJobVertex,Integer> lowLinkMap,final Stack<AbstractJobVertex> stack){
  indexMap.put(jv,index);
  lowLinkMap.put(jv,index);
  index=Integer.valueOf(index.intValue() + 1);
  stack.push(jv);
  for (int i=0; i < jv.getNumberOfForwardConnections(); i++) {
    final AbstractJobVertex jv2=jv.getForwardConnection(i).getConnectedVertex();
    if (!indexMap.containsKey(jv2) || stack.contains(jv2)) {
      if (!indexMap.containsKey(jv2)) {
        if (!tarjan(jv2,index,indexMap,lowLinkMap,stack)) {
          return false;
        }
      }
      if (lowLinkMap.get(jv) > lowLinkMap.get(jv2)) {
        lowLinkMap.put(jv,lowLinkMap.get(jv2));
      }
    }
  }
  if (lowLinkMap.get(jv).equals(indexMap.get(jv))) {
    int count=0;
    while (stack.size() > 0) {
      final AbstractJobVertex jv2=stack.pop();
      if (jv == jv2) {
        break;
      }
      count++;
    }
    if (count > 0) {
      return false;
    }
  }
  return true;
}
Program: 55271
Project: 55271
Buggy source:
/** 
 * Constructs a <code>LibraryManagerEntry</code> object from the given job ID and array of required library files.
 * @param id the ID of the job to create a <code>LibraryManagerEntry</code> for.
 * @param requiredJarFiles an array with the names of required libraries by the corresponding job (plain names)
 * @param urls an array with the names of required libraries by the corresponding job (URL objects required by the class loader)
 */
public LibraryManagerEntry(final JobID id,final String[] requiredJarFiles,URL[] urls){
  String[] temp=requiredJarFiles;
  if (temp == null) {
    temp=new String[0];
  }
  this.requiredJarFiles=temp;
  if (urls == null) {
    urls=new URL[0];
  }
  this.classLoader=new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
}

Fixed version (ground truth):
/** 
 * Constructs a <code>LibraryManagerEntry</code> object from the given job ID and array of required library files.
 * @param requiredJarFiles an array with the names of required libraries by the corresponding job (plain names)
 * @param urls an array with the names of required libraries by the corresponding job (URL objects required by the class loader)
 */
public LibraryManagerEntry(final String[] requiredJarFiles,URL[] urls){
  String[] temp=requiredJarFiles;
  if (temp == null) {
    temp=new String[0];
  }
  this.requiredJarFiles=temp;
  if (urls == null) {
    urls=new URL[0];
  }
  this.classLoader=new URLClassLoader(urls,ClassLoader.getSystemClassLoader());
}
Program: 55272
Project: 55272
Buggy source:
/** 
 * Registers a job ID with a set of library paths that are required to run the job. For every registered job the library cache manager creates a class loader that is used to instantiate the vertex's environment later on.
 * @param id the ID of the job to be registered.
 * @param clientPaths the client path's of the required libraries
 * @throws IOException thrown if one of the requested libraries is not in the cache
 */
private void registerInternal(final JobID id,final String[] requiredJarFiles) throws IOException {
  while (this.lockMap.putIfAbsent(id,LOCK_OBJECT) != null)   ;
  try {
    if (incrementReferenceCounter(id) > 1) {
      return;
    }
    if (this.libraryManagerEntries.containsKey(id)) {
      throw new IllegalStateException("String_Node_Str" + id);
    }
    URL[] urls=null;
    if (requiredJarFiles != null) {
      urls=new URL[requiredJarFiles.length];
      for (int i=0; i < requiredJarFiles.length; i++) {
        final Path p=contains(requiredJarFiles[i]);
        if (p == null) {
          throw new IOException(requiredJarFiles[i] + "String_Node_Str");
        }
        try {
          urls[i]=p.toUri().toURL();
        }
 catch (        MalformedURLException e) {
          throw new IOException(StringUtils.stringifyException(e));
        }
      }
    }
    final LibraryManagerEntry entry=new LibraryManagerEntry(id,requiredJarFiles,urls);
    this.libraryManagerEntries.put(id,entry);
  }
  finally {
    this.lockMap.remove(id);
  }
}

Fixed version (ground truth):
/** 
 * Registers a job ID with a set of library paths that are required to run the job. For every registered job the library cache manager creates a class loader that is used to instantiate the vertex's environment later on.
 * @param id the ID of the job to be registered.
 * @param clientPaths the client path's of the required libraries
 * @throws IOException thrown if one of the requested libraries is not in the cache
 */
private void registerInternal(final JobID id,final String[] requiredJarFiles) throws IOException {
  while (this.lockMap.putIfAbsent(id,LOCK_OBJECT) != null)   ;
  try {
    if (incrementReferenceCounter(id) > 1) {
      return;
    }
    if (this.libraryManagerEntries.containsKey(id)) {
      throw new IllegalStateException("String_Node_Str" + id);
    }
    URL[] urls=null;
    if (requiredJarFiles != null) {
      urls=new URL[requiredJarFiles.length];
      for (int i=0; i < requiredJarFiles.length; i++) {
        final Path p=contains(requiredJarFiles[i]);
        if (p == null) {
          throw new IOException(requiredJarFiles[i] + "String_Node_Str");
        }
        try {
          urls[i]=p.toUri().toURL();
        }
 catch (        MalformedURLException e) {
          throw new IOException(StringUtils.stringifyException(e));
        }
      }
    }
    final LibraryManagerEntry entry=new LibraryManagerEntry(requiredJarFiles,urls);
    this.libraryManagerEntries.put(id,entry);
  }
  finally {
    this.lockMap.remove(id);
  }
}
Program: 55273
Project: 55273
Buggy source:
/** 
 * Creates a random byte sequence using the provided   {@code random} generator and returns its hex representation.
 * @param random The random number generator to be used.
 * @return A hex representation of the generated byte sequence
 */
private static final String randomString(final Random random){
  final byte[] bytes=new byte[RANDOM_BYTES_LENGTH];
  random.nextBytes(bytes);
  return StringUtils.byteToHexString(bytes);
}

Fixed version (ground truth):
/** 
 * Creates a random byte sequence using the provided   {@code random} generator and returns its hex representation.
 * @param random The random number generator to be used.
 * @return A hex representation of the generated byte sequence
 */
private static String randomString(final Random random){
  final byte[] bytes=new byte[RANDOM_BYTES_LENGTH];
  random.nextBytes(bytes);
  return StringUtils.byteToHexString(bytes);
}
Program: 55274
Project: 55274
Buggy source:
private void ensureAvailable(final int numberOfBytes) throws IOException {
  if (this.buf.capacity() < numberOfBytes) {
    final ByteBuffer newBuf=ByteBuffer.allocate(numberOfBytes);
    newBuf.put(this.buf);
    newBuf.flip();
    this.buf=newBuf;
  }
  final int remaining=this.buf.remaining();
  if (remaining < numberOfBytes) {
    final int offset=this.buf.position();
    if (offset > 0) {
      for (int i=0; i < remaining; ++i) {
        this.buf.put(i,this.buf.get(offset + i));
      }
    }
    this.buf.position(remaining);
    this.buf.limit(this.buf.capacity());
    final int read=this.readableByteChannel.read(this.buf);
    this.buf.flip();
  }
}

Fixed version (ground truth):
private void ensureAvailable(final int numberOfBytes) throws IOException {
  if (this.buf.capacity() < numberOfBytes) {
    final ByteBuffer newBuf=ByteBuffer.allocate(numberOfBytes);
    newBuf.put(this.buf);
    newBuf.flip();
    this.buf=newBuf;
  }
  int remaining=this.buf.remaining();
  while (remaining < numberOfBytes) {
    final int offset=this.buf.position();
    if (offset > 0) {
      for (int i=0; i < remaining; ++i) {
        this.buf.put(i,this.buf.get(offset + i));
      }
    }
    this.buf.position(remaining);
    this.buf.limit(this.buf.capacity());
    final int read=this.readableByteChannel.read(this.buf);
    if (read < 0) {
      throw new BufferUnderflowException();
    }
    this.buf.flip();
    remaining=this.buf.remaining();
  }
}
Program: 55275
Project: 55275
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void clear(){
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void clear(){
  this.dataInput=null;
  this.lastReadableByteChannel=null;
}
Program: 55276
Project: 55276
Buggy source:
/** 
 * Adds the given key/value pair to the configuration object. If either the key or the value is <code>null</code> the pair is not added.
 * @param key the key of the key/value pair to be added
 * @param value the value of the key/value pair to be added
 */
public void setString(final String key,final String value){
  if (key == null || value == null) {
    LOG.warn("String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str");
    return;
  }
synchronized (this.confData) {
    this.confData.put(key,value);
  }
}

Fixed version (ground truth):
/** 
 * Adds the given key/value pair to the configuration object. If either the key or the value is <code>null</code> the pair is not added.
 * @param key the key of the key/value pair to be added
 * @param value the value of the key/value pair to be added
 */
public void setString(final String key,final String value){
  if (key == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (value == null) {
    throw new NullPointerException("String_Node_Str");
  }
synchronized (this.confData) {
    this.confData.put(key,value);
  }
}
Program: 55278
Project: 55278
Buggy source:
@Override public final boolean next(final T target) throws IOException, InterruptedException {
  while (true) {
    if (this.inputGates.isEmpty()) {
      return false;
    }
    if (this.nextInputGateToReadFrom == null) {
synchronized (this.availableInputGates) {
        while (this.availableInputGates.isEmpty()) {
          this.availableInputGates.wait();
        }
        this.nextInputGateToReadFrom=this.availableInputGates.pop();
      }
    }
    if (this.nextInputGateToReadFrom.hasRecordAvailable()) {
      final T record=this.nextInputGateToReadFrom.readRecord(target);
      if (record == null) {
        this.inputGates.remove(this.nextInputGateToReadFrom);
        this.nextInputGateToReadFrom=null;
      }
 else {
        return true;
      }
    }
 else {
      this.nextInputGateToReadFrom=null;
    }
  }
}

Fixed version (ground truth):
@Override public boolean next(final T target) throws IOException, InterruptedException {
  while (true) {
    if (this.inputGates.isEmpty()) {
      return false;
    }
    if (this.nextInputGateToReadFrom == null) {
synchronized (this.availableInputGates) {
        while (this.availableInputGates.isEmpty()) {
          this.availableInputGates.wait();
        }
        this.nextInputGateToReadFrom=this.availableInputGates.pop();
      }
    }
    if (this.nextInputGateToReadFrom.hasRecordAvailable()) {
      final T record=this.nextInputGateToReadFrom.readRecord(target);
      if (record == null) {
        this.inputGates.remove(this.nextInputGateToReadFrom);
        this.nextInputGateToReadFrom=null;
      }
 else {
        return true;
      }
    }
 else {
      this.nextInputGateToReadFrom=null;
    }
  }
}
Program: 55279
Project: 55279
Buggy source:
/** 
 * Writes the JAR files of all vertices in array <code>jobVertices</code> to the specified output stream.
 * @param kryo the kryo object
 * @param out the output stream to write the JAR files to
 * @param jobVertices array of job vertices whose required JAR file are to be written to the output stream
 * @throws IOException thrown if an error occurs while writing to the stream
 */
private void writeRequiredJarFiles(final Kryo kryo,final Output out,final AbstractJobVertex[] jobVertices) throws IOException {
  final FileSystem fs=FileSystem.getLocalFileSystem();
  for (int i=0; i < this.userJars.size(); i++) {
    if (!fs.exists(this.userJars.get(i))) {
      throw new IOException("String_Node_Str" + this.userJars.get(i));
    }
  }
  out.writeInt(this.userJars.size());
  for (int i=0; i < this.userJars.size(); i++) {
    final Path jar=this.userJars.get(i);
    jar.write(kryo,out);
    final FileStatus file=fs.getFileStatus(jar);
    out.writeInt((int)file.getLen());
    final FSDataInputStream inStream=fs.open(this.userJars.get(i));
    final byte[] buf=new byte[BUFFERSIZE];
    int read=inStream.read(buf,0,buf.length);
    while (read > 0) {
      out.write(buf,0,read);
      read=inStream.read(buf,0,buf.length);
    }
  }
}

Fixed version (ground truth):
/** 
 * Writes the JAR files of all vertices in array <code>jobVertices</code> to the specified output stream.
 * @param kryo the kryo object
 * @param out the output stream to write the JAR files to
 * @throws IOException thrown if an error occurs while writing to the stream
 */
private void writeRequiredJarFiles(final Kryo kryo,final Output out) throws IOException {
  final FileSystem fs=FileSystem.getLocalFileSystem();
  for (int i=0; i < this.userJars.size(); i++) {
    if (!fs.exists(this.userJars.get(i))) {
      throw new IOException("String_Node_Str" + this.userJars.get(i));
    }
  }
  out.writeInt(this.userJars.size());
  for (int i=0; i < this.userJars.size(); i++) {
    final Path jar=this.userJars.get(i);
    jar.write(kryo,out);
    final FileStatus file=fs.getFileStatus(jar);
    out.writeInt((int)file.getLen());
    final FSDataInputStream inStream=fs.open(this.userJars.get(i));
    final byte[] buf=new byte[BUFFERSIZE];
    int read=inStream.read(buf,0,buf.length);
    while (read > 0) {
      out.write(buf,0,read);
      read=inStream.read(buf,0,buf.length);
    }
  }
}
Program: 55280
Project: 55280
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void write(final Kryo kryo,final Output output){
  kryo.writeObject(output,this.jobID);
  output.writeString(this.jobName);
  final AbstractJobVertex[] allVertices=this.getAllJobVertices();
  try {
    writeRequiredJarFiles(kryo,output,allVertices);
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
  output.writeInt(allVertices.length);
  for (int i=0; i < allVertices.length; i++) {
    final String className=allVertices[i].getClass().getName();
    output.writeString(className);
    kryo.writeObject(output,allVertices[i].getID());
    output.writeString(allVertices[i].getName());
  }
  for (int i=0; i < allVertices.length; i++) {
    kryo.writeObject(output,allVertices[i].getID());
    allVertices[i].write(kryo,output);
  }
  this.jobConfiguration.write(kryo,output);
  this.taskManagerConfiguration.write(kryo,output);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void write(final Kryo kryo,final Output output){
  kryo.writeObject(output,this.jobID);
  output.writeString(this.jobName);
  final AbstractJobVertex[] allVertices=this.getAllJobVertices();
  try {
    writeRequiredJarFiles(kryo,output);
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
  output.writeInt(allVertices.length);
  for (int i=0; i < allVertices.length; i++) {
    final String className=allVertices[i].getClass().getName();
    output.writeString(className);
    kryo.writeObject(output,allVertices[i].getID());
    output.writeString(allVertices[i].getName());
  }
  for (int i=0; i < allVertices.length; i++) {
    kryo.writeObject(output,allVertices[i].getID());
    allVertices[i].write(kryo,output);
  }
  this.jobConfiguration.write(kryo,output);
  this.taskManagerConfiguration.write(kryo,output);
}
Program: 55281
Project: 55281
Buggy source:
/** 
 * Checks if the job graph is acyclic.
 * @return <code>true</code> if the job graph is acyclic, <code>false</code> otherwise
 */
public boolean isAcyclic(){
  final AbstractJobVertex[] reachable=getAllReachableJobVertices();
  final HashMap<AbstractJobVertex,Integer> indexMap=new HashMap<AbstractJobVertex,Integer>();
  final HashMap<AbstractJobVertex,Integer> lowLinkMap=new HashMap<AbstractJobVertex,Integer>();
  final Stack<AbstractJobVertex> stack=new Stack<AbstractJobVertex>();
  final Integer index=Integer.valueOf(0);
  for (int i=0; i < reachable.length; i++) {
    if (!indexMap.containsKey(reachable[i])) {
      if (!tarjan(reachable[i],index,indexMap,lowLinkMap,stack)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the job graph is acyclic.
 * @return <code>true</code> if the job graph is acyclic, <code>false</code> otherwise
 */
public boolean isAcyclic(){
  final AbstractJobVertex[] reachable=getAllReachableJobVertices();
  final HashMap<AbstractJobVertex,Integer> indexMap=new HashMap<AbstractJobVertex,Integer>();
  final HashMap<AbstractJobVertex,Integer> lowLinkMap=new HashMap<AbstractJobVertex,Integer>();
  final Stack<AbstractJobVertex> stack=new Stack<AbstractJobVertex>();
  final Integer index=Integer.valueOf(0);
  for (int i=0; i < reachable.length; i++) {
    if (!indexMap.containsKey(reachable[i]) && !tarjan(reachable[i],index,indexMap,lowLinkMap,stack)) {
      return false;
    }
  }
  return true;
}
Program: 55282
Project: 55282
Buggy source:
/** 
 * Auxiliary method implementing Tarjan's algorithm for strongly-connected components to determine whether the job graph is acyclic.
 */
private boolean tarjan(final AbstractJobVertex jv,Integer index,final HashMap<AbstractJobVertex,Integer> indexMap,final HashMap<AbstractJobVertex,Integer> lowLinkMap,final Stack<AbstractJobVertex> stack){
  indexMap.put(jv,index);
  lowLinkMap.put(jv,index);
  index=Integer.valueOf(index.intValue() + 1);
  stack.push(jv);
  for (int i=0; i < jv.getNumberOfForwardConnections(); i++) {
    final AbstractJobVertex jv2=jv.getForwardConnection(i).getConnectedVertex();
    if (!indexMap.containsKey(jv2) || stack.contains(jv2)) {
      if (!indexMap.containsKey(jv2)) {
        if (!tarjan(jv2,index,indexMap,lowLinkMap,stack)) {
          return false;
        }
      }
      if (lowLinkMap.get(jv) > lowLinkMap.get(jv2)) {
        lowLinkMap.put(jv,lowLinkMap.get(jv2));
      }
    }
  }
  if (lowLinkMap.get(jv).equals(indexMap.get(jv))) {
    int count=0;
    while (stack.size() > 0) {
      final AbstractJobVertex jv2=stack.pop();
      if (jv == jv2) {
        break;
      }
      count++;
    }
    if (count > 0) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Auxiliary method implementing Tarjan's algorithm for strongly-connected components to determine whether the job graph is acyclic.
 */
private boolean tarjan(final AbstractJobVertex jv,Integer index,final HashMap<AbstractJobVertex,Integer> indexMap,final HashMap<AbstractJobVertex,Integer> lowLinkMap,final Stack<AbstractJobVertex> stack){
  indexMap.put(jv,index);
  lowLinkMap.put(jv,index);
  index=Integer.valueOf(index.intValue() + 1);
  stack.push(jv);
  for (int i=0; i < jv.getNumberOfForwardConnections(); i++) {
    final AbstractJobVertex jv2=jv.getForwardConnection(i).getConnectedVertex();
    if (!indexMap.containsKey(jv2) || stack.contains(jv2)) {
      if (!indexMap.containsKey(jv2) && !tarjan(jv2,index,indexMap,lowLinkMap,stack)) {
        return false;
      }
      if (lowLinkMap.get(jv) > lowLinkMap.get(jv2)) {
        lowLinkMap.put(jv,lowLinkMap.get(jv2));
      }
    }
  }
  if (lowLinkMap.get(jv).equals(indexMap.get(jv))) {
    int count=0;
    while (stack.size() > 0) {
      final AbstractJobVertex jv2=stack.pop();
      if (jv == jv2) {
        break;
      }
      count++;
    }
    if (count > 0) {
      return false;
    }
  }
  return true;
}
Program: 55283
Project: 55283
Buggy source:
/** 
 * Creates a jar file which contains the previously added class. The content of the jar file is written to <code>outputFile</code> which has been provided to the constructor. If <code>outputFile</code> already exists, it is overwritten by this operation.
 * @throws IOException thrown if an error occurs while writing to the output file
 */
public synchronized void createJarFile() throws IOException {
  final byte[] buf=new byte[128];
  if (this.outputFile == null) {
    throw new IOException("String_Node_Str");
  }
  if (this.outputFile.exists()) {
    this.outputFile.delete();
  }
  final JarOutputStream jos=new JarOutputStream(new FileOutputStream(this.outputFile),new Manifest());
  final Iterator<Class<?>> it=this.classSet.iterator();
  while (it.hasNext()) {
    final Class<?> clazz=it.next();
    final String entry=clazz.getName().replace('.','/') + CLASS_EXTENSION;
    jos.putNextEntry(new JarEntry(entry));
    final InputStream classInputStream=clazz.getResourceAsStream(clazz.getSimpleName() + CLASS_EXTENSION);
    int num=classInputStream.read(buf);
    while (num != -1) {
      jos.write(buf,0,num);
      num=classInputStream.read(buf);
    }
    classInputStream.close();
    jos.closeEntry();
  }
  jos.close();
}

Fixed version (ground truth):
/** 
 * Creates a jar file which contains the previously added class. The content of the jar file is written to <code>outputFile</code> which has been provided to the constructor. If <code>outputFile</code> already exists, it is overwritten by this operation.
 * @throws IOException thrown if an error occurs while writing to the output file
 */
public synchronized void createJarFile() throws IOException {
  final byte[] buf=new byte[128];
  if (this.outputFile == null) {
    throw new IOException("String_Node_Str");
  }
  if (this.outputFile.exists()) {
    this.outputFile.delete();
  }
  final JarOutputStream jos=new JarOutputStream(new FileOutputStream(this.outputFile),new Manifest());
  final Iterator<Class<?>> it=this.classSet.iterator();
  while (it.hasNext()) {
    final Class<?> clazz=it.next();
    final String entry=clazz.getName().replace('.','/') + CLASS_EXTENSION;
    jos.putNextEntry(new JarEntry(entry));
    InputStream classInputStream=null;
    try {
      classInputStream=clazz.getResourceAsStream(clazz.getSimpleName() + CLASS_EXTENSION);
      int num=classInputStream.read(buf);
      while (num != -1) {
        jos.write(buf,0,num);
        num=classInputStream.read(buf);
      }
      classInputStream.close();
      jos.closeEntry();
    }
  finally {
      CloseableUtils.closeSilently(classInputStream);
    }
  }
  jos.close();
}
Program: 55284
Project: 55284
Buggy source:
@SuppressWarnings("String_Node_Str") private boolean readNotificationList(ReadableByteChannel readableByteChannel) throws IOException {
  if (!this.eventListExistanceDeserialized) {
    this.tempBuffer.position(0);
    this.tempBuffer.limit(1);
    readableByteChannel.read(this.tempBuffer);
    if (this.tempBuffer.hasRemaining()) {
      return true;
    }
    this.eventListExistanceDeserialized=true;
    final boolean eventListFollows=(this.tempBuffer.get(0) == (byte)1);
    this.tempBuffer.clear();
    if (!eventListFollows) {
      this.transferEnvelope=new TransferEnvelope(this.deserializedSequenceNumber,this.deserializedJobID,this.deserializedSourceID,this.deserializedEventList);
      this.deserializationState=DeserializationState.NOTIFICATIONSDESERIALIZED;
      return false;
    }
  }
  this.deserializedEventList=this.objectDeserializer.deserialize(readableByteChannel,List.class);
  if (this.deserializedEventList == null) {
    return true;
  }
 else {
    this.transferEnvelope=new TransferEnvelope(this.deserializedSequenceNumber,this.deserializedJobID,this.deserializedSourceID,this.deserializedEventList);
    this.deserializationState=DeserializationState.NOTIFICATIONSDESERIALIZED;
    return false;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private boolean readNotificationList(ReadableByteChannel readableByteChannel) throws IOException {
  if (!this.eventListExistanceDeserialized) {
    this.tempBuffer.position(0);
    this.tempBuffer.limit(1);
    readableByteChannel.read(this.tempBuffer);
    if (this.tempBuffer.hasRemaining()) {
      return true;
    }
    this.eventListExistanceDeserialized=true;
    final boolean eventListFollows=(this.tempBuffer.get(0) == (byte)1);
    this.tempBuffer.clear();
    if (!eventListFollows) {
      this.transferEnvelope=new TransferEnvelope(this.deserializedSequenceNumber,this.deserializedJobID,this.deserializedSourceID,this.deserializedEventList);
      this.deserializationState=DeserializationState.NOTIFICATIONSDESERIALIZED;
      return false;
    }
  }
  this.deserializedEventList=this.objectDeserializer.deserialize(readableByteChannel,ArrayList.class);
  if (this.deserializedEventList == null) {
    return true;
  }
 else {
    this.transferEnvelope=new TransferEnvelope(this.deserializedSequenceNumber,this.deserializedJobID,this.deserializedSourceID,this.deserializedEventList);
    this.deserializationState=DeserializationState.NOTIFICATIONSDESERIALIZED;
    return false;
  }
}
Program: 55285
Project: 55285
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public <T extends Record>OutputGate<T> createAndRegisterOutputGate(final ChannelSelector<T> selector,final boolean isBroadcast){
  if (this.unboundOutputGates == null) {
    return new RuntimeOutputGate<T>(getJobID(),null,getNumberOfOutputGates(),ChannelType.NETWORK,CompressionLevel.NO_COMPRESSION,selector,isBroadcast,null);
  }
  final GateDeploymentDescriptor gdd=this.unboundOutputGates.poll();
  if (gdd == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  RecordSerializerFactory<T> serializerFactory;
  if (gdd.spanningRecordsAllowed()) {
    serializerFactory=new SpanningRecordSerializerFactory<T>();
  }
 else {
    serializerFactory=new DefaultRecordSerializerFactory<T>();
  }
  return new RuntimeOutputGate<T>(getJobID(),gdd.getGateID(),getNumberOfInputGates(),gdd.getChannelType(),gdd.getCompressionLevel(),selector,isBroadcast,serializerFactory);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public <T extends Record>OutputGate<T> createAndRegisterOutputGate(final ChannelSelector<T> selector,final boolean isBroadcast){
  if (this.unboundOutputGates == null) {
    final RuntimeOutputGate<T> rog=new RuntimeOutputGate<T>(getJobID(),null,getNumberOfOutputGates(),ChannelType.NETWORK,CompressionLevel.NO_COMPRESSION,selector,isBroadcast,null);
    this.outputGates.add(rog);
    return rog;
  }
  final GateDeploymentDescriptor gdd=this.unboundOutputGates.poll();
  if (gdd == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  RecordSerializerFactory<T> serializerFactory;
  if (gdd.spanningRecordsAllowed()) {
    serializerFactory=new SpanningRecordSerializerFactory<T>();
  }
 else {
    serializerFactory=new DefaultRecordSerializerFactory<T>();
  }
  final RuntimeOutputGate<T> rog=new RuntimeOutputGate<T>(getJobID(),gdd.getGateID(),getNumberOfInputGates(),gdd.getChannelType(),gdd.getCompressionLevel(),selector,isBroadcast,serializerFactory);
  this.outputGates.add(rog);
  return rog;
}
Program: 55287
Project: 55287
Buggy source:
/** 
 * Serializes the record and writes it to an internal buffer. The buffer grows dynamically in case more memory is required to serialization.
 * @param object the object to be serialized
 * @throws IOException Thrown if data from a previous serialization process is still in the internal buffer and has not yet been transfered to a byte buffer
 */
void serialize(final Object object) throws IOException {
  if (dataLeftFromPreviousSerialization()) {
    throw new IOException("String_Node_Str" + leftInSerializationBuffer() + "String_Node_Str");
  }
  this.kryo.writeObject(this.output,object);
  this.lengthBuf.putInt(this.output.total());
}

Fixed version (ground truth):
/** 
 * Serializes the record and writes it to an internal buffer. The buffer grows dynamically in case more memory is required to serialization.
 * @param object the object to be serialized
 * @throws IOException Thrown if data from a previous serialization process is still in the internal buffer and has not yet been transfered to a byte buffer
 */
void serialize(final Object object) throws IOException {
  if (dataLeftFromPreviousSerialization()) {
    throw new IOException("String_Node_Str" + leftInSerializationBuffer() + "String_Node_Str");
  }
  this.kryo.writeObject(this.output,object);
  this.lengthBuf.putInt(this.output.total());
  this.lengthBuf.flip();
}
Program: 55288
Project: 55288
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void write(final Kryo kryo,final Output output){
  output.writeString(this.instanceType);
  output.writeInt(this.numberOfSubtasks);
  output.writeInt(this.numberOfSubtasksPerInstance);
  output.writeInt(this.numberOfExecutionRetries);
  if (this.vertexToShareInstancesWith != null) {
    output.writeBoolean(true);
    kryo.writeObject(output,this.vertexToShareInstancesWith.getID());
  }
 else {
    output.writeBoolean(false);
  }
  this.configuration.write(kryo,output);
  output.writeInt(this.forwardEdges.size());
  for (int i=0; i < this.forwardEdges.size(); i++) {
    final JobEdge edge=this.forwardEdges.get(i);
    if (edge == null) {
      output.writeBoolean(false);
    }
 else {
      output.writeBoolean(true);
      kryo.writeObject(output,edge.getConnectedVertex().getID());
      EnumUtils.writeEnum(output,edge.getChannelType());
      EnumUtils.writeEnum(output,edge.getCompressionLevel());
      EnumUtils.writeEnum(output,edge.getDistributionPattern());
      output.writeInt(edge.getIndexOfInputGate());
    }
  }
  output.writeString(this.invokableClassName);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void write(final Kryo kryo,final Output output){
  output.writeString(this.instanceType);
  output.writeInt(this.numberOfSubtasks);
  output.writeInt(this.numberOfSubtasksPerInstance);
  output.writeInt(this.numberOfExecutionRetries);
  if (this.vertexToShareInstancesWith != null) {
    output.writeBoolean(true);
    kryo.writeObject(output,this.vertexToShareInstancesWith.getID());
  }
 else {
    output.writeBoolean(false);
  }
  this.configuration.write(kryo,output);
  output.writeInt(this.forwardEdges.size());
  for (int i=0; i < this.forwardEdges.size(); i++) {
    final JobEdge edge=this.forwardEdges.get(i);
    if (edge == null) {
      output.writeBoolean(false);
    }
 else {
      output.writeBoolean(true);
      kryo.writeObject(output,edge.getConnectedVertex().getID());
      EnumUtils.writeEnum(output,edge.getChannelType());
      EnumUtils.writeEnum(output,edge.getCompressionLevel());
      EnumUtils.writeEnum(output,edge.getDistributionPattern());
      output.writeInt(edge.getIndexOfInputGate());
      output.writeBoolean(edge.spanningRecordsAllowed());
    }
  }
  output.writeString(this.invokableClassName);
}
Program: 55289
Project: 55289
Buggy source:
@Test public void testLargeSortAcrossMultipleWindows() throws Exception {
  try {
    final int NUM_RECORDS=1000000;
    final TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.CONSTANT,VAL);
    final MutableObjectIterator<PactRecord> source=new TestData.GeneratorIterator(generator,NUM_RECORDS);
    LOG.debug("String_Node_Str");
    Sorter<PactRecord> sorter=new AsynchronousPartialSorter<PactRecord>(this.memoryManager,source,this.parentTask,this.serializer,this.comparator,32 * 1024 * 1024);
    runPartialSorter(sorter,NUM_RECORDS,28);
  }
 catch (  Exception t) {
    t.printStackTrace();
    Assert.fail("String_Node_Str" + t.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testLargeSortAcrossMultipleWindows() throws Exception {
  try {
    final int NUM_RECORDS=1000000;
    final TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.CONSTANT,VAL);
    final MutableObjectIterator<PactRecord> source=new TestData.GeneratorIterator(generator,NUM_RECORDS);
    LOG.debug("String_Node_Str");
    Sorter<PactRecord> sorter=new AsynchronousPartialSorter<PactRecord>(this.memoryManager,source,this.parentTask,this.serializer,this.comparator,10 * 1024 * 1024);
    runPartialSorter(sorter,NUM_RECORDS,25);
  }
 catch (  Exception t) {
    t.printStackTrace();
    Assert.fail("String_Node_Str" + t.getMessage());
  }
}
Program: 55290
Project: 55290
Buggy source:
@Test public void testLargeSortAcrossTwoWindows() throws Exception {
  try {
    final int NUM_RECORDS=100000;
    final TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.CONSTANT,VAL);
    final MutableObjectIterator<PactRecord> source=new TestData.GeneratorIterator(generator,NUM_RECORDS);
    LOG.debug("String_Node_Str");
    Sorter<PactRecord> sorter=new AsynchronousPartialSorter<PactRecord>(this.memoryManager,source,this.parentTask,this.serializer,this.comparator,32 * 1024 * 1024);
    runPartialSorter(sorter,NUM_RECORDS,2);
  }
 catch (  Exception t) {
    t.printStackTrace();
    Assert.fail("String_Node_Str" + t.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testLargeSortAcrossTwoWindows() throws Exception {
  try {
    final int NUM_RECORDS=100000;
    final TestData.Generator generator=new TestData.Generator(SEED,KEY_MAX,VALUE_LENGTH,KeyMode.RANDOM,ValueMode.CONSTANT,VAL);
    final MutableObjectIterator<PactRecord> source=new TestData.GeneratorIterator(generator,NUM_RECORDS);
    LOG.debug("String_Node_Str");
    Sorter<PactRecord> sorter=new AsynchronousPartialSorter<PactRecord>(this.memoryManager,source,this.parentTask,this.serializer,this.comparator,10 * 1024 * 1024);
    runPartialSorter(sorter,NUM_RECORDS,2);
  }
 catch (  Exception t) {
    t.printStackTrace();
    Assert.fail("String_Node_Str" + t.getMessage());
  }
}
Program: 55291
Project: 55291
Buggy source:
MultiPacketOutputStream(final int initialBufferSize){
  this.bufferSize=initialBufferSize - RPCMessage.METADATA_SIZE;
  this.buf=new byte[initialBufferSize];
}

Fixed version (ground truth):
MultiPacketOutputStream(final int initialBufferSize){
  this.buf=new byte[initialBufferSize];
}