nus-yam/ex-repair huggingface dataset:
Program: 46346
Project: 46346
Buggy source:
private void authenticated(Address target,ClientConnection connection){
  ClientConnection oldConnection=connections.put(connection.getRemoteEndpoint(),connection);
  if (oldConnection == null) {
    if (logger.isFinestEnabled()) {
      logger.finest("String_Node_Str" + connection + "String_Node_Str");
    }
    fireConnectionAddedEvent(connection);
  }
 else {
    if (logger.isFinestEnabled()) {
      logger.finest("String_Node_Str" + connection + "String_Node_Str"+ oldConnection+ "String_Node_Str");
      destroyConnection(oldConnection,"String_Node_Str",null);
    }
  }
  connectionsInProgress.remove(target);
  logger.info("String_Node_Str" + connection.getRemoteEndpoint() + "String_Node_Str"+ connection.getConnectedServerVersionString()+ "String_Node_Str"+ connection.getLocalSocketAddress());
}

Fixed version (ground truth):
private void authenticated(Address target,ClientConnection connection){
  ClientConnection oldConnection=connections.put(addressTranslator.translate(connection.getRemoteEndpoint()),connection);
  if (oldConnection == null) {
    if (logger.isFinestEnabled()) {
      logger.finest("String_Node_Str" + connection + "String_Node_Str");
    }
    fireConnectionAddedEvent(connection);
  }
 else {
    if (logger.isFinestEnabled()) {
      logger.finest("String_Node_Str" + connection + "String_Node_Str"+ oldConnection+ "String_Node_Str");
      destroyConnection(oldConnection,"String_Node_Str",null);
    }
  }
  connectionsInProgress.remove(target);
  logger.info("String_Node_Str" + connection.getRemoteEndpoint() + "String_Node_Str"+ connection.getConnectedServerVersionString()+ "String_Node_Str"+ connection.getLocalSocketAddress());
}
Program: 46347
Project: 46347
Buggy source:
@Override public Connection getOrConnect(Address address,boolean asOwner) throws IOException {
  try {
    while (true) {
      Connection connection=getConnection(address,asOwner);
      if (connection != null) {
        return connection;
      }
      AuthenticationFuture firstCallback=triggerConnect(address,asOwner);
      connection=firstCallback.get(connectionTimeout);
      if (!asOwner) {
        return connection;
      }
      if (firstCallback.authenticatedAsOwner) {
        return connection;
      }
    }
  }
 catch (  Throwable e) {
    throw ExceptionUtil.rethrow(e);
  }
}

