nus-yam/ex-repair huggingface dataset:
Program: 46738
Project: 46738
Buggy source:
@Override public void readData(ObjectDataInput in) throws IOException {
  int jvmCount=in.readInt();
  for (int i=0; i < jvmCount; i++) {
    jvmIds.add(in.readUTF());
  }
  int attCount=in.readInt();
  for (int i=0; i < attCount; i++) {
    attributes.put(in.readUTF(),in.readData());
  }
}

Fixed version (ground truth):
@Override public void readData(ObjectDataInput in) throws IOException {
  int attCount=in.readInt();
  for (int i=0; i < attCount; i++) {
    attributes.put(in.readUTF(),in.readData());
  }
}
Program: 46739
Project: 46739
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append("String_Node_Str" + jvmIds.size());
  sb.append("String_Node_Str" + ((attributes == null) ? 0 : attributes.size()));
  if (attributes != null) {
    for (    Map.Entry<String,Data> entry : attributes.entrySet()) {
      Data data=entry.getValue();
      int len=(data == null) ? 0 : data.dataSize();
      sb.append("String_Node_Str");
      sb.append(entry.getKey() + "String_Node_Str" + len+ "String_Node_Str");
    }
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append("String_Node_Str" + ((attributes == null) ? 0 : attributes.size()));
  if (attributes != null) {
    for (    Map.Entry<String,Data> entry : attributes.entrySet()) {
      Data data=entry.getValue();
      int len=(data == null) ? 0 : data.dataSize();
      sb.append("String_Node_Str");
      sb.append(entry.getKey() + "String_Node_Str" + len+ "String_Node_Str");
    }
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 46740
Project: 46740
Buggy source:
@Override public void writeData(ObjectDataOutput out) throws IOException {
  out.writeInt(jvmIds.size());
  for (  String jvmId : jvmIds) {
    out.writeUTF(jvmId);
  }
  out.writeInt(attributes.size());
  for (  Map.Entry<String,Data> entry : attributes.entrySet()) {
    out.writeUTF(entry.getKey());
    out.writeData(entry.getValue());
  }
}

Fixed version (ground truth):
@Override public void writeData(ObjectDataOutput out) throws IOException {
  out.writeInt(attributes.size());
  for (  Map.Entry<String,Data> entry : attributes.entrySet()) {
    out.writeUTF(entry.getKey());
    out.writeData(entry.getValue());
  }
}
Program: 46741
Project: 46741
Buggy source:
public final void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      LOGGER.finest("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.clusteredSessionId);
    }
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null) {
      return;
    }
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      if (LOGGER.isFinestEnabled()) {
        LOGGER.finest("String_Node_Str" + session.getId());
      }
      if (deferredWrite) {
        session.sessionDeferredWrite();
      }
    }
  }
}

