nus-yam/ex-repair huggingface dataset:
Program: 55968
Project: 55968
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 {
  Runtime.getRuntime().removeShutdownHook(this.jobCleanUp);
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 {
synchronized (this.jobSubmitClient) {
    return this.jobSubmitClient.cancelJob(this.jobGraph.getJobID());
  }
}
Program: 55969
Project: 55969
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  try {
    if (this.jobClient.getConfiguration().getBoolean(ConfigConstants.JOBCLIENT_SHUTDOWN_TERMINATEJOB_KEY,ConfigConstants.DEFAULT_JOBCLIENT_SHUTDOWN_TERMINATEJOB)) {
      this.jobClient.cancelJob();
    }
    this.jobClient.close();
  }
 catch (  IOException ioe) {
    LOG.warn(StringUtils.stringifyException(ioe));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  try {
    if (this.jobClient.getConfiguration().getBoolean(ConfigConstants.JOBCLIENT_SHUTDOWN_TERMINATEJOB_KEY,ConfigConstants.DEFAULT_JOBCLIENT_SHUTDOWN_TERMINATEJOB)) {
      System.out.println(AbstractEvent.timestampToString(System.currentTimeMillis()) + "String_Node_Str");
      this.jobClient.cancelJob();
    }
    this.jobClient.close();
  }
 catch (  IOException ioe) {
    LOG.warn(StringUtils.stringifyException(ioe));
  }
}
Program: 55971
Project: 55971
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
 */
protected static String timestampToString(long timestamp){
  return dateFormatter.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(long timestamp){
  return dateFormatter.format(new Date(timestamp));
}
Program: 55974
Project: 55974
Buggy source:
/** 
 * {@inheritDoc}
 */
public void write(DataOutput out) throws IOException {
  super.write(out);
  out.writeInt(this.getNumberOfOutputChannels());
  for (int i=0; i < getNumberOfOutputChannels(); i++) {
    getOutputChannel(i).getID().write(out);
    EnumUtils.writeEnum(out,getOutputChannel(i).getCompressionLevel());
    StringRecord.writeString(out,getOutputChannel(i).getClass().getName());
    getOutputChannel(i).write(out);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void write(DataOutput out) throws IOException {
  super.write(out);
  out.writeInt(this.getNumberOfOutputChannels());
  for (int i=0; i < getNumberOfOutputChannels(); i++) {
    EnumUtils.writeEnum(out,getOutputChannel(i).getType());
    if (getOutputChannel(i).getType() == ChannelType.NETWORK) {
      out.writeBoolean(getOutputChannel(i).followsPushModel());
    }
    getOutputChannel(i).getID().write(out);
    EnumUtils.writeEnum(out,getOutputChannel(i).getCompressionLevel());
    StringRecord.writeString(out,getOutputChannel(i).getClass().getName());
    getOutputChannel(i).write(out);
  }
}
Program: 55976
Project: 55976
Buggy source:
/** 
 * Creates a new output channel object.
 * @param outputGate the output gate this channel is connected to.
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel){
  super(channelIndex,channelID,compressionLevel);
  this.outputGate=outputGate;
}

Fixed version (ground truth):
/** 
 * Creates a new output channel object.
 * @param outputGate the output gate this channel is connected to.
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(channelIndex,channelID,compressionLevel);
  this.outputGate=outputGate;
  this.followsPushModel=followsPushModel;
}
Program: 55977
Project: 55977
Buggy source:
/** 
 * Creates a new byte buffered output channel.
 * @param outputGate the output gate this channel is wired to
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractByteBufferedOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(outputGate,channelIndex,channelID,compressionLevel);
  this.compressor=CompressionLoader.getCompressorByCompressionLevel(compressionLevel,this);
  this.followsPushModel=followsPushModel;
}

Fixed version (ground truth):
/** 
 * Creates a new byte buffered output channel.
 * @param outputGate the output gate this channel is wired to
 * @param channelIndex the channel's index at the associated output gate
 * @param channelID the channel ID to assign to the new channel, <code>null</code> to generate a new ID
 * @param compressionLevel the level of compression to be used for this channel
 */
public AbstractByteBufferedOutputChannel(OutputGate<T> outputGate,int channelIndex,ChannelID channelID,CompressionLevel compressionLevel,boolean followsPushModel){
  super(outputGate,channelIndex,channelID,compressionLevel,followsPushModel);
  this.compressor=CompressionLoader.getCompressorByCompressionLevel(compressionLevel,this);
}
Program: 55979
Project: 55979
Buggy source:
/** 
 * Constructs a new broadcast record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 */
public BroadcastRecordWriter(AbstractInputTask inputBase,Class<T> outputClass){
  super(inputBase,outputClass,null,true);
}

Fixed version (ground truth):
/** 
 * Constructs a new broadcast record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 */
public BroadcastRecordWriter(AbstractInputTask<?> inputBase,Class<T> outputClass){
  super(inputBase,outputClass,null,true);
}
Program: 55980
Project: 55980
Buggy source:
/** 
 * {@inheritDoc}
 */
@SuppressWarnings("String_Node_Str") public void read(DataInput in) throws IOException {
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@SuppressWarnings("String_Node_Str") public void read(DataInput in) throws IOException {
  super.read(in);
  final int numOutputChannels=in.readInt();
  final Class<?>[] parameters={this.getClass(),int.class,ChannelID.class,CompressionLevel.class};
  for (int i=0; i < numOutputChannels; i++) {
    final ChannelID channelID=new ChannelID();
    channelID.read(in);
    final CompressionLevel compressionLevel=EnumUtils.readEnum(in,CompressionLevel.class);
    final String className=StringRecord.readString(in);
    Class<? extends IOReadableWritable> c=null;
    try {
      c=ClassUtils.getRecordByName(className);
    }
 catch (    ClassNotFoundException e) {
      LOG.error(e);
    }
    if (c == null) {
      throw new IOException("String_Node_Str");
    }
    AbstractOutputChannel<T> eoc=null;
    try {
      final Constructor<AbstractOutputChannel<T>> constructor=(Constructor<AbstractOutputChannel<T>>)c.getDeclaredConstructor(parameters);
      if (constructor == null) {
        throw new IOException("String_Node_Str");
      }
      constructor.setAccessible(true);
      eoc=constructor.newInstance(this,i,channelID,compressionLevel);
    }
 catch (    InstantiationException e) {
      LOG.error(e);
    }
catch (    IllegalArgumentException e) {
      LOG.error(e);
    }
catch (    IllegalAccessException e) {
      LOG.error(e);
    }
catch (    InvocationTargetException e) {
      LOG.error(e);
    }
catch (    SecurityException e) {
      LOG.error(e);
    }
catch (    NoSuchMethodException e) {
      LOG.error(e);
    }
    if (eoc == null) {
      throw new IOException("String_Node_Str");
    }
    eoc.read(in);
    addOutputChannel(eoc);
  }
}
Program: 55981
Project: 55981
Buggy source:
/** 
 * Constructs a new record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 * @param selector the channel selector to be used to determine the output channel to be used for a record
 */
public RecordWriter(AbstractInputTask inputBase,Class<T> outputClass,ChannelSelector<T> selector){
  super(inputBase,outputClass,selector,false);
}

Fixed version (ground truth):
/** 
 * Constructs a new record writer and registers a new output gate with the application's environment.
 * @param inputBase the application that instantiated the record writer
 * @param outputClass the class of records that can be emitted with this record writer
 * @param selector the channel selector to be used to determine the output channel to be used for a record
 */
public RecordWriter(AbstractInputTask<?> inputBase,Class<T> outputClass,ChannelSelector<T> selector){
  super(inputBase,outputClass,selector,false);
}
Program: 55982
Project: 55982
Buggy source:
@Override public boolean nextBlock(){
  if (this.closed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (this.noMoreBlocks) {
    return false;
  }
  collectAllBuffers(this.emptySegments);
  this.bufferCurrentlyFilled=new Buffer.Output(this.emptySegments.remove(this.emptySegments.size() - 1));
  if (this.leftOverElement != null) {
    if (!this.bufferCurrentlyFilled.write(this.leftOverElement)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    this.nextElement=this.leftOverElement;
    this.leftOverElement=null;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean nextBlock(){
  if (this.closed) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (this.noMoreBlocks) {
    return false;
  }
  collectAllBuffers(this.emptySegments);
  this.bufferCurrentlyFilled=new Buffer.Output(this.emptySegments.remove(this.emptySegments.size() - 1));
  T next=this.leftOverElement;
  this.leftOverElement=null;
  if (next == null) {
    if (this.input.hasNext()) {
      next=this.input.next();
    }
 else {
      this.noMoreBlocks=true;
      return false;
    }
  }
  if (!this.bufferCurrentlyFilled.write(next)) {
    throw new RuntimeException("String_Node_Str" + "String_Node_Str");
  }
  this.nextElement=next;
  return true;
}
Program: 55984
Project: 55984
Buggy source:
/** 
 * Move the iterator to the next memory block
 * @return true if a new memory block was loaded, false if there were no further records
 */
public boolean nextBlock();

Fixed version (ground truth):
/** 
 * Move the iterator to the next memory block. The next memory block starts at the first element that was not in the block before. A special case is when no record was in the block before, which happens when this function is invoked two times directly in a sequence, without calling hasNext() or next in between. Then the block moves one element.
 * @return true if a new memory block was loaded, false if there were no further records
 */
public boolean nextBlock();
Program: 55985
Project: 55985
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public synchronized void requestInstance(JobID jobID,Configuration conf,InstanceType instanceType) throws InstanceException {
  for (  ClusterInstance host : registeredHosts.values()) {
    final AllocatedSlice slice=host.createSlice(instanceType,jobID);
    if (slice != null) {
      List<AllocatedSlice> allocatedSlices=this.slicesOfJobs.get(jobID);
      if (allocatedSlices == null) {
        allocatedSlices=new ArrayList<AllocatedSlice>();
        this.slicesOfJobs.put(jobID,allocatedSlices);
      }
      allocatedSlices.add(slice);
      if (this.instanceListener != null) {
        ClusterInstanceNotifier clusterInstanceNotifier=new ClusterInstanceNotifier(this.instanceListener,slice);
        clusterInstanceNotifier.start();
      }
      return;
    }
  }
  throw new InstanceException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public synchronized void requestInstance(JobID jobID,Configuration conf,InstanceType instanceType) throws InstanceException {
  AllocatedSlice slice=null;
  for (  final ClusterInstance host : this.registeredHosts.values()) {
    if (host.getType().equals(instanceType)) {
      slice=host.createSlice(instanceType,jobID);
      if (slice != null) {
        break;
      }
    }
  }
  if (slice == null) {
    for (    final ClusterInstance host : this.registeredHosts.values()) {
      slice=host.createSlice(instanceType,jobID);
      if (slice != null) {
        break;
      }
    }
  }
  if (slice == null) {
    throw new InstanceException("String_Node_Str");
  }
  List<AllocatedSlice> allocatedSlices=this.slicesOfJobs.get(jobID);
  if (allocatedSlices == null) {
    allocatedSlices=new ArrayList<AllocatedSlice>();
    this.slicesOfJobs.put(jobID,allocatedSlices);
  }
  allocatedSlices.add(slice);
  if (this.instanceListener != null) {
    ClusterInstanceNotifier clusterInstanceNotifier=new ClusterInstanceNotifier(this.instanceListener,slice);
    clusterInstanceNotifier.start();
  }
}
Program: 55986
Project: 55986
Buggy source:
/** 
 * @param sinkNode
 * @return
 * @throws CompilerException
 */
private JobOutputVertex generateDataSinkVertex(OptimizerNode sinkNode) throws CompilerException {
  DataSinkNode sNode=(DataSinkNode)sinkNode;
  GenericDataSink<?,?> sinkContract=sNode.getPactContract();
  JobGenericOutputVertex sinkVertex=new JobGenericOutputVertex(sinkNode.getPactContract().getName(),this.jobGraph);
  sinkVertex.setOutputClass(DataSinkTask.class);
  TaskConfig sinkConfig=new TaskConfig(sinkVertex.getConfiguration());
  sinkConfig.setStubClass(sinkContract.getUserCodeClass());
  sinkConfig.setStubParameters(sinkContract.getParameters());
switch (sinkNode.getLocalStrategy()) {
case NONE:
    sinkConfig.setLocalStrategy(LocalStrategy.NONE);
  break;
default :
throw new CompilerException("String_Node_Str" + sinkNode.getName() + "String_Node_Str"+ sinkNode.getLocalStrategy());
}
return sinkVertex;
}

Fixed version (ground truth):
/** 
 * @param sinkNode
 * @return
 * @throws CompilerException
 */
private JobOutputVertex generateDataSinkVertex(OptimizerNode sinkNode) throws CompilerException {
  DataSinkNode sNode=(DataSinkNode)sinkNode;
  GenericDataSink<?,?> sinkContract=sNode.getPactContract();
  JobGenericOutputVertex sinkVertex=new JobGenericOutputVertex(sinkNode.getPactContract().getName(),this.jobGraph);
  sinkVertex.setOutputClass(DataSinkTask.class);
  sinkVertex.getConfiguration().setInteger(DataSinkTask.DEGREE_OF_PARALLELISM_KEY,sinkNode.getDegreeOfParallelism());
  TaskConfig sinkConfig=new TaskConfig(sinkVertex.getConfiguration());
  sinkConfig.setStubClass(sinkContract.getUserCodeClass());
  sinkConfig.setStubParameters(sinkContract.getParameters());
switch (sinkNode.getLocalStrategy()) {
case NONE:
    sinkConfig.setLocalStrategy(LocalStrategy.NONE);
  break;
default :
throw new CompilerException("String_Node_Str" + sinkNode.getName() + "String_Node_Str"+ sinkNode.getLocalStrategy());
}
return sinkVertex;
}
Program: 55987
Project: 55987
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public int getMaximumNumberOfSubtasks(){
  if (!(this.format instanceof FileOutputFormat)) {
    return -1;
  }
  final String pathName=this.config.getStubParameter(FileOutputFormat.FILE_PARAMETER_KEY,null);
  final Path path;
  if (pathName == null) {
    return 0;
  }
  try {
    path=new Path(pathName);
  }
 catch (  Throwable t) {
    return 0;
  }
  try {
    final FileSystem fs=path.getFileSystem();
    try {
      final FileStatus f=fs.getFileStatus(path);
      if (f == null) {
        return 1;
      }
      if (f.isDir()) {
        return -1;
      }
 else {
        return 1;
      }
    }
 catch (    FileNotFoundException fnfex) {
      fs.mkdirs(path);
      return -1;
    }
  }
 catch (  IOException e) {
    return 1;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public int getMaximumNumberOfSubtasks(){
  if (!(this.format instanceof FileOutputFormat)) {
    return -1;
  }
  final String pathName=this.config.getStubParameter(FileOutputFormat.FILE_PARAMETER_KEY,null);
  final Path path;
  if (pathName == null) {
    return 0;
  }
  try {
    path=new Path(pathName);
  }
 catch (  Throwable t) {
    return 0;
  }
  try {
    final FileSystem fs=path.getFileSystem();
    try {
      final FileStatus f=fs.getFileStatus(path);
      if (f == null) {
        return 1;
      }
      if (f.isDir())       return -1;
 else       return 1;
    }
 catch (    FileNotFoundException fnfex) {
      int dop=getRuntimeConfiguration().getInteger(DEGREE_OF_PARALLELISM_KEY,-1);
      if (dop == 1) {
        return 1;
      }
      fs.mkdirs(path);
      return -1;
    }
  }
 catch (  IOException e) {
    return 1;
  }
}
Program: 55989
Project: 55989
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void initialize(URI name) throws IOException {
  this.host=name.getHost();
  if (this.host == null) {
    LOG.debug("String_Node_Str");
    this.host=GlobalConfiguration.getString(S3_HOST_KEY,DEFAULT_S3_HOST);
  }
  this.port=name.getPort();
  if (this.port == -1) {
    LOG.debug("String_Node_Str");
    this.port=GlobalConfiguration.getInteger(S3_PORT_KEY,DEFAULT_S3_PORT);
  }
  final String userInfo=name.getUserInfo();
  String awsAccessKey=null;
  String awsSecretKey=null;
  if (userInfo != null) {
    final String[] splits=userInfo.split("String_Node_Str");
    if (splits.length > 1) {
      awsAccessKey=splits[0];
      awsSecretKey=splits[1];
    }
  }
  if (awsAccessKey == null) {
    LOG.debug("String_Node_Str");
    awsAccessKey=GlobalConfiguration.getString(S3_ACCESS_KEY_KEY,null);
    if (awsAccessKey == null) {
      throw new IOException("String_Node_Str");
    }
  }
  if (awsSecretKey == null) {
    LOG.debug("String_Node_Str");
    awsSecretKey=GlobalConfiguration.getString(S3_SECRET_KEY_KEY,null);
    if (awsSecretKey == null) {
      throw new IOException("String_Node_Str");
    }
  }
  final AWSCredentials credentials=new BasicAWSCredentials(awsAccessKey,awsSecretKey);
  this.s3Client=new AmazonS3Client(credentials);
  initializeDirectoryStructure(name);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void initialize(URI name) throws IOException {
  this.host=name.getHost();
  if (this.host == null) {
    LOG.debug("String_Node_Str");
    this.host=GlobalConfiguration.getString(S3_HOST_KEY,DEFAULT_S3_HOST);
  }
  this.port=name.getPort();
  if (this.port == -1) {
    LOG.debug("String_Node_Str");
    this.port=GlobalConfiguration.getInteger(S3_PORT_KEY,DEFAULT_S3_PORT);
  }
  final String userInfo=name.getUserInfo();
  String awsAccessKey=null;
  String awsSecretKey=null;
  if (userInfo != null) {
    final String[] splits=userInfo.split("String_Node_Str");
    if (splits.length > 1) {
      awsAccessKey=URLDecoder.decode(splits[0],URL_ENCODE_CHARACTER);
      awsSecretKey=URLDecoder.decode(splits[1],URL_ENCODE_CHARACTER);
    }
  }
  if (awsAccessKey == null) {
    LOG.debug("String_Node_Str");
    awsAccessKey=GlobalConfiguration.getString(S3_ACCESS_KEY_KEY,null);
    if (awsAccessKey == null) {
      throw new IOException("String_Node_Str");
    }
  }
  if (awsSecretKey == null) {
    LOG.debug("String_Node_Str");
    awsSecretKey=GlobalConfiguration.getString(S3_SECRET_KEY_KEY,null);
    if (awsSecretKey == null) {
      throw new IOException("String_Node_Str");
    }
  }
  final AWSCredentials credentials=new BasicAWSCredentials(awsAccessKey,awsSecretKey);
  this.s3Client=new AmazonS3Client(credentials);
  initializeDirectoryStructure(name);
}
Program: 55990
Project: 55990
Buggy source:
public boolean hasAssignedChannels(){
  return (!this.assignedChannels.isEmpty());
}

Fixed version (ground truth):
boolean hasAssignedChannels(){
  return (!this.assignedChannels.isEmpty());
}
Program: 55991
Project: 55991
Buggy source:
public void removeAssignedChannel(final ChannelID channelID){
  if (!this.assignedChannels.remove(channelID)) {
    throw new IllegalStateException(channelID + "String_Node_Str");
  }
}

Fixed version (ground truth):
void removeAssignedChannel(final ChannelID channelID){
  if (!this.assignedChannels.remove(channelID)) {
    throw new IllegalStateException(channelID + "String_Node_Str");
  }
}
Program: 55992
Project: 55992
Buggy source:
protected void addAssignedChannel(final ChannelID channelID){
  this.assignedChannels.add(channelID);
}

Fixed version (ground truth):
void addAssignedChannel(final ChannelID channelID){
  if (!this.assignedChannels.add(channelID)) {
    throw new IllegalStateException(channelID + "String_Node_Str");
  }
}
Program: 55993
Project: 55993
Buggy source:
@Override public final synchronized Compressor getCompressor(final AbstractByteBufferedOutputChannel<?> outputChannel) throws CompressionException {
  final OutputGate<?> outputGate=outputChannel.getOutputGate();
  CompressorCacheEntry cacheEntry=this.compressorCache.get(outputGate);
  if (cacheEntry == null) {
    Compressor compressor=initNewCompressor(outputChannel);
    cacheEntry=new CompressorCacheEntry(compressor,outputGate);
    this.compressorCache.put(outputGate,cacheEntry);
    this.compressorMap.put(compressor,outputGate);
  }
  return cacheEntry.getCompressor();
}

Fixed version (ground truth):
@Override public final synchronized Compressor getCompressor(final AbstractByteBufferedOutputChannel<?> outputChannel) throws CompressionException {
  final OutputGate<?> outputGate=outputChannel.getOutputGate();
  CompressorCacheEntry cacheEntry=this.compressorCache.get(outputGate);
  if (cacheEntry == null) {
    Compressor compressor=initNewCompressor(outputChannel);
    cacheEntry=new CompressorCacheEntry(compressor);
    this.compressorCache.put(outputGate,cacheEntry);
    this.compressorMap.put(compressor,outputGate);
  }
  cacheEntry.addAssignedChannel(outputChannel.getID());
  return cacheEntry.getCompressor();
}
Program: 55994
Project: 55994
Buggy source:
@Override public final synchronized Decompressor getDecompressor(final AbstractByteBufferedInputChannel<?> inputChannel) throws CompressionException {
  final InputGate<?> inputGate=inputChannel.getInputGate();
  DecompressorCacheEntry cacheEntry=this.decompressorCache.get(inputGate);
  if (cacheEntry == null) {
    Decompressor decompressor=initNewDecompressor(inputChannel);
    cacheEntry=new DecompressorCacheEntry(decompressor,inputGate);
    this.decompressorCache.put(inputGate,cacheEntry);
    this.decompressorMap.put(decompressor,inputGate);
  }
  return cacheEntry.getDecompressor();
}

Fixed version (ground truth):
@Override public final synchronized Decompressor getDecompressor(final AbstractByteBufferedInputChannel<?> inputChannel) throws CompressionException {
  final InputGate<?> inputGate=inputChannel.getInputGate();
  DecompressorCacheEntry cacheEntry=this.decompressorCache.get(inputGate);
  if (cacheEntry == null) {
    Decompressor decompressor=initNewDecompressor(inputChannel);
    cacheEntry=new DecompressorCacheEntry(decompressor);
    this.decompressorCache.put(inputGate,cacheEntry);
    this.decompressorMap.put(decompressor,inputGate);
  }
  cacheEntry.addAssignedChannel(inputChannel.getID());
  return cacheEntry.getDecompressor();
}
Program: 55995
Project: 55995
Buggy source:
CompressorCacheEntry(final Compressor compressor,final OutputGate<?> outputGate){
  this.compressor=compressor;
  for (int i=0; i < outputGate.getNumberOfOutputChannels(); i++) {
    final AbstractOutputChannel<?> outputChannel=outputGate.getOutputChannel(i);
    addAssignedChannel(outputChannel.getID());
  }
}

Fixed version (ground truth):
CompressorCacheEntry(final Compressor compressor){
  this.compressor=compressor;
}
Program: 55996
Project: 55996
Buggy source:
DecompressorCacheEntry(final Decompressor decompressor,final InputGate<?> inputGate){
  this.decompressor=decompressor;
  for (int i=0; i < inputGate.getNumberOfInputChannels(); i++) {
    final AbstractInputChannel<?> inputChannel=inputGate.getInputChannel(i);
    addAssignedChannel(inputChannel.getID());
  }
}

Fixed version (ground truth):
DecompressorCacheEntry(final Decompressor decompressor){
  this.decompressor=decompressor;
}
Program: 55997
Project: 55997
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ManagementVertex next(){
  if (traversalStack.isEmpty()) {
    if (numVisitedEntryVertices < 0) {
      return null;
    }
    TraversalEntry newentry;
    if (forward) {
      newentry=new TraversalEntry(managementGraph.getInputVertex(this.startStage,numVisitedEntryVertices),0,0);
    }
 else {
      newentry=new TraversalEntry(managementGraph.getOutputVertex(this.startStage,numVisitedEntryVertices),0,0);
    }
    traversalStack.push(newentry);
  }
  final ManagementVertex returnVertex=traversalStack.peek().getManagementVertex();
  do {
    final TraversalEntry te=traversalStack.peek();
    final ManagementVertex candidateVertex=getCandidateVertex(te,forward);
    if (candidateVertex == null) {
      traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0,0);
      traversalStack.add(newte);
      break;
    }
  }
 while (!traversalStack.isEmpty());
  alreadyVisited.add(returnVertex);
  return returnVertex;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ManagementVertex next(){
  if (this.traversalStack.isEmpty()) {
    if (this.numVisitedEntryVertices < 0) {
      return null;
    }
    TraversalEntry newentry;
    if (this.forward) {
      newentry=new TraversalEntry(this.managementGraph.getInputVertex(this.startStage,this.numVisitedEntryVertices),0,0);
    }
 else {
      newentry=new TraversalEntry(managementGraph.getOutputVertex(this.startStage,this.numVisitedEntryVertices),0,0);
    }
    this.traversalStack.push(newentry);
    this.alreadyVisited.add(newentry.getManagementVertex());
  }
  final ManagementVertex returnVertex=this.traversalStack.peek().getManagementVertex();
  do {
    final TraversalEntry te=this.traversalStack.peek();
    final ManagementVertex candidateVertex=getCandidateVertex(te,this.forward);
    if (candidateVertex == null) {
      this.traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0,0);
      this.traversalStack.push(newte);
      this.alreadyVisited.add(candidateVertex);
      break;
    }
  }
 while (!this.traversalStack.isEmpty());
  return returnVertex;
}
Program: 55998
Project: 55998
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean hasNext(){
  if (traversalStack.isEmpty()) {
    if (numVisitedEntryVertices < 0) {
      return false;
    }
    numVisitedEntryVertices++;
    if (forward) {
      if (managementGraph.getNumberOfInputVertices(this.startStage) <= numVisitedEntryVertices) {
        return false;
      }
    }
 else {
      if (managementGraph.getNumberOfOutputVertices(this.startStage) <= numVisitedEntryVertices) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean hasNext(){
  if (this.traversalStack.isEmpty()) {
    if (this.numVisitedEntryVertices < 0) {
      return false;
    }
    ++this.numVisitedEntryVertices;
    if (this.forward) {
      if (this.managementGraph.getNumberOfInputVertices(this.startStage) <= this.numVisitedEntryVertices) {
        return false;
      }
    }
 else {
      if (this.managementGraph.getNumberOfOutputVertices(this.startStage) <= this.numVisitedEntryVertices) {
        return false;
      }
    }
  }
  return true;
}
Program: 56000
Project: 56000
Buggy source:
/** 
 * Creates a new management graph iterator. This constructor can be used to traverse only specific parts of the graph starting at <code>startVertex</code>. The iterator will not switch to the next input/output vertex of an output/input vertex has been reached.
 * @param managementGraph the management graph that should be traversed
 * @param startVertex the vertex to start the traversal from
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 */
public ManagementGraphIterator(final ManagementGraph managementGraph,final ManagementVertex startVertex,final boolean forward){
  this.managementGraph=managementGraph;
  this.forward=forward;
  this.numVisitedEntryVertices=-1;
  this.startStage=0;
  this.confinedToStage=false;
  final TraversalEntry te=new TraversalEntry(startVertex,0,0);
  traversalStack.push(te);
}

Fixed version (ground truth):
/** 
 * Creates a new management graph iterator. This constructor can be used to traverse only specific parts of the graph starting at <code>startVertex</code>. The iterator will not switch to the next input/output vertex of an output/input vertex has been reached.
 * @param managementGraph the management graph that should be traversed
 * @param startVertex the vertex to start the traversal from
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 */
public ManagementGraphIterator(final ManagementGraph managementGraph,final ManagementVertex startVertex,final boolean forward){
  this.managementGraph=managementGraph;
  this.forward=forward;
  this.numVisitedEntryVertices=-1;
  this.startStage=0;
  this.confinedToStage=false;
  final TraversalEntry te=new TraversalEntry(startVertex,0,0);
  this.traversalStack.push(te);
  this.alreadyVisited.add(te.getManagementVertex());
}
Program: 56001
Project: 56001
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ManagementGroupVertex next(){
  if (this.traversalStack.isEmpty()) {
    final TraversalEntry newentry=new TraversalEntry(this.entryVertices.get(this.numVisitedEntryVertices),0);
    this.traversalStack.push(newentry);
  }
  final ManagementGroupVertex returnVertex=this.traversalStack.peek().getGroupVertex();
  do {
    final TraversalEntry te=this.traversalStack.peek();
    final ManagementGroupVertex candidateVertex=getCandidateVertex(te,forward);
    if (candidateVertex == null) {
      this.traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0);
      this.traversalStack.add(newte);
      break;
    }
  }
 while (!this.traversalStack.isEmpty());
  this.alreadyVisited.add(returnVertex);
  return returnVertex;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ManagementGroupVertex next(){
  if (this.traversalStack.isEmpty()) {
    final TraversalEntry newentry=new TraversalEntry(this.entryVertices.get(this.numVisitedEntryVertices),0);
    this.traversalStack.push(newentry);
    this.alreadyVisited.add(newentry.getGroupVertex());
  }
  final ManagementGroupVertex returnVertex=this.traversalStack.peek().getGroupVertex();
  do {
    final TraversalEntry te=this.traversalStack.peek();
    final ManagementGroupVertex candidateVertex=getCandidateVertex(te,forward);
    if (candidateVertex == null) {
      this.traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0);
      this.traversalStack.push(newte);
      this.alreadyVisited.add(newte.getGroupVertex());
      break;
    }
  }
 while (!this.traversalStack.isEmpty());
  return returnVertex;
}
Program: 56002
Project: 56002
Buggy source:
/** 
 * Collects all input group vertices (i.e. vertices with no incoming edge or incoming edges from other stages) in the given stage and adds them to an internal list.
 * @param stage the number of the stage whose input vertices should be collected
 */
private void collectStartVertices(final ManagementStage stage){
  for (int i=0; i < stage.getNumberOfGroupVertices(); i++) {
    final ManagementGroupVertex groupVertex=stage.getGroupVertex(i);
    if (forward) {
      if ((groupVertex.getNumberOfBackwardEdges() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex,true))) {
        this.entryVertices.add(groupVertex);
      }
    }
 else {
      if ((groupVertex.getNumberOfForwardEdges() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex,false))) {
        this.entryVertices.add(groupVertex);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Collects all input group vertices (i.e. vertices with no incoming edge or incoming edges from other stages) in the given stage and adds them to an internal list.
 * @param stage the number of the stage whose input vertices should be collected
 */
private void collectStartVertices(final ManagementStage stage){
  for (int i=0; i < stage.getNumberOfGroupVertices(); i++) {
    final ManagementGroupVertex groupVertex=stage.getGroupVertex(i);
    if (this.forward) {
      if ((groupVertex.getNumberOfBackwardEdges() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex,true))) {
        this.entryVertices.add(groupVertex);
      }
    }
 else {
      if ((groupVertex.getNumberOfForwardEdges() == 0) || ((this.stage >= 0) && allConnectionsFromOtherStage(groupVertex,false))) {
        this.entryVertices.add(groupVertex);
      }
    }
  }
}
Program: 56003
Project: 56003
Buggy source:
/** 
 * Creates a new management group vertex iterator.
 * @param managementGraph the management graph that should be traversed
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 * @param stage the number of the stage whose vertices should be traversed or -1 if all stages should be included in the traversal
 */
public ManagementGroupVertexIterator(final ManagementGraph managementGraph,final boolean forward,final int stage){
  this.forward=forward;
  this.stage=stage;
  if (stage < 0) {
    for (int i=0; i < managementGraph.getNumberOfStages(); i++) {
      collectStartVertices(managementGraph.getStage(i));
    }
  }
 else {
    if (stage < managementGraph.getNumberOfStages()) {
      collectStartVertices(managementGraph.getStage(stage));
    }
  }
  if (this.entryVertices.size() > 0) {
    final TraversalEntry te=new TraversalEntry(this.entryVertices.get(0),0);
    this.traversalStack.push(te);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new management group vertex iterator.
 * @param managementGraph the management graph that should be traversed
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 * @param stage the number of the stage whose vertices should be traversed or -1 if all stages should be included in the traversal
 */
public ManagementGroupVertexIterator(final ManagementGraph managementGraph,final boolean forward,final int stage){
  this.forward=forward;
  this.stage=stage;
  if (stage < 0) {
    for (int i=0; i < managementGraph.getNumberOfStages(); i++) {
      collectStartVertices(managementGraph.getStage(i));
    }
  }
 else {
    if (stage < managementGraph.getNumberOfStages()) {
      collectStartVertices(managementGraph.getStage(stage));
    }
  }
  if (this.entryVertices.size() > 0) {
    final TraversalEntry te=new TraversalEntry(this.entryVertices.get(0),0);
    this.traversalStack.push(te);
    this.alreadyVisited.add(te.getGroupVertex());
  }
}
Program: 56004
Project: 56004
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ExecutionVertex next(){
  if (traversalStack.isEmpty()) {
    if (numVisitedEntryVertices < 0) {
      return null;
    }
    TraversalEntry newentry;
    if (forward) {
      newentry=new TraversalEntry(executionGraph.getInputVertex(this.startStage,numVisitedEntryVertices),0,0);
    }
 else {
      newentry=new TraversalEntry(executionGraph.getOutputVertex(this.startStage,numVisitedEntryVertices),0,0);
    }
    traversalStack.push(newentry);
  }
  final ExecutionVertex returnVertex=traversalStack.peek().getExecutionVertex();
  do {
    final TraversalEntry te=traversalStack.peek();
    final ExecutionVertex candidateVertex=getCandidateVertex(te,forward);
    if (candidateVertex == null) {
      traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0,0);
      traversalStack.add(newte);
      break;
    }
  }
 while (!traversalStack.isEmpty());
  alreadyVisited.add(returnVertex);
  return returnVertex;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ExecutionVertex next(){
  if (this.traversalStack.isEmpty()) {
    if (this.numVisitedEntryVertices < 0) {
      return null;
    }
    TraversalEntry newentry;
    if (this.forward) {
      newentry=new TraversalEntry(this.executionGraph.getInputVertex(this.startStage,this.numVisitedEntryVertices),0,0);
    }
 else {
      newentry=new TraversalEntry(this.executionGraph.getOutputVertex(this.startStage,this.numVisitedEntryVertices),0,0);
    }
    this.traversalStack.push(newentry);
    this.alreadyVisited.add(newentry.getExecutionVertex());
  }
  final ExecutionVertex returnVertex=this.traversalStack.peek().getExecutionVertex();
  do {
    final TraversalEntry te=this.traversalStack.peek();
    final ExecutionVertex candidateVertex=getCandidateVertex(te,forward);
    if (candidateVertex == null) {
      this.traversalStack.pop();
    }
 else {
      final TraversalEntry newte=new TraversalEntry(candidateVertex,0,0);
      this.traversalStack.push(newte);
      this.alreadyVisited.add(candidateVertex);
      break;
    }
  }
 while (!this.traversalStack.isEmpty());
  return returnVertex;
}
Program: 56005
Project: 56005
Buggy source:
/** 
 * Creates a new execution graph iterator. This constructor can be used to traverse only specific parts of the graph starting at <code>startVertex</code>. The iterator will not switch to the next input/output vertex of an output/input vertex has been reached.
 * @param executionGraph the execution graph that should be traversed
 * @param startVertex the vertex to start the traversal from
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 */
public ExecutionGraphIterator(ExecutionGraph executionGraph,ExecutionVertex startVertex,boolean forward){
  this.executionGraph=executionGraph;
  this.forward=forward;
  this.numVisitedEntryVertices=-1;
  this.startStage=0;
  this.confinedToStage=false;
  final TraversalEntry te=new TraversalEntry(startVertex,0,0);
  traversalStack.push(te);
}

Fixed version (ground truth):
/** 
 * Creates a new execution graph iterator. This constructor can be used to traverse only specific parts of the graph starting at <code>startVertex</code>. The iterator will not switch to the next input/output vertex of an output/input vertex has been reached.
 * @param executionGraph the execution graph that should be traversed
 * @param startVertex the vertex to start the traversal from
 * @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to reverse it in reverse order
 */
public ExecutionGraphIterator(ExecutionGraph executionGraph,ExecutionVertex startVertex,boolean forward){
  this.executionGraph=executionGraph;
  this.forward=forward;
  this.numVisitedEntryVertices=-1;
  this.startStage=0;
  this.confinedToStage=false;
  final TraversalEntry te=new TraversalEntry(startVertex,0,0);
  this.traversalStack.push(te);
  this.alreadyVisited.add(startVertex);
}
Program: 56006
Project: 56006
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean hasNext(){
  if (traversalStack.isEmpty()) {
    if (numVisitedEntryVertices < 0) {
      return false;
    }
    numVisitedEntryVertices++;
    if (forward) {
      if (executionGraph.getNumberOfInputVertices(this.startStage) <= numVisitedEntryVertices) {
        return false;
      }
    }
 else {
      if (executionGraph.getNumberOfOutputVertices(this.startStage) <= numVisitedEntryVertices) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean hasNext(){
  if (this.traversalStack.isEmpty()) {
    if (this.numVisitedEntryVertices < 0) {
      return false;
    }
    ++this.numVisitedEntryVertices;
    if (this.forward) {
      if (this.executionGraph.getNumberOfInputVertices(this.startStage) <= this.numVisitedEntryVertices) {
        return false;
      }
    }
 else {
      if (this.executionGraph.getNumberOfOutputVertices(this.startStage) <= this.numVisitedEntryVertices) {
        return false;
      }
    }
  }
  return true;
}
Program: 56008
Project: 56008
Buggy source:
/** 
 * Initializes the input reader of the MapTask.
 * @throws RuntimeException Thrown if no input ship strategy was provided.
 */
private void initInputReader() throws RuntimeException {
  RecordDeserializer<KeyValuePair<Key,Value>> deserializerPartition=new KeyValuePairDeserializer<Key,Value>(stub.getOutKeyType(),(Class<Value>)((Class<? extends Value>)PactNull.class));
  RecordDeserializer<KeyValuePair<Key,Value>> deserializerReader=new KeyValuePairDeserializer<Key,Value>(stub.getOutKeyType(),stub.getOutValueType());
  DistributionPattern dpPartition=null;
switch (config.getInputShipStrategy(0)) {
case FORWARD:
    dpPartition=new PointwiseDistributionPattern();
  break;
case PARTITION_HASH:
case PARTITION_RANGE:
case BROADCAST:
dpPartition=new BipartiteDistributionPattern();
break;
default :
throw new RuntimeException("String_Node_Str");
}
DistributionPattern dpReader=null;
switch (config.getInputShipStrategy(0)) {
case FORWARD:
dpReader=new PointwiseDistributionPattern();
break;
case PARTITION_HASH:
case PARTITION_RANGE:
case BROADCAST:
dpReader=new BipartiteDistributionPattern();
break;
default :
throw new RuntimeException("String_Node_Str");
}
readerPartition=new RecordReader<KeyValuePair<Key,Value>>(this,deserializerPartition,dpPartition);
readerStub=new RecordReader<KeyValuePair<Key,Value>>(this,deserializerReader,dpReader);
}

Fixed version (ground truth):
/** 
 * Initializes the input reader of the MapTask.
 * @throws RuntimeException Thrown if no input ship strategy was provided.
 */
private void initInputReader() throws RuntimeException {
  RecordDeserializer<KeyValuePair<Key,Value>> deserializerPartition=new KeyValuePairDeserializer<Key,Value>(stub.getOutKeyType(),(Class<Value>)((Class<? extends Value>)PactNull.class));
  RecordDeserializer<KeyValuePair<Key,Value>> deserializerReader=new KeyValuePairDeserializer<Key,Value>(stub.getOutKeyType(),stub.getOutValueType());
  DistributionPattern dpPartition=null;
switch (config.getInputShipStrategy(0)) {
case FORWARD:
    dpPartition=new PointwiseDistributionPattern();
  break;
case PARTITION_HASH:
case PARTITION_RANGE:
case BROADCAST:
dpPartition=new BipartiteDistributionPattern();
break;
default :
throw new RuntimeException("String_Node_Str");
}
DistributionPattern dpReader=null;
switch (config.getInputShipStrategy(1)) {
case FORWARD:
dpReader=new PointwiseDistributionPattern();
break;
case PARTITION_HASH:
case PARTITION_RANGE:
case BROADCAST:
dpReader=new BipartiteDistributionPattern();
break;
default :
throw new RuntimeException("String_Node_Str");
}
readerPartition=new RecordReader<KeyValuePair<Key,Value>>(this,deserializerPartition,dpPartition);
readerStub=new RecordReader<KeyValuePair<Key,Value>>(this,deserializerReader,dpReader);
}
Program: 56013
Project: 56013
Buggy source:
@Override public JsonNode evaluate(final JsonNode node,EvaluationContext context){
  if (node.isArray()) {
    if (node instanceof StreamArrayNode)     return new StreamArrayNode(new TransformingIterator<JsonNode,JsonNode>(node.iterator()){
      @Override protected JsonNode transform(      JsonNode inputObject){
        return inputObject.get(FieldAccess.this.field);
      }
    }
);
    ArrayNode arrayNode=new ArrayNode(NODE_FACTORY);
    for (int index=0, size=node.size(); index < size; index++)     arrayNode.add(node.get(index).get(this.field));
    return arrayNode;
  }
  return node.get(this.field);
}

Fixed version (ground truth):
@Override public JsonNode evaluate(final JsonNode node,EvaluationContext context){
  if (node.isArray()) {
    if (node instanceof StreamArrayNode)     return new StreamArrayNode(new ConversionIterator<JsonNode,JsonNode>(node.iterator()){
      @Override protected JsonNode convert(      JsonNode inputObject){
        return inputObject.get(FieldAccess.this.field);
      }
    }
);
    ArrayNode arrayNode=new ArrayNode(NODE_FACTORY);
    for (int index=0, size=node.size(); index < size; index++)     arrayNode.add(node.get(index).get(this.field));
    return arrayNode;
  }
  return node.get(this.field);
}
Program: 56014
Project: 56014
Buggy source:
@Override public Iterator<Evaluable> iterator(){
  return new TransformingIterator<Mapping,Evaluable>(mappings.iterator()){
    @Override protected Evaluable transform(    Mapping inputObject){
      return inputObject.getExpression();
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<Evaluable> iterator(){
  return new ConversionIterator<Mapping,Evaluable>(mappings.iterator()){
    @Override protected Evaluable convert(    Mapping inputObject){
      return inputObject.getExpression();
    }
  }
;
}
Program: 56015
Project: 56015
Buggy source:
public static JsonNode union(JsonNode[] params){
  boolean hasStream=false;
  for (  JsonNode param : params) {
    if (!param.isArray())     throw new EvaluationException("String_Node_Str");
    hasStream|=param instanceof StreamArrayNode;
  }
  if (hasStream) {
    @SuppressWarnings("String_Node_Str") Iterator<JsonNode>[] iterators=new Iterator[params.length];
    for (int index=0; index < iterators.length; index++)     iterators[index]=params[index].iterator();
    return new StreamArrayNode(new ConcatenatingIterator<JsonNode>(iterators));
  }
  ArrayNode union=NODE_FACTORY.arrayNode();
  for (  JsonNode param : params)   union.addAll((ArrayNode)param);
  return union;
}

Fixed version (ground truth):
public static JsonNode union(JsonNode[] params){
  boolean hasStream=false;
  for (  JsonNode param : params) {
    if (!param.isArray())     throw new EvaluationException("String_Node_Str");
    hasStream|=param instanceof StreamArrayNode;
  }
  if (hasStream) {
    Iterator<?>[] iterators=new Iterator[params.length];
    for (int index=0; index < iterators.length; index++)     iterators[index]=params[index].iterator();
    return new StreamArrayNode(new ConcatenatingIterator<JsonNode>(iterators));
  }
  ArrayNode union=NODE_FACTORY.arrayNode();
  for (  JsonNode param : params)   union.addAll((ArrayNode)param);
  return union;
}