Fixed version (ground truth):
@Override public Connection getOrConnect(Address address,boolean asOwner) throws IOException {
  try {
    while (true) {
      Connection connection=getConnection(address,asOwner);
      if (connection != null) {
        return connection;
      }
      AuthenticationFuture firstCallback=triggerConnect(addressTranslator.translate(address),asOwner);
      connection=firstCallback.get(connectionTimeout);
      if (!asOwner) {
        return connection;
      }
      if (firstCallback.authenticatedAsOwner) {
        return connection;
      }
    }
  }
 catch (  Throwable e) {
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 46348
Project: 46348
Buggy source:
private Map<String,String> getLookupTable(){
  Map<String,String> table=privateToPublic;
  return table != null ? table : Collections.<String,String>emptyMap();
}

Fixed version (ground truth):
private Map<String,String> getLookupTable(){
  return privateToPublic;
}
Program: 46349
Project: 46349
Buggy source:
/** 
 * @param address
 * @return public address of network whose private address is given, if addressnot founds returns null.
 */
public Address translate(Address address){
  if (isInsideAws) {
    return address;
  }
  if (address == null) {
    return null;
  }
  String publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  refresh();
  publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param address
 * @return public address of network whose private address is given, if addressnot founds returns null.
 */
public Address translate(Address address){
  if (isInsideAws) {
    return address;
  }
  if (address == null) {
    return null;
  }
  String publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  if (privateToPublic.values().contains(address.getHost())) {
    return address;
  }
  refresh();
  publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  return null;
}
Program: 46350
Project: 46350
Buggy source:
@Override protected AggregationResult reduce(Collection<AggregationResult> results){
  if (results.isEmpty()) {
    return EMPTY_AGGREGATION_RESULT;
  }
  AggregationResult combinedResult=null;
  try {
    for (    AggregationResult result : results) {
      if (combinedResult == null) {
        combinedResult=result;
      }
 else {
        combinedResult.combine(result);
      }
    }
  }
  finally {
    combinedResult.onCombineFinished();
  }
  return combinedResult;
}

Fixed version (ground truth):
@Override protected AggregationResult reduce(Collection<AggregationResult> results){
  if (results.isEmpty()) {
    return EMPTY_AGGREGATION_RESULT;
  }
  AggregationResult combinedResult=null;
  try {
    for (    AggregationResult result : results) {
      if (combinedResult == null) {
        combinedResult=result;
      }
 else {
        combinedResult.combine(result);
      }
    }
  }
  finally {
    if (combinedResult != null) {
      combinedResult.onCombineFinished();
    }
  }
  return combinedResult;
}
Program: 46351
Project: 46351
Buggy source:
public InternalPartitionImpl(int partitionId,PartitionListener listener,Address thisAddress,Address[] addresses){
  this(partitionId,listener,thisAddress);
  this.addresses=addresses;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public InternalPartitionImpl(int partitionId,PartitionListener listener,Address thisAddress,Address[] addresses){
  this(partitionId,listener,thisAddress);
  this.addresses=addresses;
}
Program: 46352
Project: 46352
Buggy source:
private void monitor(String memberUuid,ClientEndpointImpl clientEndpoint){
  if (clientEndpoint.isFirstConnection() && ClientType.CPP.equals(clientEndpoint.getClientType())) {
    return;
  }
  final Connection connection=clientEndpoint.getConnection();
  final long lastTimePackageReceived=connection.lastReadTimeMillis();
  final long timeoutInMillis=SECONDS.toMillis(heartbeatTimeoutSeconds);
  final long currentTimeMillis=Clock.currentTimeMillis();
  if (lastTimePackageReceived + timeoutInMillis < currentTimeMillis) {
    if (memberUuid.equals(clientEndpoint.getPrincipal().getOwnerUuid())) {
      String message="String_Node_Str" + connection + "String_Node_Str"+ timeToString(lastTimePackageReceived)+ "String_Node_Str"+ timeToString(lastTimePackageReceived);
      logger.log(Level.WARNING,message);
      connection.close(message,null);
    }
  }
}

Fixed version (ground truth):
private void monitor(String memberUuid,ClientEndpointImpl clientEndpoint){
  if (clientEndpoint.isFirstConnection() && ClientType.CPP.equals(clientEndpoint.getClientType())) {
    return;
  }
  final Connection connection=clientEndpoint.getConnection();
  final long lastTimePacketReceived=connection.lastReadTimeMillis();
  final long timeoutInMillis=SECONDS.toMillis(heartbeatTimeoutSeconds);
  final long currentTimeMillis=Clock.currentTimeMillis();
  if (lastTimePacketReceived + timeoutInMillis < currentTimeMillis) {
    if (memberUuid.equals(clientEndpoint.getPrincipal().getOwnerUuid())) {
      String message="String_Node_Str" + connection + "String_Node_Str"+ timeToString(currentTimeMillis)+ "String_Node_Str"+ timeToString(lastTimePacketReceived);
      logger.log(Level.WARNING,message);
      connection.close(message,null);
    }
  }
}
Program: 46353
Project: 46353
Buggy source:
private void reRegisterAll(){
  for (  ClientRegistrationKey key : registrations.keySet()) {
    logger.finest("String_Node_Str" + key + "String_Node_Str");
    deregister(key,getMemberUuids());
    try {
      register(key);
    }
 catch (    Exception e) {
      Map<Member,ClientEventRegistration> registrationMap=registrations.get(key);
      if (null == registrationMap) {
        registrations.put(key,new ConcurrentHashMap<Member,ClientEventRegistration>());
      }
      ExceptionUtil.rethrow(e);
    }
    logger.finest("String_Node_Str" + key + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void reRegisterAll(){
  for (  Map.Entry<ClientRegistrationKey,Map<Member,ClientEventRegistration>> entry : registrations.entrySet()) {
    ClientRegistrationKey key=entry.getKey();
    logger.finest("String_Node_Str" + key + "String_Node_Str");
    deregister(key,getMemberUuids());
    try {
      register(key);
    }
 catch (    Exception e) {
      Map<Member,ClientEventRegistration> registrationMap=entry.getValue();
      if (null == registrationMap) {
        registrations.put(key,new ConcurrentHashMap<Member,ClientEventRegistration>());
      }
      ExceptionUtil.rethrow(e);
    }
    logger.finest("String_Node_Str" + key + "String_Node_Str");
  }
}
Program: 46354
Project: 46354
Buggy source:
protected Data serializeCacheConfig(Object response){
  if (null == response) {
    return nodeEngine.toData(response);
  }
  Data responseData=null;
  int clientVersion=getClientVersion();
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == clientVersion) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}

Fixed version (ground truth):
protected Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}
Program: 46355
Project: 46355
Buggy source:
protected Data serializeCacheConfig(Object response){
  if (null == response) {
    return nodeEngine.toData(response);
  }
  Data responseData=null;
  int clientVersion=getClientVersion();
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == clientVersion) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}

Fixed version (ground truth):
protected Data serializeCacheConfig(Object response){
  Data responseData=null;
  if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == getClientVersion()) {
    boolean compatibilityEnabled=nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
    if (compatibilityEnabled) {
      responseData=nodeEngine.toData(new LegacyCacheConfig((CacheConfig)response));
    }
  }
  if (null == responseData) {
    responseData=nodeEngine.toData(response);
  }
  return responseData;
}
Program: 46356
Project: 46356
Buggy source:
@Override protected void afterExecute(Runnable r,Throwable t){
  super.afterExecute(r,t);
  if (t == null && r instanceof ScheduledFuture && ((ScheduledFuture)r).isDone()) {
    try {
      ((Future)r).get();
    }
 catch (    CancellationException ce) {
      t=ce;
    }
catch (    ExecutionException e) {
      t=e.getCause();
    }
catch (    InterruptedException i) {
      t=i;
      currentThread().interrupt();
    }
  }
  if (t != null) {
    logger.severe("String_Node_Str" + r,t);
  }
}

Fixed version (ground truth):
@Override protected void afterExecute(Runnable runnable,Throwable throwable){
  super.afterExecute(runnable,throwable);
  if (throwable == null && runnable instanceof ScheduledFuture && ((ScheduledFuture)runnable).isDone()) {
    try {
      ((Future)runnable).get();
    }
 catch (    CancellationException ce) {
      throwable=ce;
    }
catch (    ExecutionException e) {
      throwable=e.getCause();
    }
catch (    InterruptedException i) {
      throwable=i;
      currentThread().interrupt();
    }
  }
  if (throwable != null) {
    logger.severe("String_Node_Str" + runnable,throwable);
  }
}
Program: 46357
Project: 46357
Buggy source:
public LoggingDelegatingFuture(Object task,RunnableScheduledFuture delegate){
  this.task=task;
  this.delegate=delegate;
}

Fixed version (ground truth):
LoggingDelegatingFuture(Object task,RunnableScheduledFuture<V> delegate){
  this.task=task;
  this.delegate=delegate;
}
Program: 46358
Project: 46358
Buggy source:
public Thread newThread(Runnable r){
  return new Thread(r);
}

Fixed version (ground truth):
@Override public Thread newThread(Runnable r){
  return new Thread(r);
}
Program: 46359
Project: 46359
Buggy source:
private void initOutputBuffer(TcpIpConnection connection,SocketWriter writer,String protocol){
  IOService ioService=connection.getConnectionManager().getIoService();
  int size=CLUSTER.equals(protocol) ? ioService.getSocketSendBufferSize() : ioService.getSocketClientReceiveBufferSize();
  ByteBuffer outputBuffer=newByteBuffer(size * KILO_BYTE,ioService.isSocketBufferDirect());
  if (CLUSTER.equals(protocol)) {
    outputBuffer.put(stringToBytes(CLUSTER));
  }
  writer.initOutputBuffer(outputBuffer);
  try {
    connection.setSendBufferSize(size);
  }
 catch (  SocketException e) {
    logger.finest("String_Node_Str" + connection + "String_Node_Str"+ size+ "String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void initOutputBuffer(TcpIpConnection connection,SocketWriter writer,String protocol){
  IOService ioService=connection.getConnectionManager().getIoService();
  int sizeKb=CLUSTER.equals(protocol) ? ioService.getSocketSendBufferSize() : ioService.getSocketClientReceiveBufferSize();
  int size=KILO_BYTE * sizeKb;
  ByteBuffer outputBuffer=newByteBuffer(size,ioService.isSocketBufferDirect());
  if (CLUSTER.equals(protocol)) {
    outputBuffer.put(stringToBytes(CLUSTER));
  }
  writer.initOutputBuffer(outputBuffer);
  try {
    connection.setSendBufferSize(size);
  }
 catch (  SocketException e) {
    logger.finest("String_Node_Str" + connection + "String_Node_Str"+ size+ "String_Node_Str",e);
  }
}
Program: 46360
Project: 46360
Buggy source:
public static int calculateVersion(String version){
  if (null == version) {
    return UNKNOWN_HAZELCAST_VERSION;
  }
  Matcher matcher=VERSION_PATTERN.matcher(version);
  if (matcher.matches()) {
    try {
      int calculatedVersion=MAJOR_VERSION_MULTIPLIER * Integer.valueOf(matcher.group(1)) + MINOR_VERSION_MULTIPLIER * Integer.valueOf(matcher.group(2));
      int groupCount=matcher.groupCount();
      if (groupCount >= PATCH_GROUP_COUNT) {
        String patchVersionString=matcher.group(PATCH_GROUP_COUNT);
        if (null != patchVersionString && !patchVersionString.startsWith("String_Node_Str")) {
          calculatedVersion+=Integer.valueOf(patchVersionString);
        }
      }
      return calculatedVersion;
    }
 catch (    Exception e) {
      Logger.getLogger(BuildInfo.class).warning("String_Node_Str" + version,e);
    }
  }
  return UNKNOWN_HAZELCAST_VERSION;
}

Fixed version (ground truth):
public static int calculateVersion(String version){
  if (null == version) {
    return UNKNOWN_HAZELCAST_VERSION;
  }
  Matcher matcher=VERSION_PATTERN.matcher(version);
  if (matcher.matches()) {
    try {
      int calculatedVersion=MAJOR_VERSION_MULTIPLIER * Integer.parseInt(matcher.group(1)) + MINOR_VERSION_MULTIPLIER * Integer.parseInt(matcher.group(2));
      int groupCount=matcher.groupCount();
      if (groupCount >= PATCH_GROUP_COUNT) {
        String patchVersionString=matcher.group(PATCH_GROUP_COUNT);
        if (null != patchVersionString && !patchVersionString.startsWith("String_Node_Str")) {
          calculatedVersion+=Integer.parseInt(patchVersionString);
        }
      }
      return calculatedVersion;
    }
 catch (    Exception e) {
      Logger.getLogger(BuildInfo.class).warning("String_Node_Str" + version,e);
    }
  }
  return UNKNOWN_HAZELCAST_VERSION;
}
Program: 46361
Project: 46361
Buggy source:
private void initOutputBuffer(TcpIpConnection connection,SocketWriter writer,String protocol){
  IOService ioService=connection.getConnectionManager().getIoService();
  int size=CLUSTER.equals(protocol) ? ioService.getSocketSendBufferSize() : ioService.getSocketClientReceiveBufferSize();
  ByteBuffer outputBuffer=newByteBuffer(size * KILO_BYTE,ioService.isSocketBufferDirect());
  if (CLUSTER.equals(protocol)) {
    outputBuffer.put(stringToBytes(CLUSTER));
  }
  writer.initOutputBuffer(outputBuffer);
  try {
    connection.setSendBufferSize(size);
  }
 catch (  SocketException e) {
    logger.finest("String_Node_Str" + connection + "String_Node_Str"+ size+ "String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void initOutputBuffer(TcpIpConnection connection,SocketWriter writer,String protocol){
  IOService ioService=connection.getConnectionManager().getIoService();
  int sizeKb=CLUSTER.equals(protocol) ? ioService.getSocketSendBufferSize() : ioService.getSocketClientReceiveBufferSize();
  int size=KILO_BYTE * sizeKb;
  ByteBuffer outputBuffer=newByteBuffer(size,ioService.isSocketBufferDirect());
  if (CLUSTER.equals(protocol)) {
    outputBuffer.put(stringToBytes(CLUSTER));
  }
  writer.initOutputBuffer(outputBuffer);
  try {
    connection.setSendBufferSize(size);
  }
 catch (  SocketException e) {
    logger.finest("String_Node_Str" + connection + "String_Node_Str"+ size+ "String_Node_Str",e);
  }
}
Program: 46362
Project: 46362
Buggy source:
@Override public void onRead(ByteBuffer src) throws Exception {
  int messagesCreated=0;
  while (src.hasRemaining()) {
    final boolean complete=message.readFrom(src);
    if (!complete) {
      messageCounter.inc(messagesCreated);
    }
    if (message.isFlagSet(BEGIN_AND_END_FLAGS)) {
      handleMessage(message);
      message=ClientMessage.create();
      messagesCreated++;
      continue;
    }
    if (message.isFlagSet(BEGIN_FLAG)) {
      final BufferBuilder builder=new BufferBuilder();
      builderBySessionIdMap.put(message.getCorrelationId(),builder);
      builder.append(message.buffer(),0,message.getFrameLength());
    }
 else {
      final BufferBuilder builder=builderBySessionIdMap.get(message.getCorrelationId());
      if (builder.position() == 0) {
        throw new IllegalStateException();
      }
      builder.append(message.buffer(),message.getDataOffset(),message.getFrameLength() - message.getDataOffset());
      if (message.isFlagSet(END_FLAG)) {
        final int msgLength=builder.position();
        ClientMessage cm=ClientMessage.createForDecode(builder.buffer(),0);
        cm.setFrameLength(msgLength);
        handleMessage(cm);
        builderBySessionIdMap.remove(message.getCorrelationId());
      }
    }
    message=ClientMessage.create();
    messagesCreated++;
  }
}

Fixed version (ground truth):
@Override public void onRead(ByteBuffer src) throws Exception {
  int messagesCreated=0;
  while (src.hasRemaining()) {
    final boolean complete=message.readFrom(src);
    if (!complete) {
      messageCounter.inc(messagesCreated);
      return;
    }
    if (message.isFlagSet(BEGIN_AND_END_FLAGS)) {
      handleMessage(message);
      message=ClientMessage.create();
      messagesCreated++;
      continue;
    }
    if (message.isFlagSet(BEGIN_FLAG)) {
      final BufferBuilder builder=new BufferBuilder();
      builderBySessionIdMap.put(message.getCorrelationId(),builder);
      builder.append(message.buffer(),0,message.getFrameLength());
    }
 else {
      final BufferBuilder builder=builderBySessionIdMap.get(message.getCorrelationId());
      if (builder.position() == 0) {
        throw new IllegalStateException();
      }
      builder.append(message.buffer(),message.getDataOffset(),message.getFrameLength() - message.getDataOffset());
      if (message.isFlagSet(END_FLAG)) {
        final int msgLength=builder.position();
        ClientMessage cm=ClientMessage.createForDecode(builder.buffer(),0);
        cm.setFrameLength(msgLength);
        handleMessage(cm);
        builderBySessionIdMap.remove(message.getCorrelationId());
      }
    }
    message=ClientMessage.create();
    messagesCreated++;
  }
}
Program: 46363
Project: 46363
Buggy source:
public static int calculateVersion(String version){
  if (null == version) {
    return UNKNOWN_HAZELCAST_VERSION;
  }
  Matcher matcher=VERSION_PATTERN.matcher(version);
  if (matcher.matches()) {
    try {
      int calculatedVersion=MAJOR_VERSION_MULTIPLIER * Integer.valueOf(matcher.group(1)) + MINOR_VERSION_MULTIPLIER * Integer.valueOf(matcher.group(2));
      int groupCount=matcher.groupCount();
      if (groupCount >= PATCH_GROUP_COUNT) {
        String patchVersionString=matcher.group(PATCH_GROUP_COUNT);
        if (null != patchVersionString && !patchVersionString.startsWith("String_Node_Str")) {
          calculatedVersion+=Integer.valueOf(patchVersionString);
        }
      }
      return calculatedVersion;
    }
 catch (    Exception e) {
      Logger.getLogger(BuildInfo.class).warning("String_Node_Str" + version,e);
    }
  }
  return UNKNOWN_HAZELCAST_VERSION;
}

Fixed version (ground truth):
public static int calculateVersion(String version){
  if (null == version) {
    return UNKNOWN_HAZELCAST_VERSION;
  }
  Matcher matcher=VERSION_PATTERN.matcher(version);
  if (matcher.matches()) {
    try {
      int calculatedVersion=MAJOR_VERSION_MULTIPLIER * Integer.parseInt(matcher.group(1)) + MINOR_VERSION_MULTIPLIER * Integer.parseInt(matcher.group(2));
      int groupCount=matcher.groupCount();
      if (groupCount >= PATCH_GROUP_COUNT) {
        String patchVersionString=matcher.group(PATCH_GROUP_COUNT);
        if (null != patchVersionString && !patchVersionString.startsWith("String_Node_Str")) {
          calculatedVersion+=Integer.parseInt(patchVersionString);
        }
      }
      return calculatedVersion;
    }
 catch (    Exception e) {
      Logger.getLogger(BuildInfo.class).warning("String_Node_Str" + version,e);
    }
  }
  return UNKNOWN_HAZELCAST_VERSION;
}
Program: 46364
Project: 46364
Buggy source:
@Test public void testConfigurationWithFileName() throws Exception {
  File file=createTempFile("String_Node_Str","String_Node_Str");
  file.deleteOnExit();
  String xml=HAZELCAST_START_TAG + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ HAZELCAST_END_TAG;
  Writer writer=new PrintWriter(file,"String_Node_Str");
  writer.write(xml);
  writer.close();
  Config config=new XmlConfigBuilder(file.getAbsolutePath()).build();
  assertEquals(file,config.getConfigurationFile());
}

Fixed version (ground truth):
@Test public void testConfigurationWithFileName() throws Exception {
  File file=createTempFile("String_Node_Str","String_Node_Str");
  file.deleteOnExit();
  String xml=HAZELCAST_START_TAG + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ HAZELCAST_END_TAG;
  Writer writer=new PrintWriter(file,"String_Node_Str");
  writer.write(xml);
  writer.close();
  String path=file.getAbsolutePath();
  Config config=new XmlConfigBuilder(path).build();
  assertEquals(path,config.getConfigurationFile().getAbsolutePath());
}
Program: 46365
Project: 46365
Buggy source:
@SuppressWarnings("String_Node_Str") public void store(long sequence,Data value){
  final Object actualValue;
  if (isBinaryFormat()) {
    actualValue=Arrays.copyOf(value.toByteArray(),value.totalSize());
  }
 else {
    actualValue=serializationService.toObject(value);
  }
  store.store(sequence,actualValue);
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void store(long sequence,Data value){
  final Object actualValue;
  if (isBinaryFormat()) {
    actualValue=Arrays.copyOf(value.toByteArray(),value.totalSize());
  }
 else {
    actualValue=serializationService.toObject(value);
  }
  store.store(sequence,actualValue);
}
Program: 46366
Project: 46366
Buggy source:
private RingbufferContainer clone(RingbufferContainer original){
  BufferObjectDataOutput out=serializationService.createObjectDataOutput(100000);
  BufferObjectDataInput in=null;
  try {
    original.writeData(out);
    byte[] bytes=out.toByteArray();
    sleepMillis(CLOCK_DIFFERENCE_MS);
    RingbufferContainer clone=new RingbufferContainer(original.name);
    in=serializationService.createObjectDataInput(bytes);
    clone.readData(in);
    return clone;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
 finally {
    closeResource(out);
    closeResource(in);
  }
}

Fixed version (ground truth):
private RingbufferContainer clone(RingbufferContainer original){
  BufferObjectDataOutput out=serializationService.createObjectDataOutput(100000);
  BufferObjectDataInput in=null;
  try {
    original.writeData(out);
    byte[] bytes=out.toByteArray();
    sleepMillis(CLOCK_DIFFERENCE_MS);
    RingbufferContainer clone=new RingbufferContainer(original.getName());
    in=serializationService.createObjectDataInput(bytes);
    clone.readData(in);
    return clone;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
 finally {
    closeResource(out);
    closeResource(in);
  }
}
Program: 46367
Project: 46367
Buggy source:
public QueueItem poll(){
  QueueItem item=peek();
  if (item == null) {
    return null;
  }
  if (store.isEnabled()) {
    try {
      store.delete(item.getItemId());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  getItemQueue().poll();
  age(item,Clock.currentTimeMillis());
  scheduleEvictionIfEmpty();
  return item;
}

Fixed version (ground truth):
/** 
 * Retrieves and removes the head of the queue (in other words, the first item), or returns   {@code null} if it is empty.Also calls the queue store for item deletion by item ID.
 * @return the first item in the queue
 */
public QueueItem poll(){
  final QueueItem item=peek();
  if (item == null) {
    return null;
  }
  if (store.isEnabled()) {
    try {
      store.delete(item.getItemId());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  getItemQueue().poll();
  age(item,Clock.currentTimeMillis());
  scheduleEvictionIfEmpty();
  return item;
}
Program: 46368
Project: 46368
Buggy source:
private void addTxItemOrdered(TxQueueItem txQueueItem){
  ListIterator<QueueItem> iterator=((List)getItemQueue()).listIterator();
  while (iterator.hasNext()) {
    QueueItem queueItem=iterator.next();
    if (txQueueItem.itemId < queueItem.itemId) {
      iterator.previous();
      break;
    }
  }
  iterator.add(txQueueItem);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void addTxItemOrdered(TxQueueItem txQueueItem){
  final ListIterator<QueueItem> iterator=((List<QueueItem>)getItemQueue()).listIterator();
  while (iterator.hasNext()) {
    final QueueItem queueItem=iterator.next();
    if (txQueueItem.itemId < queueItem.itemId) {
      iterator.previous();
      break;
    }
  }
  iterator.add(txQueueItem);
}
Program: 46369
Project: 46369
Buggy source:
public boolean hasEnoughCapacity(int delta){
  return (getItemQueue().size() + delta) <= config.getMaxSize();
}

Fixed version (ground truth):
/** 
 * Returns if this queue can accommodate for   {@code delta} items.
 * @param delta the number of items that should be stored in the queue
 * @return if the queue has enough capacity for the items
 */
public boolean hasEnoughCapacity(int delta){
  return (getItemQueue().size() + delta) <= config.getMaxSize();
}
Program: 46370
Project: 46370
Buggy source:
/** 
 * This method does not trigger store load.
 */
public boolean contains(Collection<Data> dataSet){
  for (  Data data : dataSet) {
    boolean contains=false;
    for (    QueueItem item : getItemQueue()) {
      if (item.getData() != null && item.getData().equals(data)) {
        contains=true;
        break;
      }
    }
    if (!contains) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the queue contains all items in the dataSet. This method does not trigger store load.
 * @param dataSet the items which should be stored in the queue
 * @return true if the queue contains all items, false otherwise
 */
public boolean contains(Collection<Data> dataSet){
  for (  Data data : dataSet) {
    boolean contains=false;
    for (    QueueItem item : getItemQueue()) {
      if (item.getData() != null && item.getData().equals(data)) {
        contains=true;
        break;
      }
    }
    if (!contains) {
      return false;
    }
  }
  return true;
}
Program: 46371
Project: 46371
Buggy source:
public Map<Long,Data> drain(int maxSize){
  int maxSizeParam=maxSize;
  if (maxSizeParam < 0 || maxSizeParam > getItemQueue().size()) {
    maxSizeParam=getItemQueue().size();
  }
  LinkedHashMap<Long,Data> map=new LinkedHashMap<Long,Data>(maxSizeParam);
  mapDrainIterator(maxSizeParam,map);
  if (store.isEnabled() && maxSizeParam != 0) {
    try {
      store.deleteAll(map.keySet());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  long current=Clock.currentTimeMillis();
  for (int i=0; i < maxSizeParam; i++) {
    QueueItem item=getItemQueue().poll();
    age(item,current);
  }
  if (maxSizeParam != 0) {
    scheduleEvictionIfEmpty();
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Removes items from the queue and the queue store (if configured), up to   {@code maxSize} or the size of the queue,whichever is smaller. Also schedules the queue for destruction if it is empty or destroys it immediately if it is empty and  {@link QueueConfig#getEmptyQueueTtl()} is 0.
 * @param maxSize the maximum number of items to be removed
 * @return the map of IDs and removed (drained) items
 */
public Map<Long,Data> drain(int maxSize){
  int maxSizeParam=maxSize;
  if (maxSizeParam < 0 || maxSizeParam > getItemQueue().size()) {
    maxSizeParam=getItemQueue().size();
  }
  final LinkedHashMap<Long,Data> map=new LinkedHashMap<Long,Data>(maxSizeParam);
  mapDrainIterator(maxSizeParam,map);
  if (store.isEnabled() && maxSizeParam != 0) {
    try {
      store.deleteAll(map.keySet());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  long current=Clock.currentTimeMillis();
  for (int i=0; i < maxSizeParam; i++) {
    final QueueItem item=getItemQueue().poll();
    age(item,current);
  }
  if (maxSizeParam != 0) {
    scheduleEvictionIfEmpty();
  }
  return map;
}
Program: 46372
Project: 46372
Buggy source:
/** 
 * Tries to load the data for the given queue item. The method will also try to load data in batches. To do so, it will check the item ID's in the item queue and load up to   {@link QueueStoreWrapper#getBulkLoad()} items. If the{@link QueueStoreWrapper#getBulkLoad()} is 1, it will just load data for the given item. Otherwise, it will load itemsfor other items in the queue too by collecting the IDs of the items in the queue sequentially. This method could mistakenly not load the data for the given parameter if it is located after the  {@link QueueStoreWrapper#getBulkLoad()}item in the queue.
 * @param item the item for which the data is being set
 * @throws Exception if there is any exception. For example, when calling methods on the queue store
 */
private void load(QueueItem item) throws Exception {
  int bulkLoad=store.getBulkLoad();
  bulkLoad=Math.min(getItemQueue().size(),bulkLoad);
  if (bulkLoad == 1) {
    item.setData(store.load(item.getItemId()));
  }
 else   if (bulkLoad > 1) {
    Iterator<QueueItem> iter=getItemQueue().iterator();
    HashSet<Long> keySet=new HashSet<Long>(bulkLoad);
    for (int i=0; i < bulkLoad; i++) {
      keySet.add(iter.next().getItemId());
    }
    Map<Long,Data> values=store.loadAll(keySet);
    dataMap.putAll(values);
    item.setData(getDataFromMap(item.getItemId()));
  }
}

Fixed version (ground truth):
/** 
 * Tries to load the data for the given queue item. The method will also try to load data in batches if configured to do so. <p> If the   {@link QueueStoreWrapper#getBulkLoad()} is 1, it will just load data for the given item. Otherwise, it willload items for other items in the queue too by collecting the IDs of the items in the queue sequentially up to {@link QueueStoreWrapper#getBulkLoad()} items. While doing so, it will make sure that the ID of the initially requesteditem is also being loaded even though it is not amongst the first  {@link QueueStoreWrapper#getBulkLoad()} items in thequeue.
 * @param item the item for which the data is being set
 * @throws Exception if there is any exception. For example, when calling methods on the queue store
 */
private void load(QueueItem item) throws Exception {
  int bulkLoad=store.getBulkLoad();
  bulkLoad=Math.min(getItemQueue().size(),bulkLoad);
  if (bulkLoad == 1) {
    item.setData(store.load(item.getItemId()));
  }
 else   if (bulkLoad > 1) {
    final Iterator<QueueItem> iter=getItemQueue().iterator();
    final HashSet<Long> keySet=new HashSet<Long>(bulkLoad);
    keySet.add(item.getItemId());
    while (keySet.size() < bulkLoad) {
      keySet.add(iter.next().getItemId());
    }
    final Map<Long,Data> values=store.loadAll(keySet);
    dataMap.putAll(values);
    item.setData(getDataFromMap(item.getItemId()));
  }
}
Program: 46373
Project: 46373
Buggy source:
private void scheduleEvictionIfEmpty(){
  final int emptyQueueTtl=config.getEmptyQueueTtl();
  if (emptyQueueTtl < 0) {
    return;
  }
  if (getItemQueue().isEmpty() && txMap.isEmpty() && !isEvictionScheduled) {
    if (emptyQueueTtl == 0) {
      nodeEngine.getProxyService().destroyDistributedObject(QueueService.SERVICE_NAME,name);
    }
 else     if (emptyQueueTtl > 0) {
      service.scheduleEviction(name,TimeUnit.SECONDS.toMillis(emptyQueueTtl));
      isEvictionScheduled=true;
    }
  }
}

Fixed version (ground truth):
/** 
 * Schedules the queue for destruction if the queue is empty. Destroys the queue immediately the queue is empty and the  {@link QueueConfig#getEmptyQueueTtl()} is 0. Upon scheduled execution, the queue will be checked if it is still empty.
 */
private void scheduleEvictionIfEmpty(){
  final int emptyQueueTtl=config.getEmptyQueueTtl();
  if (emptyQueueTtl < 0) {
    return;
  }
  if (getItemQueue().isEmpty() && txMap.isEmpty() && !isEvictionScheduled) {
    if (emptyQueueTtl == 0) {
      nodeEngine.getProxyService().destroyDistributedObject(QueueService.SERVICE_NAME,name);
    }
 else     if (emptyQueueTtl > 0) {
      service.scheduleEviction(name,TimeUnit.SECONDS.toMillis(emptyQueueTtl));
      isEvictionScheduled=true;
    }
  }
}
Program: 46374
Project: 46374
Buggy source:
public QueueItem peek(){
  QueueItem item=getItemQueue().peek();
  if (item == null) {
    return null;
  }
  if (store.isEnabled() && item.getData() == null) {
    try {
      load(item);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  return item;
}

Fixed version (ground truth):
/** 
 * Retrieves, but does not remove, the head of this queue, or returns   {@code null} if this queue is empty.Loads the data from the queue store if the item data is empty.
 * @return the first item in the queue
 */
public QueueItem peek(){
  final QueueItem item=getItemQueue().peek();
  if (item == null) {
    return null;
  }
  if (store.isEnabled() && item.getData() == null) {
    try {
      load(item);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  return item;
}
Program: 46375
Project: 46375
Buggy source:
public void mapIterateAndRemove(Map map){
  if (map.size() <= 0) {
    return;
  }
  if (store.isEnabled()) {
    try {
      store.deleteAll(map.keySet());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  Iterator<QueueItem> iter=getItemQueue().iterator();
  while (iter.hasNext()) {
    QueueItem item=iter.next();
    if (map.containsKey(item.getItemId())) {
      iter.remove();
      age(item,Clock.currentTimeMillis());
    }
  }
  scheduleEvictionIfEmpty();
}

Fixed version (ground truth):
/** 
 * Deletes items from the queue which have IDs contained in the key set of the given map. Also schedules the queue for destruction if it is empty or destroys it immediately if it is empty and   {@link QueueConfig#getEmptyQueueTtl()} is 0.
 * @param map the map of items which to be removed.
 */
public void mapIterateAndRemove(Map<Long,Data> map){
  if (map.size() <= 0) {
    return;
  }
  if (store.isEnabled()) {
    try {
      store.deleteAll(map.keySet());
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  final Iterator<QueueItem> iter=getItemQueue().iterator();
  while (iter.hasNext()) {
    final QueueItem item=iter.next();
    if (map.containsKey(item.getItemId())) {
      iter.remove();
      age(item,Clock.currentTimeMillis());
    }
  }
  scheduleEvictionIfEmpty();
}
Program: 46376
Project: 46376
Buggy source:
public Map<Long,Data> addAll(Collection<Data> dataList){
  Map<Long,Data> map=new HashMap<Long,Data>(dataList.size());
  List<QueueItem> list=new ArrayList<QueueItem>(dataList.size());
  for (  Data data : dataList) {
    QueueItem item=new QueueItem(this,nextId(),null);
    if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
      item.setData(data);
    }
    map.put(item.getItemId(),data);
    list.add(item);
  }
  if (store.isEnabled() && !map.isEmpty()) {
    try {
      store.storeAll(map);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  if (!list.isEmpty()) {
    getItemQueue().addAll(list);
    cancelEvictionIfExists();
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Adds all items from the   {@code dataList} to the queue. The data will be stored in the queue store if configured andenabled. If the store is enabled, only  {@link QueueStoreWrapper#getMemoryLimit()} item data will be stored in memory.Cancels the eviction if one is scheduled.
 * @param dataList the items to be added to the queue and stored in the queue store
 * @return map of item ID and items added
 */
public Map<Long,Data> addAll(Collection<Data> dataList){
  final Map<Long,Data> map=new HashMap<Long,Data>(dataList.size());
  final List<QueueItem> list=new ArrayList<QueueItem>(dataList.size());
  for (  Data data : dataList) {
    final QueueItem item=new QueueItem(this,nextId(),null);
    if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
      item.setData(data);
    }
    map.put(item.getItemId(),data);
    list.add(item);
  }
  if (store.isEnabled() && !map.isEmpty()) {
    try {
      store.storeAll(map);
    }
 catch (    Exception e) {
      throw new HazelcastException(e);
    }
  }
  if (!list.isEmpty()) {
    getItemQueue().addAll(list);
    cancelEvictionIfExists();
  }
  return map;
}
Program: 46377
Project: 46377
Buggy source:
/** 
 * This method triggers store load
 */
public Map<Long,Data> compareAndRemove(Collection<Data> dataList,boolean retain){
  LinkedHashMap<Long,Data> map=new LinkedHashMap<Long,Data>();
  for (  QueueItem item : getItemQueue()) {
    if (item.getData() == null && store.isEnabled()) {
      try {
        load(item);
      }
 catch (      Exception e) {
        throw new HazelcastException(e);
      }
    }
    boolean contains=dataList.contains(item.getData());
    if ((retain && !contains) || (!retain && contains)) {
      map.put(item.getItemId(),item.getData());
    }
  }
  mapIterateAndRemove(map);
  return map;
}

Fixed version (ground truth):
/** 
 * Compares if the queue contains the items in the dataList and removes them according to the retain parameter. If the retain parameter is true, it will remove items which are not in the dataList (retaining the items which are in the list). If the retain parameter is false, it will remove items which are in the dataList (retaining all other items which are not in the list). Note : this method will trigger store load.
 * @param dataList the list of items which are to be retained in the queue or which are to be removed from the queue
 * @param retain does the method retain the items in the list (true) or remove them from the queue (false)
 * @return map of removed items by id
 */
public Map<Long,Data> compareAndRemove(Collection<Data> dataList,boolean retain){
  final LinkedHashMap<Long,Data> map=new LinkedHashMap<Long,Data>();
  for (  QueueItem item : getItemQueue()) {
    if (item.getData() == null && store.isEnabled()) {
      try {
        load(item);
      }
 catch (      Exception e) {
        throw new HazelcastException(e);
      }
    }
    boolean contains=dataList.contains(item.getData());
    if ((retain && !contains) || (!retain && contains)) {
      map.put(item.getItemId(),item.getData());
    }
  }
  mapIterateAndRemove(map);
  return map;
}
Program: 46378
Project: 46378
Buggy source:
/** 
 * This method triggers store load.
 */
public List<Data> getAsDataList(){
  List<Data> dataList=new ArrayList<Data>(getItemQueue().size());
  for (  QueueItem item : getItemQueue()) {
    if (store.isEnabled() && item.getData() == null) {
      try {
        load(item);
      }
 catch (      Exception e) {
        throw new HazelcastException(e);
      }
    }
    dataList.add(item.getData());
  }
  return dataList;
}

Fixed version (ground truth):
/** 
 * Returns data in the queue. This method triggers store load.
 * @return the item data in the queue.
 */
public List<Data> getAsDataList(){
  final List<Data> dataList=new ArrayList<Data>(getItemQueue().size());
  for (  QueueItem item : getItemQueue()) {
    if (store.isEnabled() && item.getData() == null) {
      try {
        load(item);
      }
 catch (      Exception e) {
        throw new HazelcastException(e);
      }
    }
    dataList.add(item.getData());
  }
  return dataList;
}
Program: 46379
Project: 46379
Buggy source:
@Override public void close(){
  ioThread.addTaskAndWakeup(new Runnable(){
    @Override public void run(){
      try {
        socketChannel.closeInbound();
      }
 catch (      IOException e) {
        logger.finest("String_Node_Str",e);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void close(){
  ioThread.addTaskAndWakeup(new Runnable(){
    @Override public void run(){
      if (ioThread != Thread.currentThread()) {
        ioThread.addTaskAndWakeup(this);
        return;
      }
      try {
        socketChannel.closeInbound();
      }
 catch (      IOException e) {
        logger.finest("String_Node_Str",e);
      }
    }
  }
);
}
Program: 46380
Project: 46380
Buggy source:
@Override public Connection getOrConnect(Address address,boolean asOwner) throws IOException {
  try {
    while (true) {
      Connection connection=getConnection(address,asOwner);
      if (connection != null) {
        return connection;
      }
      AuthenticationFuture firstCallback=triggerConnect(address,asOwner);
      connection=firstCallback.get(connectionTimeout);
      if (!asOwner) {
        return connection;
      }
      if (firstCallback.authenticatedAsOwner) {
        return connection;
      }
    }
  }
 catch (  Throwable e) {
    throw ExceptionUtil.rethrow(e);
  }
}

Fixed version (ground truth):
@Override public Connection getOrConnect(Address address,boolean asOwner) throws IOException {
  try {
    while (true) {
      Connection connection=getConnection(address,asOwner);
      if (connection != null) {
        return connection;
      }
      AuthenticationFuture firstCallback=triggerConnect(addressTranslator.translate(address),asOwner);
      connection=firstCallback.get(connectionTimeout);
      if (!asOwner) {
        return connection;
      }
      if (firstCallback.authenticatedAsOwner) {
        return connection;
      }
    }
  }
 catch (  Throwable e) {
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 46381
Project: 46381
Buggy source:
private Map<String,String> getLookupTable(){
  Map<String,String> table=privateToPublic;
  return table != null ? table : Collections.<String,String>emptyMap();
}

Fixed version (ground truth):
private Map<String,String> getLookupTable(){
  return privateToPublic;
}
Program: 46382
Project: 46382
Buggy source:
/** 
 * @param address
 * @return public address of network whose private address is given, if addressnot founds returns null.
 */
public Address translate(Address address){
  if (isInsideAws) {
    return address;
  }
  if (address == null) {
    return null;
  }
  String publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  refresh();
  publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param address
 * @return public address of network whose private address is given, if addressnot founds returns null.
 */
public Address translate(Address address){
  if (isInsideAws) {
    return address;
  }
  if (address == null) {
    return null;
  }
  String publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  if (privateToPublic.values().contains(address.getHost())) {
    return address;
  }
  refresh();
  publicAddress=getLookupTable().get(address.getHost());
  if (publicAddress != null) {
    return constructPrivateAddress(publicAddress,address);
  }
  return null;
}
Program: 46383
Project: 46383
Buggy source:
@Test public void testConnection(){
  HazelcastInstance instance=hzFactory.newHazelcastClient();
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      clean();
      plugin.run(logWriter);
      assertContains("String_Node_Str");
    }
  }
);
  instance.shutdown();
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      clean();
      plugin.run(logWriter);
      assertContains("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
@Test public void testConnection(){
  HazelcastInstance instance=hzFactory.newHazelcastClient();
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      plugin.run(logWriter);
      assertContains("String_Node_Str");
    }
  }
);
  instance.shutdown();
  assertTrueEventually(new AssertTask(){
    @Override public void run() throws Exception {
      plugin.run(logWriter);
      assertContains("String_Node_Str");
    }
  }
);
}
Program: 46384
Project: 46384
Buggy source:
@Before public void setUp(){
  setLoggingLog4j();
  Config config=new Config();
  config.setProperty(LOG_PARTITIONS.getName(),"String_Node_Str");
  hzFactory=new TestHazelcastFactory();
  HazelcastInstance hz=hzFactory.newHazelcastInstance(config);
  plugin=new SystemLogPlugin(getNodeEngineImpl(hz));
  plugin.onStart();
}

Fixed version (ground truth):
@Before public void setUp(){
  Config config=new Config();
  config.setProperty(LOG_PARTITIONS.getName(),"String_Node_Str");
  hzFactory=new TestHazelcastFactory();
  HazelcastInstance hz=hzFactory.newHazelcastInstance(config);
  plugin=new SystemLogPlugin(getNodeEngineImpl(hz));
  plugin.onStart();
}
Program: 46385
Project: 46385
Buggy source:
@Override public void run() throws Exception {
  clean();
  plugin.run(logWriter);
  assertContains("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  plugin.run(logWriter);
  assertContains("String_Node_Str");
}
Program: 46386
Project: 46386
Buggy source:
private void renderPlugin(DiagnosticsPlugin plugin) throws IOException {
  logWriter.clean();
  plugin.run(logWriter);
  int desiredLength=charBuff.length;
  int actualSize=logWriter.length();
  while (desiredLength < actualSize) {
    desiredLength*=2;
  }
  if (desiredLength != charBuff.length) {
    charBuff=new char[desiredLength];
  }
  logWriter.copyInto(charBuff);
  bufferedWriter.write(charBuff,0,actualSize);
  fileLength+=actualSize;
}

Fixed version (ground truth):
private void renderPlugin(DiagnosticsPlugin plugin) throws IOException {
  logWriter.init(printWriter);
  plugin.run(logWriter);
}