Fixed version (ground truth):
@Override public final void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      LOGGER.finest("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.clusteredSessionId);
    }
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null) {
      return;
    }
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      if (LOGGER.isFinestEnabled()) {
        LOGGER.finest("String_Node_Str" + session.getId());
      }
      if (deferredWrite) {
        session.sessionDeferredWrite();
      }
    }
  }
}
Program: 46742
Project: 46742
Buggy source:
private void addSessionCookie(final RequestWrapper req,final String sessionId){
  final Cookie sessionCookie=new Cookie(sessionCookieName,sessionId);
  String path=req.getContextPath();
  if ("String_Node_Str".equals(path)) {
    path="String_Node_Str";
  }
  sessionCookie.setPath(path);
  sessionCookie.setMaxAge(-1);
  if (sessionCookieDomain != null) {
    sessionCookie.setDomain(sessionCookieDomain);
  }
  if (sessionCookieHttpOnly) {
    try {
      sessionCookie.setHttpOnly(true);
    }
 catch (    NoSuchMethodError e) {
      LOGGER.info("String_Node_Str" + getClass().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
  }
  sessionCookie.setSecure(sessionCookieSecure || req.isSecure());
  req.res.addCookie(sessionCookie);
}

Fixed version (ground truth):
private void addSessionCookie(final RequestWrapper req,final String sessionId){
  final Cookie sessionCookie=new Cookie(sessionCookieName,sessionId);
  String path=req.getContextPath();
  if ("String_Node_Str".equals(path)) {
    path="String_Node_Str";
  }
  sessionCookie.setPath(path);
  sessionCookie.setMaxAge(-1);
  if (sessionCookieDomain != null) {
    sessionCookie.setDomain(sessionCookieDomain);
  }
  if (sessionCookieHttpOnly) {
    try {
      sessionCookie.setHttpOnly(true);
    }
 catch (    NoSuchMethodError e) {
      LOGGER.info("String_Node_Str" + getClass().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
  }
  sessionCookie.setSecure(sessionCookieSecure);
  req.res.addCookie(sessionCookie);
}
Program: 46743
Project: 46743
Buggy source:
private void loadProperties() throws ServletException {
  if (properties == null) {
    properties=new Properties();
  }
  setProperty(HazelcastInstanceLoader.CONFIG_LOCATION);
  setProperty(HazelcastInstanceLoader.INSTANCE_NAME);
  setProperty(HazelcastInstanceLoader.USE_CLIENT);
  setProperty(HazelcastInstanceLoader.CLIENT_CONFIG_LOCATION);
  setProperty(HazelcastInstanceLoader.STICKY_SESSION_CONFIG);
}

Fixed version (ground truth):
private void loadProperties() throws ServletException {
  if (properties == null) {
    properties=new Properties();
  }
  setProperty(HazelcastInstanceLoader.CONFIG_LOCATION);
  setProperty(HazelcastInstanceLoader.INSTANCE_NAME);
  setProperty(HazelcastInstanceLoader.USE_CLIENT);
  setProperty(HazelcastInstanceLoader.CLIENT_CONFIG_LOCATION);
  setProperty(HazelcastInstanceLoader.STICKY_SESSION_CONFIG);
  setProperty(HazelcastInstanceLoader.SESSION_TTL_CONFIG);
}
Program: 46744
Project: 46744
Buggy source:
public final void init(final FilterConfig config) throws ServletException {
  filterConfig=config;
  servletContext=config.getServletContext();
  servletContext.setAttribute(WEB_FILTER_ATTRIBUTE_KEY,this);
  loadProperties();
  initCookieParams();
  initParams();
  String mapName=getParam("String_Node_Str");
  if (mapName == null) {
    mapName="String_Node_Str" + servletContext.getServletContextName();
  }
  clusteredSessionService=new ClusteredSessionService(filterConfig,properties,mapName);
  if (LOGGER.isLoggable(Level.FINEST)) {
    LOGGER.finest("String_Node_Str" + stickySession + "String_Node_Str"+ shutdownOnDestroy+ "String_Node_Str"+ mapName);
  }
}

Fixed version (ground truth):
@Override public final void init(final FilterConfig config) throws ServletException {
  filterConfig=config;
  servletContext=config.getServletContext();
  servletContext.setAttribute(WEB_FILTER_ATTRIBUTE_KEY,this);
  loadProperties();
  initCookieParams();
  initParams();
  String mapName=getParam("String_Node_Str");
  if (mapName == null) {
    mapName="String_Node_Str" + servletContext.getServletContextName();
  }
  clusteredSessionService=new ClusteredSessionService(filterConfig,properties,mapName);
  if (LOGGER.isLoggable(Level.FINEST)) {
    LOGGER.finest("String_Node_Str" + stickySession + "String_Node_Str"+ shutdownOnDestroy+ "String_Node_Str"+ mapName);
  }
}
Program: 46745
Project: 46745
Buggy source:
public final void destroy(){
  sessions.clear();
  originalSessions.clear();
  if (shutdownOnDestroy) {
    clusteredSessionService.destroy();
  }
}

Fixed version (ground truth):
@Override public final void destroy(){
  sessions.clear();
  originalSessions.clear();
  if (shutdownOnDestroy) {
    clusteredSessionService.destroy();
  }
}
Program: 46746
Project: 46746
Buggy source:
public ClientInvocationServiceSupport(HazelcastClientInstanceImpl client){
  this.client=client;
  int maxAllowedConcurrentInvocations=client.getClientProperties().getInteger(MAX_CONCURRENT_INVOCATIONS);
  callIdSequence=new CallIdSequence.CallIdSequenceWithBackpressureViaException(maxAllowedConcurrentInvocations);
}

Fixed version (ground truth):
public ClientInvocationServiceSupport(HazelcastClientInstanceImpl client){
  this.client=client;
  int maxAllowedConcurrentInvocations=client.getClientProperties().getInteger(MAX_CONCURRENT_INVOCATIONS);
  callIdSequence=new CallIdSequence.CallIdSequenceFailFast(maxAllowedConcurrentInvocations);
}
Program: 46748
Project: 46748
Buggy source:
public EventServiceImpl(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.serializationService=nodeEngine.getSerializationService();
  this.logger=nodeEngine.getLogger(EventService.class.getName());
  final Node node=nodeEngine.getNode();
  GroupProperties groupProperties=node.getGroupProperties();
  this.eventThreadCount=groupProperties.getInteger(GroupProperty.EVENT_THREAD_COUNT);
  this.eventQueueCapacity=groupProperties.getInteger(GroupProperty.EVENT_QUEUE_CAPACITY);
  this.eventQueueTimeoutMs=groupProperties.getMillis(GroupProperty.EVENT_QUEUE_TIMEOUT_MILLIS);
  final String eventSyncFrequencyProp=System.getProperty(EVENT_SYNC_FREQUENCY_PROP);
  int eventSyncFrequency;
  try {
    eventSyncFrequency=Integer.valueOf(eventSyncFrequencyProp);
  }
 catch (  Exception e) {
    eventSyncFrequency=EVENT_SYNC_FREQUENCY;
  }
  this.eventSyncFrequency=eventSyncFrequency;
  HazelcastThreadGroup threadGroup=node.getHazelcastThreadGroup();
  this.eventExecutor=new StripedExecutor(node.getLogger(EventServiceImpl.class),threadGroup.getThreadNamePrefix("String_Node_Str"),threadGroup.getInternalThreadGroup(),eventThreadCount,eventQueueCapacity);
  this.registrationExceptionHandler=new FutureUtilExceptionHandler(logger,"String_Node_Str");
  this.deregistrationExceptionHandler=new FutureUtilExceptionHandler(logger,"String_Node_Str");
  this.segments=new ConcurrentHashMap<String,EventServiceSegment>();
  nodeEngine.getMetricsRegistry().scanAndRegister(this,"String_Node_Str");
}

Fixed version (ground truth):
public EventServiceImpl(NodeEngineImpl nodeEngine){
  this.nodeEngine=nodeEngine;
  this.serializationService=nodeEngine.getSerializationService();
  this.logger=nodeEngine.getLogger(EventService.class.getName());
  final Node node=nodeEngine.getNode();
  GroupProperties groupProperties=node.getGroupProperties();
  this.eventThreadCount=groupProperties.getInteger(GroupProperty.EVENT_THREAD_COUNT);
  this.eventQueueCapacity=groupProperties.getInteger(GroupProperty.EVENT_QUEUE_CAPACITY);
  this.eventQueueTimeoutMs=groupProperties.getMillis(GroupProperty.EVENT_QUEUE_TIMEOUT_MILLIS);
  final String eventSyncFrequencyProp=System.getProperty(EVENT_SYNC_FREQUENCY_PROP);
  int eventSyncFrequency;
  try {
    eventSyncFrequency=Integer.parseInt(eventSyncFrequencyProp);
    if (eventSyncFrequency <= 0) {
      eventSyncFrequency=EVENT_SYNC_FREQUENCY;
    }
  }
 catch (  Exception e) {
    eventSyncFrequency=EVENT_SYNC_FREQUENCY;
  }
  this.eventSyncFrequency=eventSyncFrequency;
  HazelcastThreadGroup threadGroup=node.getHazelcastThreadGroup();
  this.eventExecutor=new StripedExecutor(node.getLogger(EventServiceImpl.class),threadGroup.getThreadNamePrefix("String_Node_Str"),threadGroup.getInternalThreadGroup(),eventThreadCount,eventQueueCapacity);
  this.registrationExceptionHandler=new FutureUtilExceptionHandler(logger,"String_Node_Str");
  this.deregistrationExceptionHandler=new FutureUtilExceptionHandler(logger,"String_Node_Str");
  this.segments=new ConcurrentHashMap<String,EventServiceSegment>();
  nodeEngine.getMetricsRegistry().scanAndRegister(this,"String_Node_Str");
}
Program: 46749
Project: 46749
Buggy source:
public ClientInvocationServiceSupport(HazelcastClientInstanceImpl client){
  this.client=client;
  int maxAllowedConcurrentInvocations=client.getClientProperties().getInteger(MAX_CONCURRENT_INVOCATIONS);
  callIdSequence=new CallIdSequence.CallIdSequenceWithBackpressureViaException(maxAllowedConcurrentInvocations);
}

Fixed version (ground truth):
public ClientInvocationServiceSupport(HazelcastClientInstanceImpl client){
  this.client=client;
  int maxAllowedConcurrentInvocations=client.getClientProperties().getInteger(MAX_CONCURRENT_INVOCATIONS);
  callIdSequence=new CallIdSequence.CallIdSequenceFailFast(maxAllowedConcurrentInvocations);
}
Program: 46750
Project: 46750
Buggy source:
private LoadFinishedFuture(){
  super((Executor)null,null);
}

Fixed version (ground truth):
private LoadFinishedFuture(){
  super((Executor)null,getLogger(LoadFinishedFuture.class));
}
Program: 46753
Project: 46753
Buggy source:
@Override public void memberRemoved(MembershipEvent membershipEvent){
  latch.countDown();
}

Fixed version (ground truth):
@Override public void memberRemoved(MembershipEvent membershipEvent){
  memberRemovedLatch.countDown();
}
Program: 46754
Project: 46754
Buggy source:
TestLifeCycleListener(int countdown){
  latch=new CountDownLatch(countdown);
}

Fixed version (ground truth):
TestLifeCycleListener(int countdown,CountDownLatch mergeBlockingLatch){
  this.mergeFinishedLatch=new CountDownLatch(countdown);
  this.mergeBlockingLatch=mergeBlockingLatch;
}
Program: 46758
Project: 46758
Buggy source:
@Override public void stateChanged(LifecycleEvent event){
  if (event.getState() == LifecycleEvent.LifecycleState.MERGED) {
    latch.countDown();
  }
}

Fixed version (ground truth):
@Override public void stateChanged(LifecycleEvent event){
  if (event.getState() == LifecycleEvent.LifecycleState.MERGING) {
    try {
      mergeBlockingLatch.await(30,TimeUnit.SECONDS);
    }
 catch (    InterruptedException e) {
      ExceptionUtil.rethrow(e);
    }
  }
 else   if (event.getState() == LifecycleEvent.LifecycleState.MERGED) {
    mergeFinishedLatch.countDown();
  }
}
Program: 46759
Project: 46759
Buggy source:
TestMemberShipListener(int countdown){
  latch=new CountDownLatch(countdown);
}

Fixed version (ground truth):
TestMemberShipListener(int countdown){
  memberRemovedLatch=new CountDownLatch(countdown);
}
Program: 46760
Project: 46760
Buggy source:
@Override public void setStringAttribute(String key,String value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setStringAttribute(String key,String value){
  throw notSupportedOnClient();
}
Program: 46761
Project: 46761
Buggy source:
@Override public void setFloatAttribute(String key,float value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setFloatAttribute(String key,float value){
  throw notSupportedOnClient();
}
Program: 46762
Project: 46762
Buggy source:
@SuppressFBWarnings(value="String_Node_Str",justification="String_Node_Str") @Override public Boolean getBooleanAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Boolean.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@SuppressFBWarnings(value="String_Node_Str",justification="String_Node_Str") @Override public Boolean getBooleanAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Boolean.valueOf(attribute.toString()) : null;
}
Program: 46763
Project: 46763
Buggy source:
@Override public void setDoubleAttribute(String key,double value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setDoubleAttribute(String key,double value){
  throw notSupportedOnClient();
}
Program: 46764
Project: 46764
Buggy source:
@Override public Short getShortAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Short.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Short getShortAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Short.valueOf(attribute.toString()) : null;
}
Program: 46765
Project: 46765
Buggy source:
@Override public Double getDoubleAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Double.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Double getDoubleAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Double.valueOf(attribute.toString()) : null;
}
Program: 46766
Project: 46766
Buggy source:
private void notSupportedOnClient(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
private UnsupportedOperationException notSupportedOnClient(){
  return new UnsupportedOperationException("String_Node_Str");
}
Program: 46767
Project: 46767
Buggy source:
@Override public void setShortAttribute(String key,short value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setShortAttribute(String key,short value){
  throw notSupportedOnClient();
}
Program: 46768
Project: 46768
Buggy source:
@Override public Byte getByteAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Byte.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Byte getByteAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Byte.valueOf(attribute.toString()) : null;
}
Program: 46769
Project: 46769
Buggy source:
@Override public void setBooleanAttribute(String key,boolean value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setBooleanAttribute(String key,boolean value){
  throw notSupportedOnClient();
}
Program: 46770
Project: 46770
Buggy source:
@Override public void setLongAttribute(String key,long value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setLongAttribute(String key,long value){
  throw notSupportedOnClient();
}
Program: 46771
Project: 46771
Buggy source:
@Override public void setIntAttribute(String key,int value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setIntAttribute(String key,int value){
  throw notSupportedOnClient();
}
Program: 46772
Project: 46772
Buggy source:
@Override public Long getLongAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Long.getLong(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Long getLongAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Long.valueOf(attribute.toString()) : null;
}
Program: 46773
Project: 46773
Buggy source:
@Override public Integer getIntAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Integer.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Integer getIntAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Integer.valueOf(attribute.toString()) : null;
}
Program: 46774
Project: 46774
Buggy source:
@Override public void setByteAttribute(String key,byte value){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void setByteAttribute(String key,byte value){
  throw notSupportedOnClient();
}
Program: 46775
Project: 46775
Buggy source:
@Override public Float getFloatAttribute(String key){
  final Object attribute=getAttribute(key);
  return attribute != null ? Float.valueOf(attribute.toString()) : null;
}

Fixed version (ground truth):
@Override public Float getFloatAttribute(String key){
  Object attribute=getAttribute(key);
  return attribute != null ? Float.valueOf(attribute.toString()) : null;
}
Program: 46776
Project: 46776
Buggy source:
@Override public void removeAttribute(String key){
  notSupportedOnClient();
}

Fixed version (ground truth):
@Override public void removeAttribute(String key){
  throw notSupportedOnClient();
}
Program: 46777
Project: 46777
Buggy source:
public static byte[] compress(byte[] input) throws IOException {
  Deflater compressor=new Deflater();
  compressor.setLevel(Deflater.BEST_SPEED);
  compressor.setInput(input);
  compressor.finish();
  ByteArrayOutputStream bos=new ByteArrayOutputStream(input.length / 10);
  byte[] buf=new byte[input.length / 10];
  while (!compressor.finished()) {
    int count=compressor.deflate(buf);
    bos.write(buf,0,count);
  }
  bos.close();
  compressor.end();
  return bos.toByteArray();
}

Fixed version (ground truth):
public static byte[] compress(byte[] input) throws IOException {
  if (input.length == 0) {
    return new byte[0];
  }
  Deflater compressor=new Deflater();
  compressor.setLevel(Deflater.BEST_SPEED);
  compressor.setInput(input);
  compressor.finish();
  ByteArrayOutputStream bos=new ByteArrayOutputStream(input.length / 10);
  byte[] buf=new byte[input.length / 10];
  while (!compressor.finished()) {
    int count=compressor.deflate(buf);
    bos.write(buf,0,count);
  }
  bos.close();
  compressor.end();
  return bos.toByteArray();
}
Program: 46778
Project: 46778
Buggy source:
/** 
 * This method has a direct dependency on how objects are serialized in  {@link com.hazelcast.nio.serialization.DataSerializer}! If the stream format is ever changed this extraction method needs to be changed too!
 */
public static long extractOperationCallId(Data data,SerializationService serializationService) throws IOException {
  ObjectDataInput input=serializationService.createObjectDataInput(data);
  boolean identified=input.readBoolean();
  if (identified) {
    input.readInt();
    input.readInt();
  }
 else {
    input.readUTF();
  }
  return input.readLong();
}

Fixed version (ground truth):
/** 
 * This method has a direct dependency on how objects are serialized in  {@link com.hazelcast.internal.serialization.impl.DataSerializer}! If the stream format is ever changed this extraction method needs to be changed too!
 */
public static long extractOperationCallId(Data data,SerializationService serializationService) throws IOException {
  ObjectDataInput input=serializationService.createObjectDataInput(data);
  boolean identified=input.readBoolean();
  if (identified) {
    input.readInt();
    input.readInt();
  }
 else {
    input.readUTF();
  }
  return input.readLong();
}
Program: 46779
Project: 46779
Buggy source:
/** 
 * Closes the Closable quietly. So no exception will be thrown. Can also safely be called with a null value.
 * @param closeable the Closeable to close.
 */
public static void closeResource(final Closeable closeable){
  if (closeable != null) {
    try {
      closeable.close();
    }
 catch (    IOException e) {
      Logger.getLogger(IOUtil.class).finest("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Closes the Closable quietly. So no exception will be thrown. Can also safely be called with a null value.
 * @param closeable the Closeable to close.
 */
public static void closeResource(Closeable closeable){
  if (closeable != null) {
    try {
      closeable.close();
    }
 catch (    IOException e) {
      Logger.getLogger(IOUtil.class).finest("String_Node_Str",e);
    }
  }
}
Program: 46780
Project: 46780
Buggy source:
public static ObjectInputStream newObjectInputStream(final ClassLoader classLoader,final InputStream in) throws IOException {
  return new ObjectInputStream(in){
    protected Class<?> resolveClass(    final ObjectStreamClass desc) throws ClassNotFoundException {
      return ClassLoaderUtil.loadClass(classLoader,desc.getName());
    }
  }
;
}

Fixed version (ground truth):
public static ObjectInputStream newObjectInputStream(final ClassLoader classLoader,InputStream in) throws IOException {
  return new ObjectInputStream(in){
    protected Class<?> resolveClass(    ObjectStreamClass desc) throws ClassNotFoundException {
      return ClassLoaderUtil.loadClass(classLoader,desc.getName());
    }
  }
;
}
Program: 46781
Project: 46781
Buggy source:
/** 
 * Ensures that the file described by the supplied parameter does not exist after the method returns. If the file didn't exist, returns silently. If the file could not be deleted, fails with an exception. If the file is a directory, its children are recursively deleted.
 */
public static void delete(File f){
  if (!f.exists()) {
    return;
  }
  final File[] subFiles=f.listFiles();
  if (subFiles != null) {
    for (    File sf : subFiles) {
      delete(sf);
    }
  }
  if (!f.delete()) {
    throw new HazelcastException("String_Node_Str" + f);
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the file described by the supplied parameter does not exist after the method returns. If the file didn't exist, returns silently. If the file could not be deleted, fails with an exception. If the file is a directory, its children are recursively deleted.
 */
public static void delete(File f){
  if (!f.exists()) {
    return;
  }
  File[] subFiles=f.listFiles();
  if (subFiles != null) {
    for (    File sf : subFiles) {
      delete(sf);
    }
  }
  if (!f.delete()) {
    throw new HazelcastException("String_Node_Str" + f);
  }
}
Program: 46782
Project: 46782
Buggy source:
public static <T>T readObject(ObjectDataInput in) throws IOException {
  boolean isBinary=in.readBoolean();
  if (isBinary) {
    return (T)in.readData();
  }
  return in.readObject();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <T>T readObject(ObjectDataInput in) throws IOException {
  boolean isBinary=in.readBoolean();
  if (isBinary) {
    return (T)in.readData();
  }
  return in.readObject();
}
Program: 46783
Project: 46783
Buggy source:
protected Class<?> resolveClass(final ObjectStreamClass desc) throws ClassNotFoundException {
  return ClassLoaderUtil.loadClass(classLoader,desc.getName());
}

Fixed version (ground truth):
protected Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException {
  return ClassLoaderUtil.loadClass(classLoader,desc.getName());
}
Program: 46784
Project: 46784
Buggy source:
public MockedNodeConnection(int connectionId,Address localEndpoint,Address remoteEndpoint,NodeEngineImpl nodeEngine,MockedClientConnection responseConnection){
  super(localEndpoint,remoteEndpoint,nodeEngine);
  this.responseConnection=responseConnection;
  this.connectionId=connectionId;
}

Fixed version (ground truth):
public MockedNodeConnection(int connectionId,Address localEndpoint,Address remoteEndpoint,NodeEngineImpl nodeEngine,MockedClientConnection responseConnection){
  super(localEndpoint,remoteEndpoint,nodeEngine);
  this.responseConnection=responseConnection;
  this.connectionId=connectionId;
  register();
}
Program: 46785
Project: 46785
Buggy source:
public MockedNodeConnection(int connectionId,Address localEndpoint,Address remoteEndpoint,NodeEngineImpl nodeEngine,MockedClientConnection responseConnection){
  super(localEndpoint,remoteEndpoint,nodeEngine);
  this.responseConnection=responseConnection;
  this.connectionId=connectionId;
}

Fixed version (ground truth):
public MockedNodeConnection(int connectionId,Address localEndpoint,Address remoteEndpoint,NodeEngineImpl nodeEngine,MockedClientConnection responseConnection){
  super(localEndpoint,remoteEndpoint,nodeEngine);
  this.responseConnection=responseConnection;
  this.connectionId=connectionId;
  register();
}
Program: 46786
Project: 46786
Buggy source:
@Test public void runPacket() throws Exception {
  Operation op=new DummyOperation();
  setCallId(op,1000 * 1000);
  Packet packet=toPacket(remote,op);
  operationRunner.run(packet);
}

Fixed version (ground truth):
@Test public void runPacket() throws Exception {
  Operation op=new DummyOperation();
  setCallId(op,1000 * 1000);
  Packet packet=toPacket(local,remote,op);
  operationRunner.run(packet);
}
Program: 46787
Project: 46787
Buggy source:
@Test(expected=HazelcastSerializationException.class) public void runPacket_whenBroken() throws Exception {
  Operation op=new DummyOperation();
  setCallId(op,1000 * 1000);
  Packet packet=toPacket(remote,op);
  byte[] bytes=packet.toByteArray();
  for (int k=0; k < bytes.length; k++) {
    bytes[k]++;
  }
  operationRunner.run(packet);
}

Fixed version (ground truth):
@Test(expected=HazelcastSerializationException.class) public void runPacket_whenBroken() throws Exception {
  Operation op=new DummyOperation();
  setCallId(op,1000 * 1000);
  Packet packet=toPacket(local,remote,op);
  byte[] bytes=packet.toByteArray();
  for (int k=0; k < bytes.length; k++) {
    bytes[k]++;
  }
  operationRunner.run(packet);
}
Program: 46788
Project: 46788
Buggy source:
public static Packet toPacket(HazelcastInstance hz,Operation operation){
  SerializationService serializationService=getSerializationService(hz);
  ConnectionManager connectionManager=getConnectionManager(hz);
  Packet packet=new Packet(serializationService.toBytes(operation),operation.getPartitionId());
  packet.setHeader(Packet.HEADER_OP);
  packet.setConn(connectionManager.getConnection(getAddress(hz)));
  return packet;
}

Fixed version (ground truth):
public static Packet toPacket(HazelcastInstance local,HazelcastInstance remote,Operation operation){
  SerializationService serializationService=getSerializationService(local);
  ConnectionManager connectionManager=getConnectionManager(local);
  Packet packet=new Packet(serializationService.toBytes(operation),operation.getPartitionId());
  packet.setHeader(Packet.HEADER_OP);
  packet.setConn(connectionManager.getConnection(getAddress(remote)));
  return packet;
}
Program: 46789
Project: 46789
Buggy source:
@Override public boolean isAlive(){
  return live;
}

Fixed version (ground truth):
@Override public boolean isAlive(){
  return live && nodeEngine.isRunning();
}
Program: 46790
Project: 46790
Buggy source:
@Override public Connection getConnection(Address address){
  MockConnection conn=mapConnections.get(address);
  if (conn == null || !conn.isAlive()) {
    NodeEngineImpl nodeEngine=nodes.get(address);
    if (nodeEngine != null && nodeEngine.getNode().getState() != NodeState.SHUT_DOWN) {
      MockConnection thisConnection=new MockConnection(address,node.getThisAddress(),node.nodeEngine);
      conn=new MockConnection(node.getThisAddress(),address,nodeEngine);
      conn.localConnection=thisConnection;
      thisConnection.localConnection=conn;
      mapConnections.put(address,conn);
    }
  }
  return conn;
}

Fixed version (ground truth):
@Override public Connection getConnection(Address address){
  return mapConnections.get(address);
}
Program: 46791
Project: 46791
Buggy source:
@Override public Connection getOrConnect(Address address,boolean silent){
  return getConnection(address);
}

Fixed version (ground truth):
@Override public Connection getOrConnect(Address address,boolean silent){
  return getOrConnect(address);
}
Program: 46792
Project: 46792
Buggy source:
public void destroyConnection(final Connection connection){
  final Address endPoint=connection.getEndPoint();
  mapConnections.remove(endPoint);
  ioService.getEventService().executeEventCallback(new StripedRunnable(){
    @Override public void run(){
      for (      ConnectionListener listener : connectionListeners) {
        listener.connectionRemoved(connection);
      }
    }
    @Override public int getKey(){
      return endPoint.hashCode();
    }
  }
);
}

Fixed version (ground truth):
public void destroyConnection(final Connection connection){
  final Address endPoint=connection.getEndPoint();
  final boolean removed=mapConnections.remove(endPoint,connection);
  if (!removed) {
    return;
  }
  logger.info("String_Node_Str" + endPoint + "String_Node_Str"+ connection);
  ioService.getEventService().executeEventCallback(new StripedRunnable(){
    @Override public void run(){
      for (      ConnectionListener listener : connectionListeners) {
        listener.connectionRemoved(connection);
      }
    }
    @Override public int getKey(){
      return endPoint.hashCode();
    }
  }
);
}
Program: 46793
Project: 46793
Buggy source:
@Override public void shutdown(){
  for (  Address address : nodes.keySet()) {
    if (address.equals(node.getThisAddress())) {
      continue;
    }
    final NodeEngineImpl nodeEngine=nodes.get(address);
    if (nodeEngine != null && nodeEngine.isRunning()) {
      nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR,new Runnable(){
        public void run(){
          ClusterServiceImpl clusterService=(ClusterServiceImpl)nodeEngine.getClusterService();
          clusterService.removeAddress(node.getThisAddress());
        }
      }
);
    }
  }
}

Fixed version (ground truth):
@Override public void shutdown(){
  for (  Address address : nodes.keySet()) {
    if (address.equals(node.getThisAddress())) {
      continue;
    }
    final NodeEngineImpl nodeEngine=nodes.get(address);
    if (nodeEngine != null && nodeEngine.isRunning()) {
      nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR,new Runnable(){
        public void run(){
          ClusterServiceImpl clusterService=(ClusterServiceImpl)nodeEngine.getClusterService();
          clusterService.removeAddress(node.getThisAddress());
        }
      }
);
    }
  }
  for (  MockConnection connection : mapConnections.values()) {
    connection.close();
  }
}
Program: 46794
Project: 46794
Buggy source:
protected boolean isInvalidationEnabled(){
  return isOwner && cacheContext.getInvalidationListenerCount() > 0;
}

Fixed version (ground truth):
protected boolean isInvalidationEnabled(){
  return primary && cacheContext.getInvalidationListenerCount() > 0;
}
Program: 46796
Project: 46796
Buggy source:
@Override public void rollbackMigration(PartitionMigrationEvent event){
  if (event.getMigrationEndpoint() == MigrationEndpoint.DESTINATION) {
    clearPartitionReplica(event.getPartitionId());
  }
}

Fixed version (ground truth):
@Override public void rollbackMigration(PartitionMigrationEvent event){
  if (event.getMigrationEndpoint() == MigrationEndpoint.DESTINATION) {
    clearPartitionReplica(event.getPartitionId());
  }
  initPartitionReplica(event.getPartitionId());
}
Program: 46797
Project: 46797
Buggy source:
@Override public void reset(){
  for (  String objectName : configs.keySet()) {
    deleteCache(objectName,true,null,false);
  }
  final CachePartitionSegment[] partitionSegments=segments;
  for (  CachePartitionSegment partitionSegment : partitionSegments) {
    if (partitionSegment != null) {
      partitionSegment.clear();
    }
  }
}

Fixed version (ground truth):
@Override public void reset(){
  for (  String objectName : configs.keySet()) {
    deleteCache(objectName,true,null,false);
  }
  final CachePartitionSegment[] partitionSegments=segments;
  for (  CachePartitionSegment partitionSegment : partitionSegments) {
    if (partitionSegment != null) {
      partitionSegment.clear();
      partitionSegment.init();
    }
  }
}
Program: 46798
Project: 46798
Buggy source:
@Override public void commitMigration(PartitionMigrationEvent event){
  if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
    clearPartitionReplica(event.getPartitionId());
  }
}

Fixed version (ground truth):
@Override public void commitMigration(PartitionMigrationEvent event){
  if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
    clearPartitionReplica(event.getPartitionId());
  }
  initPartitionReplica(event.getPartitionId());
}
Program: 46799
Project: 46799
Buggy source:
public String getCacheNameWithPrefix(String name){
  return cacheNamePrefix + name;
}

Fixed version (ground truth):
@Override public String getCacheNameWithPrefix(String name){
  return cacheNamePrefix + name;
}
Program: 46800
Project: 46800
Buggy source:
@Override protected void onTearDown(){
  factory.terminateAll();
}

Fixed version (ground truth):
@Override protected void onTearDown(){
  factory.shutdownAll();
}
Program: 46801
Project: 46801
Buggy source:
@Override public void run() throws Exception {
  final List<Data> keyValueSequence=this.keyValueSequence;
  if (keyValueSequence == null || keyValueSequence.isEmpty()) {
    return;
  }
  final int partitionId=getPartitionId();
  final MapService mapService=this.mapService;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final RecordStore recordStore=mapServiceContext.getRecordStore(partitionId,name);
  for (int i=0; i < keyValueSequence.size(); i+=2) {
    final Data key=keyValueSequence.get(i);
    final Data value=keyValueSequence.get(i + 1);
    final Object object=mapServiceContext.toObject(value);
    recordStore.putFromLoad(key,object);
    publishWanReplicationEvent(key,value,recordStore.getRecord(key));
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  final List<Data> keyValueSequence=this.keyValueSequence;
  if (keyValueSequence == null || keyValueSequence.isEmpty()) {
    return;
  }
  final int partitionId=getPartitionId();
  final MapService mapService=this.mapService;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final RecordStore recordStore=mapServiceContext.getRecordStore(partitionId,name);
  for (int i=0; i < keyValueSequence.size(); i+=2) {
    final Data key=keyValueSequence.get(i);
    final Data value=keyValueSequence.get(i + 1);
    final Object object=mapServiceContext.toObject(value);
    recordStore.putFromLoadBackup(key,object);
    publishWanReplicationEvent(key,value,recordStore.getRecord(key));
  }
}
Program: 46802
Project: 46802
Buggy source:
@Override public Object putFromLoad(Data key,Object value,long ttl){
  if (!isKeyAndValueLoadable(key,value)) {
    return null;
  }
  final long now=getNow();
  if (shouldEvict(now)) {
    return null;
  }
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue=null;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(value,ttl,now);
    storage.put(key,record);
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,oldValue,value);
    updateRecord(key,record,value,now);
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record,oldValue);
  return oldValue;
}

Fixed version (ground truth):
@Override public Object putFromLoad(Data key,Object value,long ttl){
  return putFromLoadInternal(key,value,ttl,false);
}
Program: 46803
Project: 46803
Buggy source:
@Override public Object putFromLoad(Data key,Object value,long ttl){
  if (key == null || value == null) {
    return null;
  }
  final long now=getNow();
  if (shouldEvict(now)) {
    return null;
  }
  markRecordStoreExpirable(ttl);
  Record record=getRecordOrNull(key,now,false);
  Object oldValue=null;
  if (record == null) {
    value=mapServiceContext.interceptPut(name,null,value);
    record=createRecord(key,value,ttl,now);
    records.put(key,record);
    updateSizeEstimator(calculateRecordHeapCost(record));
  }
 else {
    oldValue=record.getValue();
    value=mapServiceContext.interceptPut(name,record.getValue(),value);
    updateSizeEstimator(-calculateRecordHeapCost(record));
    updateRecord(record,value,now);
    updateSizeEstimator(calculateRecordHeapCost(record));
    updateExpiryTime(record,ttl,mapContainer.getMapConfig());
  }
  saveIndex(record);
  return oldValue;
}

Fixed version (ground truth):
@Override public Object putFromLoad(Data key,Object value,long ttl){
  return putFromLoadInternal(key,value,ttl,false);
}
Program: 46804
Project: 46804
Buggy source:
@Override public void run() throws Exception {
  final List<Data> keyValueSequence=this.keyValueSequence;
  if (keyValueSequence == null || keyValueSequence.isEmpty()) {
    return;
  }
  final int partitionId=getPartitionId();
  final MapService mapService=this.mapService;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final RecordStore recordStore=mapServiceContext.getRecordStore(partitionId,name);
  for (int i=0; i < keyValueSequence.size(); i+=2) {
    final Data key=keyValueSequence.get(i);
    final Data value=keyValueSequence.get(i + 1);
    final Object object=mapServiceContext.toObject(value);
    recordStore.putFromLoad(key,object);
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  final List<Data> keyValueSequence=this.keyValueSequence;
  if (keyValueSequence == null || keyValueSequence.isEmpty()) {
    return;
  }
  final int partitionId=getPartitionId();
  final MapService mapService=this.mapService;
  MapServiceContext mapServiceContext=mapService.getMapServiceContext();
  final RecordStore recordStore=mapServiceContext.getRecordStore(partitionId,name);
  for (int i=0; i < keyValueSequence.size(); i+=2) {
    final Data key=keyValueSequence.get(i);
    final Data value=keyValueSequence.get(i + 1);
    final Object object=mapServiceContext.toObject(value);
    recordStore.putFromLoadBackup(key,object);
  }
}
Program: 46805
Project: 46805
Buggy source:
@Override public void onResponse(ClientMessage message){
  if (!done) {
synchronized (mutex) {
      if (!done) {
        response=resolveMessageToValue(message);
        if (shouldDeserializeData && deserializedValue == null) {
          deserializedValue=serializationService.toObject(response);
        }
        done=true;
      }
    }
  }
  if (shouldDeserializeData) {
    callback.onResponse((T)deserializedValue);
  }
 else {
    callback.onResponse((T)response);
  }
}

Fixed version (ground truth):
@Override public void onResponse(ClientMessage message){
  if (!done || response == null) {
synchronized (mutex) {
      if (!done || response == null) {
        response=resolveMessageToValue(message);
        if (shouldDeserializeData && deserializedValue == null) {
          deserializedValue=serializationService.toObject(response);
        }
        done=true;
      }
    }
  }
  if (shouldDeserializeData) {
    callback.onResponse((T)deserializedValue);
  }
 else {
    callback.onResponse((T)response);
  }
}
Program: 46806
Project: 46806
Buggy source:
@Override public void onResponse(Object response){
  if (!done) {
synchronized (mutex) {
      if (!done) {
        value=getResult(response);
        done=true;
      }
    }
  }
  callback.onResponse((T)value);
}

Fixed version (ground truth):
@Override public void onResponse(Object response){
  if (!done || value == null) {
synchronized (mutex) {
      if (!done || value == null) {
        value=getResult(response);
        done=true;
      }
    }
  }
  callback.onResponse((T)value);
}
Program: 46807
Project: 46807
Buggy source:
@Override public void onResponse(ClientMessage message){
  if (!done) {
synchronized (mutex) {
      if (!done) {
        response=resolveMessageToValue(message);
        if (shouldDeserializeData && deserializedValue == null) {
          deserializedValue=serializationService.toObject(response);
        }
        done=true;
      }
    }
  }
  if (shouldDeserializeData) {
    callback.onResponse((T)deserializedValue);
  }
 else {
    callback.onResponse((T)response);
  }
}

Fixed version (ground truth):
@Override public void onResponse(ClientMessage message){
  if (!done || response == null) {
synchronized (mutex) {
      if (!done || response == null) {
        response=resolveMessageToValue(message);
        if (shouldDeserializeData && deserializedValue == null) {
          deserializedValue=serializationService.toObject(response);
        }
        done=true;
      }
    }
  }
  if (shouldDeserializeData) {
    callback.onResponse((T)deserializedValue);
  }
 else {
    callback.onResponse((T)response);
  }
}
Program: 46808
Project: 46808
Buggy source:
void process(EventPacket eventPacket){
  Object eventObject=getEventObject(eventPacket);
  String serviceName=eventPacket.getServiceName();
  EventPublishingService<Object,Object> service=getPublishingService(serviceName);
  Registration registration=getRegistration(eventPacket,serviceName);
  if (registration == null) {
    return;
  }
  service.dispatchEvent(eventObject,registration.getListener());
}

Fixed version (ground truth):
void process(EventPacket eventPacket){
  Object eventObject=getEventObject(eventPacket);
  String serviceName=eventPacket.getServiceName();
  EventPublishingService<Object,Object> service=eventService.nodeEngine.getService(serviceName);
  Registration registration=getRegistration(eventPacket,serviceName);
  if (registration == null) {
    return;
  }
  service.dispatchEvent(eventObject,registration.getListener());
}
Program: 46809
Project: 46809
Buggy source:
ProxyRegistry(ProxyServiceImpl proxyService,String serviceName){
  this.proxyService=proxyService;
  this.serviceName=serviceName;
  this.service=getService(proxyService,serviceName);
}

Fixed version (ground truth):
ProxyRegistry(ProxyServiceImpl proxyService,String serviceName){
  this.proxyService=proxyService;
  this.serviceName=serviceName;
  this.service=proxyService.nodeEngine.getService(serviceName);
}
Program: 46810
Project: 46810
Buggy source:
@Override public void onResponse(Object response){
  if (!done) {
synchronized (mutex) {
      if (!done) {
        value=getResult(response);
        done=true;
      }
    }
  }
  callback.onResponse((T)value);
}

Fixed version (ground truth):
@Override public void onResponse(Object response){
  if (!done || value == null) {
synchronized (mutex) {
      if (!done || value == null) {
        value=getResult(response);
        done=true;
      }
    }
  }
  callback.onResponse((T)value);
}
Program: 46811
Project: 46811
Buggy source:
@Override public void run(){
  try {
    final Map<Integer,Object> results=invoke(request);
    validateResults(results);
    if (completionListener != null) {
      completionListener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (completionListener != null) {
      completionListener.onException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    final Map<Integer,Object> results=invoke(request);
    validateResults(results);
    if (completionListener != null) {
      completionListener.onCompletion();
    }
  }
 catch (  Exception e) {
    if (completionListener != null) {
      completionListener.onException(e);
    }
  }
catch (  Throwable t) {
    if (t instanceof OutOfMemoryError) {
      ExceptionUtil.rethrow(t);
    }
 else {
      if (completionListener != null) {
        completionListener.onException(new CacheException(t));
      }
    }
  }
}