nus-yam/ex-repair huggingface dataset:
Program: 102712
Project: 102712
Buggy source:
@Test public void test() throws Throwable {
  HazelcastInstance instance1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance3=Hazelcast.newHazelcastInstance(null);
  PojoServiceContextFactory factory=new PojoServiceContextFactory(Pojo.class);
  PojoServiceContext context1=factory.create();
  PojoServiceContext context2=factory.create();
  PojoServiceContext context3=factory.create();
  SomeServiceImpl service1=(SomeServiceImpl)context1.getService("String_Node_Str");
  SomeServiceImpl service2=(SomeServiceImpl)context2.getService("String_Node_Str");
  SomeServiceImpl service3=(SomeServiceImpl)context3.getService("String_Node_Str");
  ServiceContextServer server1=build(context1,instance1,"String_Node_Str");
  ServiceContextServer server2=build(context2,instance2,"String_Node_Str");
  ServiceContextServer server3=build(context3,instance3,"String_Node_Str");
  HazelcastInstance clientInstance=TestUtils.newLiteInstance();
  ProxyProvider proxyProvider=new DefaultProxyProvider("String_Node_Str",clientInstance);
  SomeService someService=proxyProvider.getProxy(SomeService.class);
  for (int k=0; k < 3 * 5; k++) {
    someService.someMethod(0);
  }
  assertEquals(5,service1.count);
  assertEquals(5,service2.count);
  assertEquals(5,service3.count);
  server1.shutdown();
  server2.shutdown();
  server3.shutdown();
}

Fixed version (ground truth):
@Test public void test() throws Throwable {
  HazelcastInstance instance1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance3=Hazelcast.newHazelcastInstance(null);
  PojoServiceContextFactory factory=new PojoServiceContextFactory(Pojo.class);
  PojoServiceContext context1=factory.create();
  PojoServiceContext context2=factory.create();
  PojoServiceContext context3=factory.create();
  SomeServiceImpl service1=(SomeServiceImpl)context1.getService("String_Node_Str");
  SomeServiceImpl service2=(SomeServiceImpl)context2.getService("String_Node_Str");
  SomeServiceImpl service3=(SomeServiceImpl)context3.getService("String_Node_Str");
  ServiceContextServer server1=build(context1,instance1,"String_Node_Str");
  ServiceContextServer server2=build(context2,instance2,"String_Node_Str");
  ServiceContextServer server3=build(context3,instance3,"String_Node_Str");
  HazelcastInstance clientInstance=TestUtils.newLiteInstance();
  ProxyProvider proxyProvider=new DefaultProxyProvider("String_Node_Str",clientInstance);
  SomeService someService=proxyProvider.getProxy(SomeService.class);
  for (int k=0; k < 3 * 5; k++) {
    someService.someMethod();
  }
  assertEquals(5,service1.count);
  assertEquals(5,service2.count);
  assertEquals(5,service3.count);
  server1.shutdown();
  server2.shutdown();
  server3.shutdown();
}
Program: 102713
Project: 102713
Buggy source:
public void someMethod(int x){
  count++;
}

Fixed version (ground truth):
public void someMethod(){
  count++;
}
Program: 102714
Project: 102714
Buggy source:
@Partitioned Order get(CustomerOrderId customerOrderId);

Fixed version (ground truth):
@Partitioned Order get(@PartitionKey CustomerOrderId customerOrderId);
Program: 102715
Project: 102715
Buggy source:
@Partitioned void addOrderLine(CustomerOrderId customerOrderId,String articleId,int quantity);

Fixed version (ground truth):
@Partitioned void addOrderLine(@PartitionKey CustomerOrderId customerOrderId,String articleId,int quantity);
Program: 102716
Project: 102716
Buggy source:
public Object executeMethod(String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  notNull("String_Node_Str",args);
  if (partitionKey != null) {
    Partition partition=partitionService.getPartition(partitionKey);
    int partitionId=partition.getPartitionId();
    if (!managedPartitions.contains(partitionId)) {
      throw new PartitionMovedException(format("String_Node_Str",partitionId,self));
    }
  }
  Object service=serviceContext.getService(serviceName);
  Class serviceClass=service.getClass();
  Method[] methods=serviceClass.getMethods();
  Method foundMethod=null;
  for (  Method method : methods) {
    if (PojoUtils.matches(method,methodName,argTypes)) {
      foundMethod=method;
      break;
    }
  }
  if (foundMethod == null) {
    throw new IllegalStateException();
  }
  try {
    return foundMethod.invoke(service,args);
  }
 catch (  InvocationTargetException e) {
    throw e.getTargetException();
  }
}

Fixed version (ground truth):
public Object executeMethod(String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  if (partitionKey != null) {
    Partition partition=partitionService.getPartition(partitionKey);
    int partitionId=partition.getPartitionId();
    if (!managedPartitions.contains(partitionId)) {
      throw new PartitionMovedException(format("String_Node_Str",partitionId,self));
    }
  }
  Object service=serviceContext.getService(serviceName);
  Class serviceClass=service.getClass();
  Method[] methods=serviceClass.getMethods();
  Method foundMethod=null;
  for (  Method method : methods) {
    if (PojoUtils.matches(method,methodName,argTypes)) {
      foundMethod=method;
      break;
    }
  }
  if (foundMethod == null) {
    throw new IllegalStateException();
  }
  try {
    return foundMethod.invoke(service,args);
  }
 catch (  InvocationTargetException e) {
    throw e.getTargetException();
  }
}
Program: 102717
Project: 102717
Buggy source:
/** 
 * Executes a method. <p/> This is the call that is executed by ProxyProvider once the task is deserialized and executed on the target machine.
 * @param serviceContextName
 * @param serviceName
 * @param methodName
 * @param args
 * @return
 * @throws Exception
 * @throws IllegalArgumentException if serviceContextName is not pointing to a an existing ServiceContext.
 * @throws NullPointerException     if serviceContextName
 */
public static Object executeMethod(HazelcastInstance hazelcastInstance,String serviceContextName,String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",hazelcastInstance);
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  notNull("String_Node_Str",args);
  ServiceContextContainer container=getContainer(hazelcastInstance,serviceContextName);
  return container.executeMethod(serviceName,methodName,argTypes,args,partitionKey);
}

Fixed version (ground truth):
/** 
 * Executes a method. <p/> This is the call that is executed by ProxyProvider once the task is deserialized and executed on the target machine.
 * @param serviceContextName
 * @param serviceName
 * @param methodName
 * @param args
 * @return
 * @throws Exception
 * @throws IllegalArgumentException if serviceContextName is not pointing to a an existing ServiceContext.
 * @throws NullPointerException     if serviceContextName
 */
public static Object executeMethod(HazelcastInstance hazelcastInstance,String serviceContextName,String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",hazelcastInstance);
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  ServiceContextContainer container=getContainer(hazelcastInstance,serviceContextName);
  return container.executeMethod(serviceName,methodName,argTypes,args,partitionKey);
}
Program: 102718
Project: 102718
Buggy source:
@Test public void test() throws Throwable {
  HazelcastInstance instance1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance3=Hazelcast.newHazelcastInstance(null);
  PojoServiceContextFactory factory=new PojoServiceContextFactory(Pojo.class);
  PojoServiceContext context1=factory.create();
  PojoServiceContext context2=factory.create();
  PojoServiceContext context3=factory.create();
  SomeServiceImpl service1=(SomeServiceImpl)context1.getService("String_Node_Str");
  SomeServiceImpl service2=(SomeServiceImpl)context2.getService("String_Node_Str");
  SomeServiceImpl service3=(SomeServiceImpl)context3.getService("String_Node_Str");
  ServiceContextServer server1=build(context1,instance1,"String_Node_Str");
  ServiceContextServer server2=build(context2,instance2,"String_Node_Str");
  ServiceContextServer server3=build(context3,instance3,"String_Node_Str");
  HazelcastInstance clientInstance=TestUtils.newLiteInstance();
  ProxyProvider proxyProvider=new DefaultProxyProvider("String_Node_Str",clientInstance);
  SomeService someService=proxyProvider.getProxy(SomeService.class);
  for (int k=0; k < 3 * 5; k++) {
    someService.someMethod(0);
  }
  assertEquals(5,service1.count);
  assertEquals(5,service2.count);
  assertEquals(5,service3.count);
  server1.shutdown();
  server2.shutdown();
  server3.shutdown();
}

Fixed version (ground truth):
@Test public void test() throws Throwable {
  HazelcastInstance instance1=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance2=Hazelcast.newHazelcastInstance(null);
  HazelcastInstance instance3=Hazelcast.newHazelcastInstance(null);
  PojoServiceContextFactory factory=new PojoServiceContextFactory(Pojo.class);
  PojoServiceContext context1=factory.create();
  PojoServiceContext context2=factory.create();
  PojoServiceContext context3=factory.create();
  SomeServiceImpl service1=(SomeServiceImpl)context1.getService("String_Node_Str");
  SomeServiceImpl service2=(SomeServiceImpl)context2.getService("String_Node_Str");
  SomeServiceImpl service3=(SomeServiceImpl)context3.getService("String_Node_Str");
  ServiceContextServer server1=build(context1,instance1,"String_Node_Str");
  ServiceContextServer server2=build(context2,instance2,"String_Node_Str");
  ServiceContextServer server3=build(context3,instance3,"String_Node_Str");
  HazelcastInstance clientInstance=TestUtils.newLiteInstance();
  ProxyProvider proxyProvider=new DefaultProxyProvider("String_Node_Str",clientInstance);
  SomeService someService=proxyProvider.getProxy(SomeService.class);
  for (int k=0; k < 3 * 5; k++) {
    someService.someMethod();
  }
  assertEquals(5,service1.count);
  assertEquals(5,service2.count);
  assertEquals(5,service3.count);
  server1.shutdown();
  server2.shutdown();
  server3.shutdown();
}
Program: 102719
Project: 102719
Buggy source:
public void someMethod(int x){
  count++;
}

Fixed version (ground truth):
public void someMethod(){
  count++;
}
Program: 102720
Project: 102720
Buggy source:
@LoadBalanced String singleArg(@PartitionKey String arg);

Fixed version (ground truth):
@LoadBalanced String singleArg(String arg);
Program: 102721
Project: 102721
Buggy source:
@LoadBalanced String multipleArgs(@PartitionKey String arg,String arg2);

Fixed version (ground truth):
@LoadBalanced String multipleArgs(String arg,String arg2);
Program: 102722
Project: 102722
Buggy source:
public Object executeMethod(String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  notNull("String_Node_Str",args);
  if (partitionKey != null) {
    Partition partition=partitionService.getPartition(partitionKey);
    int partitionId=partition.getPartitionId();
    if (!managedPartitions.contains(partitionId)) {
      throw new PartitionMovedException(format("String_Node_Str",partitionId,self));
    }
  }
  Object service=serviceContext.getService(serviceName);
  Class serviceClass=service.getClass();
  Method[] methods=serviceClass.getMethods();
  Method foundMethod=null;
  for (  Method method : methods) {
    if (PojoUtils.matches(method,methodName,argTypes)) {
      foundMethod=method;
      break;
    }
  }
  if (foundMethod == null) {
    throw new IllegalStateException();
  }
  try {
    return foundMethod.invoke(service,args);
  }
 catch (  InvocationTargetException e) {
    throw e.getTargetException();
  }
}

Fixed version (ground truth):
public Object executeMethod(String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  if (partitionKey != null) {
    Partition partition=partitionService.getPartition(partitionKey);
    int partitionId=partition.getPartitionId();
    if (!managedPartitions.contains(partitionId)) {
      throw new PartitionMovedException(format("String_Node_Str",partitionId,self));
    }
  }
  Object service=serviceContext.getService(serviceName);
  Class serviceClass=service.getClass();
  Method[] methods=serviceClass.getMethods();
  Method foundMethod=null;
  for (  Method method : methods) {
    if (PojoUtils.matches(method,methodName,argTypes)) {
      foundMethod=method;
      break;
    }
  }
  if (foundMethod == null) {
    throw new IllegalStateException();
  }
  try {
    return foundMethod.invoke(service,args);
  }
 catch (  InvocationTargetException e) {
    throw e.getTargetException();
  }
}
Program: 102723
Project: 102723
Buggy source:
/** 
 * Executes a method. <p/> This is the call that is executed by ProxyProvider once the task is deserialized and executed on the target machine.
 * @param serviceContextName
 * @param serviceName
 * @param methodName
 * @param args
 * @return
 * @throws Exception
 * @throws IllegalArgumentException if serviceContextName is not pointing to a an existing ServiceContext.
 * @throws NullPointerException     if serviceContextName
 */
public static Object executeMethod(HazelcastInstance hazelcastInstance,String serviceContextName,String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",hazelcastInstance);
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  notNull("String_Node_Str",args);
  ServiceContextContainer container=getContainer(hazelcastInstance,serviceContextName);
  return container.executeMethod(serviceName,methodName,argTypes,args,partitionKey);
}

Fixed version (ground truth):
/** 
 * Executes a method. <p/> This is the call that is executed by ProxyProvider once the task is deserialized and executed on the target machine.
 * @param serviceContextName
 * @param serviceName
 * @param methodName
 * @param args
 * @return
 * @throws Exception
 * @throws IllegalArgumentException if serviceContextName is not pointing to a an existing ServiceContext.
 * @throws NullPointerException     if serviceContextName
 */
public static Object executeMethod(HazelcastInstance hazelcastInstance,String serviceContextName,String serviceName,String methodName,String[] argTypes,Object[] args,Object partitionKey) throws Throwable {
  notNull("String_Node_Str",hazelcastInstance);
  notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",serviceName);
  notNull("String_Node_Str",methodName);
  ServiceContextContainer container=getContainer(hazelcastInstance,serviceContextName);
  return container.executeMethod(serviceName,methodName,argTypes,args,partitionKey);
}
Program: 102724
Project: 102724
Buggy source:
@LoadBalanced String singleArg(@PartitionKey String arg);

Fixed version (ground truth):
@LoadBalanced String singleArg(String arg);
Program: 102725
Project: 102725
Buggy source:
@LoadBalanced String multipleArgs(@PartitionKey String arg,String arg2);

Fixed version (ground truth):
@LoadBalanced String multipleArgs(String arg,String arg2);
Program: 102726
Project: 102726
Buggy source:
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  RemoteMethodInfo methodInfo=remoteInterfaceInfo.methodInfoMap.get(method);
  if (methodInfo == null) {
    return invokeNonProxied(proxy,method,args);
  }
  long startTimeNs=0;
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,"String_Node_Str" + method);
    startTimeNs=System.nanoTime();
  }
  Object result;
switch (methodInfo.methodType) {
case FORK_JOIN:
    result=invokeForkJoin(methodInfo,args);
  break;
case PARTITIONED:
result=invokePartitioned(methodInfo,args);
break;
case LOAD_BALANCED:
result=invokeLoadBalancer(methodInfo,args);
break;
default :
throw new RuntimeException("String_Node_Str" + methodInfo.methodType);
}
if (logger.isLoggable(Level.FINE)) {
long delayNs=System.nanoTime() - startTimeNs;
logger.log(Level.FINE,"String_Node_Str" + method + "String_Node_Str"+ (delayNs / 1000)+ "String_Node_Str");
}
return result;
}

Fixed version (ground truth):
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  RemoteMethodInfo methodInfo=remoteInterfaceInfo.methodInfoMap.get(method);
  if (methodInfo == null) {
    return invokeNonProxied(proxy,method,args);
  }
  long startTimeNs=0;
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,"String_Node_Str" + method);
    startTimeNs=System.nanoTime();
  }
  while (true) {
    try {
      Object result;
switch (methodInfo.methodType) {
case FORK_JOIN:
        result=invokeForkJoin(methodInfo,args);
      break;
case PARTITIONED:
    result=invokePartitioned(methodInfo,args);
  break;
case LOAD_BALANCED:
result=invokeLoadBalancer(methodInfo,args);
break;
default :
throw new RuntimeException("String_Node_Str" + methodInfo.methodType);
}
if (logger.isLoggable(Level.FINE)) {
long delayNs=System.nanoTime() - startTimeNs;
logger.log(Level.FINE,"String_Node_Str" + method + "String_Node_Str"+ (delayNs / 1000)+ "String_Node_Str");
}
return result;
}
 catch (PartitionMovedException e) {
logger.log(Level.INFO,"String_Node_Str");
Thread.sleep(100);
}
}
}
Program: 102727
Project: 102727
Buggy source:
public Object call() throws Exception {
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName));
  }
  try {
    while (true) {
      try {
        Object result=ServiceContextServer.executeMethod(serviceContext,serviceName,methodName,argTypes,args,partitionKey);
        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName));
        }
        return result;
      }
 catch (      PartitionMovedException e) {
        logger.log(Level.INFO,"String_Node_Str");
        Thread.sleep(100);
      }
    }
  }
 catch (  Exception e) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName),e);
    }
    throw e;
  }
catch (  Throwable e) {
    if (logger.isLoggable(Level.SEVERE)) {
      logger.log(Level.SEVERE,format("String_Node_Str",serviceName,methodName,serviceName),e);
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Object call() throws Exception {
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName));
  }
  try {
    Object result=ServiceContextServer.executeMethod(serviceContext,serviceName,methodName,argTypes,args,partitionKey);
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName));
    }
    return result;
  }
 catch (  Exception e) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,format("String_Node_Str",serviceName,methodName,serviceName),e);
    }
    throw e;
  }
catch (  Throwable e) {
    if (logger.isLoggable(Level.SEVERE)) {
      logger.log(Level.SEVERE,format("String_Node_Str",serviceName,methodName,serviceName),e);
    }
    throw new RuntimeException(e);
  }
}
Program: 102728
Project: 102728
Buggy source:
/** 
 * Executes a scanForPartitionChanges; so checks the partition table to see if there are change. <p/> This method should be called by some kind of Scheduler.   It is not threadsafe, and should always be called by the same thread (because locks are used and they need to be unlocked by the same thread that acquired the lock).
 */
public void scanForPartitionChanges(){
  long startMs=System.currentTimeMillis();
  if (logger.isLoggable(Level.FINEST)) {
    logger.log(Level.FINEST,format("String_Node_Str",serviceContextName));
  }
  boolean changeDetected=false;
  for (  Partition partition : partitionService.getPartitions()) {
    int partitionId=partition.getPartitionId();
    if (self.equals(partition.getOwner())) {
      boolean startManagingPartition=!managedPartitions.contains(partitionId);
      if (startManagingPartition) {
        if (addPartition(partitionId)) {
          changeDetected=true;
        }
      }
    }
 else {
      boolean stopManagingPartition=managedPartitions.contains(partitionId);
      if (stopManagingPartition) {
        removePartition(partitionId);
        changeDetected=true;
      }
    }
  }
  if (changeDetected && logger.isLoggable(Level.INFO)) {
    long durationMs=System.currentTimeMillis() - startMs;
    logger.log(Level.INFO,format("String_Node_Str",serviceContextName,managedPartitions.size(),durationMs));
  }
}

Fixed version (ground truth):
/** 
 * Executes a scanForPartitionChanges; so checks the partition table to see if there are change. <p/> This method should be called by some kind of Scheduler.   It is not threadsafe, and should always be called by the same thread (because locks are used and they need to be unlocked by the same thread that acquired the lock).
 */
public void scanForPartitionChanges(){
  long startMs=System.currentTimeMillis();
  if (logger.isLoggable(Level.FINEST)) {
    logger.log(Level.FINEST,format("String_Node_Str",serviceContextName));
  }
  boolean changeDetected=false;
  for (  Partition partition : partitions) {
    int partitionId=partition.getPartitionId();
    if (self.equals(partition.getOwner())) {
      boolean startManagingPartition=!managedPartitions.contains(partitionId);
      if (startManagingPartition) {
        if (addPartition(partitionId)) {
          changeDetected=true;
        }
      }
    }
 else {
      boolean stopManagingPartition=managedPartitions.contains(partitionId);
      if (stopManagingPartition) {
        removePartition(partitionId);
        changeDetected=true;
      }
    }
  }
  if (changeDetected && logger.isLoggable(Level.INFO)) {
    long durationMs=System.currentTimeMillis() - startMs;
    logger.log(Level.INFO,format("String_Node_Str",serviceContextName,managedPartitions.size(),durationMs));
  }
}
Program: 102729
Project: 102729
Buggy source:
/** 
 * Creates a new ServiceContextContainer with the given ServiceContext.
 * @param serviceContext     the ServiceContext contained in this ServiceContextContainer.
 * @param serviceContextName the name of the ServiceContext
 * @throws NullPointerException if serviceContext or serviceContextName is null.
 */
public ServiceContextContainer(ServiceContext serviceContext,String serviceContextName,HazelcastInstance hazelcastInstance){
  this.serviceContext=notNull("String_Node_Str",serviceContext);
  this.serviceContextName=notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",hazelcastInstance);
  if (logger.isLoggable(Level.INFO)) {
    logger.log(Level.INFO,format("String_Node_Str",serviceContext));
  }
  self=hazelcastInstance.getCluster().getLocalMember();
  partitionService=hazelcastInstance.getPartitionService();
  for (  Partition partition : partitionService.getPartitions()) {
    int partitionId=partition.getPartitionId();
    ILock lock=hazelcastInstance.getLock("String_Node_Str" + partitionId);
    partitionLockMap.put(partitionId,lock);
  }
  logger.log(Level.INFO,"String_Node_Str" + partitionLockMap.size());
}

Fixed version (ground truth):
/** 
 * Creates a new ServiceContextContainer with the given ServiceContext.
 * @param serviceContext     the ServiceContext contained in this ServiceContextContainer.
 * @param serviceContextName the name of the ServiceContext
 * @throws NullPointerException if serviceContext or serviceContextName is null.
 */
public ServiceContextContainer(ServiceContext serviceContext,String serviceContextName,HazelcastInstance hazelcastInstance){
  this.serviceContext=notNull("String_Node_Str",serviceContext);
  this.serviceContextName=notNull("String_Node_Str",serviceContextName);
  notNull("String_Node_Str",hazelcastInstance);
  if (logger.isLoggable(Level.INFO)) {
    logger.log(Level.INFO,format("String_Node_Str",serviceContext));
  }
  self=hazelcastInstance.getCluster().getLocalMember();
  partitionService=hazelcastInstance.getPartitionService();
  for (  Partition partition : partitionService.getPartitions()) {
    int partitionId=partition.getPartitionId();
    ILock lock=hazelcastInstance.getLock("String_Node_Str" + partitionId);
    partitionLockMap.put(partitionId,lock);
    partitions.add(partition);
  }
}
Program: 102730
Project: 102730
Buggy source:
public TreeNode getChildByName(String name) throws RepositoryException {
  for (  TreeNode child : children_) {
    if (child.getName().equals(name))     return child;
  }
  Node tempNode=this.getNode().getNode(name);
  if (tempNode == null)   return null;
  TreeNode tempTreeNode=new TreeNode(tempNode);
  children_.add(tempTreeNode);
  return tempTreeNode;
}

Fixed version (ground truth):
public TreeNode getChildByName(String name) throws RepositoryException {
  for (  TreeNode child : children_) {
    if (child.getName().equals(name))     return child;
  }
  return null;
}
Program: 102731
Project: 102731
Buggy source:
@Override protected String getFileType(ResultNode node) throws Exception {
  return org.exoplatform.services.cms.impl.Utils.getNodeTypeIcon(node,"String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override protected String getFileType(ResultNode node) throws Exception {
  return org.exoplatform.services.cms.impl.Utils.getFileType(node);
}
Program: 102732
Project: 102732
Buggy source:
/** 
 * Creates the file element for connector response looks like that <File name="" fileType="" dateCreated="" dateModified="" creator="" size="" url="" />.
 * @param document the document
 * @param child the child
 * @param fileType the file type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public Element createFileElement(Document document,Node child,String fileType) throws Exception {
  Element file=document.createElement("String_Node_Str");
  file.setAttribute("String_Node_Str",child.getName());
  SimpleDateFormat formatter=new SimpleDateFormat(ISO8601.SIMPLE_DATETIME_FORMAT);
  file.setAttribute("String_Node_Str",formatter.format(child.getProperty("String_Node_Str").getDate().getTime()));
  file.setAttribute("String_Node_Str",formatter.format(child.getProperty("String_Node_Str").getDate().getTime()));
  file.setAttribute("String_Node_Str",child.getProperty("String_Node_Str").getString());
  file.setAttribute("String_Node_Str",fileType);
  file.setAttribute("String_Node_Str",getFileURL(child));
  if (child.isNodeType(FCKUtils.NT_FILE)) {
    long size=child.getNode("String_Node_Str").getProperty("String_Node_Str").getLength();
    file.setAttribute("String_Node_Str","String_Node_Str" + size / 1000);
  }
 else {
    file.setAttribute("String_Node_Str","String_Node_Str");
  }
  return file;
}

Fixed version (ground truth):
/** 
 * Creates the file element for connector response looks like that   {@code <Filename="" fileType="" dateCreated="" dateModified="" creator="" size="" url="" />}.
 * @param document the document
 * @param child the child
 * @param fileType the file type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public Element createFileElement(Document document,Node child,String fileType) throws Exception {
  Element file=document.createElement("String_Node_Str");
  file.setAttribute("String_Node_Str",child.getName());
  SimpleDateFormat formatter=new SimpleDateFormat(ISO8601.SIMPLE_DATETIME_FORMAT);
  file.setAttribute("String_Node_Str",formatter.format(child.getProperty("String_Node_Str").getDate().getTime()));
  file.setAttribute("String_Node_Str",formatter.format(child.getProperty("String_Node_Str").getDate().getTime()));
  file.setAttribute("String_Node_Str",child.getProperty("String_Node_Str").getString());
  file.setAttribute("String_Node_Str",fileType);
  file.setAttribute("String_Node_Str",getFileURL(child));
  if (child.isNodeType(FCKUtils.NT_FILE)) {
    long size=child.getNode("String_Node_Str").getProperty("String_Node_Str").getLength();
    file.setAttribute("String_Node_Str","String_Node_Str" + size / 1000);
  }
 else {
    file.setAttribute("String_Node_Str","String_Node_Str");
  }
  return file;
}
Program: 102733
Project: 102733
Buggy source:
/** 
 * Creates the folder element for connector response look like <folder name="" url="" folderType="" />
 * @param document the document
 * @param child the child
 * @param folderType the folder type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public Element createFolderElement(Document document,Node child,String folderType) throws Exception {
  Element folder=document.createElement("String_Node_Str");
  folder.setAttribute("String_Node_Str",child.getName());
  folder.setAttribute("String_Node_Str",getFolderURL(child));
  folder.setAttribute("String_Node_Str",folderType);
  return folder;
}

Fixed version (ground truth):
/** 
 * Creates the folder element for connector response look like   {@code <folder name=""url="" folderType="" />}
 * @param document the document
 * @param child the child
 * @param folderType the folder type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public Element createFolderElement(Document document,Node child,String folderType) throws Exception {
  Element folder=document.createElement("String_Node_Str");
  folder.setAttribute("String_Node_Str",child.getName());
  folder.setAttribute("String_Node_Str",getFolderURL(child));
  folder.setAttribute("String_Node_Str",folderType);
  return folder;
}
Program: 102734
Project: 102734
Buggy source:
/** 
 * Creates the root element for connector response. The full connector response looks like: <Connector command="GetFolders" resourceType=""> <CurrentFolder folderType="" name="" path="" url=""/> </CurrentFolder> </Connector>
 * @param command the command
 * @param node the node
 * @param folderType the folder type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public static Element createRootElement(String command,Node node,String folderType) throws Exception {
  Document doc=null;
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  DocumentBuilder builder=factory.newDocumentBuilder();
  doc=builder.newDocument();
  StringBuffer currentPath=new StringBuffer(node.getPath());
  if (!currentPath.toString().endsWith("String_Node_Str")) {
    currentPath.append("String_Node_Str");
  }
  Element rootElement=doc.createElement("String_Node_Str");
  doc.appendChild(rootElement);
  rootElement.setAttribute("String_Node_Str",command);
  rootElement.setAttribute("String_Node_Str","String_Node_Str");
  Element currentFolderElement=doc.createElement("String_Node_Str");
  currentFolderElement.setAttribute("String_Node_Str",node.getName());
  currentFolderElement.setAttribute("String_Node_Str",folderType);
  currentFolderElement.setAttribute("String_Node_Str",currentPath.toString());
  currentFolderElement.setAttribute("String_Node_Str",createWebdavURL(node));
  rootElement.appendChild(currentFolderElement);
  return rootElement;
}

Fixed version (ground truth):
/** 
 * Creates the root element for connector response. The full connector response looks like:  {@code <Connector command="GetFolders" resourceType=""> <CurrentFolder folderType="" name="" path="" url=""/> </CurrentFolder> </Connector>}
 * @param command the command
 * @param node the node
 * @param folderType the folder type
 * @return the org.w3c.dom.Element element
 * @throws Exception the exception
 */
public static Element createRootElement(String command,Node node,String folderType) throws Exception {
  Document doc=null;
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  DocumentBuilder builder=factory.newDocumentBuilder();
  doc=builder.newDocument();
  StringBuffer currentPath=new StringBuffer(node.getPath());
  if (!currentPath.toString().endsWith("String_Node_Str")) {
    currentPath.append("String_Node_Str");
  }
  Element rootElement=doc.createElement("String_Node_Str");
  doc.appendChild(rootElement);
  rootElement.setAttribute("String_Node_Str",command);
  rootElement.setAttribute("String_Node_Str","String_Node_Str");
  Element currentFolderElement=doc.createElement("String_Node_Str");
  currentFolderElement.setAttribute("String_Node_Str",node.getName());
  currentFolderElement.setAttribute("String_Node_Str",folderType);
  currentFolderElement.setAttribute("String_Node_Str",currentPath.toString());
  currentFolderElement.setAttribute("String_Node_Str",createWebdavURL(node));
  rootElement.appendChild(currentFolderElement);
  return rootElement;
}
Program: 102737
Project: 102737
Buggy source:
/** 
 * Instantiates a new base connector.
 * @param container the container
 */
public BaseConnector(){
  livePortalManagerService=WCMCoreUtils.getService(LivePortalManagerService.class);
  repositoryService=WCMCoreUtils.getService(RepositoryService.class);
  webSchemaConfigService=WCMCoreUtils.getService(WebSchemaConfigService.class);
  votingService=WCMCoreUtils.getService(VotingService.class);
  linkManager=WCMCoreUtils.getService(LinkManager.class);
  ExoContainer container=ExoContainerContext.getCurrentContainer();
  folderHandler=new FCKFolderHandler(container);
  fileHandler=new FCKFileHandler(container);
  fileUploadHandler=new FileUploadHandler();
}

Fixed version (ground truth):
/** 
 * Instantiates a new base connector.
 */
public BaseConnector(){
  livePortalManagerService=WCMCoreUtils.getService(LivePortalManagerService.class);
  repositoryService=WCMCoreUtils.getService(RepositoryService.class);
  webSchemaConfigService=WCMCoreUtils.getService(WebSchemaConfigService.class);
  votingService=WCMCoreUtils.getService(VotingService.class);
  linkManager=WCMCoreUtils.getService(LinkManager.class);
  ExoContainer container=ExoContainerContext.getCurrentContainer();
  folderHandler=new FCKFolderHandler(container);
  fileHandler=new FCKFileHandler(container);
  fileUploadHandler=new FileUploadHandler();
}
Program: 102738
Project: 102738
Buggy source:
/** 
 * SERVICE: Edit title of document.
 * @param newTitle the new title of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 * @throws Exception the exception
 */
@POST @Path("String_Node_Str") public Response editTitle(@FormParam("String_Node_Str") String newTitle,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_TITLE,newTitle,repositoryName,workspaceName,nodeUIID,siteName,language);
}

Fixed version (ground truth):
/** 
 * SERVICE: Edit title of document.
 * @param newTitle the new title of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 */
@POST @Path("String_Node_Str") public Response editTitle(@FormParam("String_Node_Str") String newTitle,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_TITLE,newTitle,repositoryName,workspaceName,nodeUIID,siteName,language);
}
Program: 102739
Project: 102739
Buggy source:
/** 
 * SERVICE: Edit summary of document.
 * @param newValue the new summary of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 * @throws Exception the exception
 */
@POST @Path("String_Node_Str") public Response editText(@FormParam("String_Node_Str") String newValue,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_TEXT,newValue,repositoryName,workspaceName,nodeUIID,siteName,language);
}

Fixed version (ground truth):
/** 
 * SERVICE: Edit summary of document.
 * @param newValue the new summary of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 */
@POST @Path("String_Node_Str") public Response editText(@FormParam("String_Node_Str") String newValue,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_TEXT,newValue,repositoryName,workspaceName,nodeUIID,siteName,language);
}
Program: 102741
Project: 102741
Buggy source:
/** 
 * SERVICE: Edit summary of document.
 * @param newSummary the new summary of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 * @throws Exception the exception
 */
@POST @Path("String_Node_Str") public Response editSummary(@FormParam("String_Node_Str") String newSummary,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_SUMMARY,newSummary,repositoryName,workspaceName,nodeUIID,siteName,language);
}

Fixed version (ground truth):
/** 
 * SERVICE: Edit summary of document.
 * @param newSummary the new summary of document
 * @param repositoryName the repository name
 * @param workspaceName the workspace name
 * @param nodeUIID the UIID of node
 * @param siteName the site name
 * @return the response
 */
@POST @Path("String_Node_Str") public Response editSummary(@FormParam("String_Node_Str") String newSummary,@QueryParam("String_Node_Str") String repositoryName,@QueryParam("String_Node_Str") String workspaceName,@QueryParam("String_Node_Str") String nodeUIID,@QueryParam("String_Node_Str") String siteName,@QueryParam("String_Node_Str") String language){
  return modifyProperty(EXO_SUMMARY,newSummary,repositoryName,workspaceName,nodeUIID,siteName,language);
}
Program: 102743
Project: 102743
Buggy source:
/** 
 * Checks if is dMS document.(not including free layout webcontent & media & article)
 * @param node the node
 * @return true, if is dMS document
 * @throws Exception the exception
 */
private boolean isDMSDocument(Node node) throws Exception {
  TemplateService templateService=WCMCoreUtils.getService(TemplateService.class);
  List<String> dmsDocumentListTmp=templateService.getDocumentTemplates();
  List<String> dmsDocumentList=new ArrayList<String>();
  dmsDocumentList.addAll(dmsDocumentListTmp);
  dmsDocumentList.remove(NodetypeConstant.EXO_WEBCONTENT);
  for (  String documentType : dmsDocumentList) {
    if (node.getPrimaryNodeType().isNodeType(documentType) && !isMediaType(node) && !node.isNodeType(NodetypeConstant.EXO_WEBCONTENT)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if is dMS document.(not including free layout webcontent and media and article)
 * @param node the node
 * @return true, if is dMS document
 * @throws Exception the exception
 */
private boolean isDMSDocument(Node node) throws Exception {
  TemplateService templateService=WCMCoreUtils.getService(TemplateService.class);
  List<String> dmsDocumentListTmp=templateService.getDocumentTemplates();
  List<String> dmsDocumentList=new ArrayList<String>();
  dmsDocumentList.addAll(dmsDocumentListTmp);
  dmsDocumentList.remove(NodetypeConstant.EXO_WEBCONTENT);
  for (  String documentType : dmsDocumentList) {
    if (node.getPrimaryNodeType().isNodeType(documentType) && !isMediaType(node) && !node.isNodeType(NodetypeConstant.EXO_WEBCONTENT)) {
      return true;
    }
  }
  return false;
}
Program: 102744
Project: 102744
Buggy source:
/** 
 * Sets the page node.
 * @param pageNode the new page node
 */
public void setUserNode(UserNode userNode){
  this.userNode=userNode;
  if (userNode.getChildren() == null) {
    children=null;
  }
}

Fixed version (ground truth):
/** 
 * Sets the page node.
 * @param userNode the new user node
 */
public void setUserNode(UserNode userNode){
  this.userNode=userNode;
  if (userNode.getChildren() == null) {
    children=null;
  }
}
Program: 102745
Project: 102745
Buggy source:
/** 
 * Sets the children by page nodes.
 * @param pagesNodes the new children by page nodes
 * @throws Exception the exception
 */
public void setChildrenByUserNodes(Collection<UserNode> userNodes) throws Exception {
  if (userNodes == null)   return;
  List<TreeNode> list=new ArrayList<TreeNode>();
  UserPortalConfigService userPortalConfigService=WCMCoreUtils.getService(UserPortalConfigService.class);
  for (  UserNode pNode : userNodes) {
    if (pNode.getPageRef() == null)     continue;
    PageContext page=userPortalConfigService.getPage(pNode.getPageRef());
    if (page == null)     continue;
    TreeNode treeNode=new TreeNode(portalName,navigation,resourceBundle,true);
    treeNode.setUserNode(pNode);
    treeNode.setChildrenByUserNodes(pNode.getChildren());
    list.add(treeNode);
  }
  setTreeNodeChildren(list);
}

Fixed version (ground truth):
/** 
 * Sets the children by page nodes.
 * @param userNodes the new children by user nodes
 * @throws Exception the exception
 */
public void setChildrenByUserNodes(Collection<UserNode> userNodes) throws Exception {
  if (userNodes == null)   return;
  List<TreeNode> list=new ArrayList<TreeNode>();
  UserPortalConfigService userPortalConfigService=WCMCoreUtils.getService(UserPortalConfigService.class);
  for (  UserNode pNode : userNodes) {
    if (pNode.getPageRef() == null)     continue;
    PageContext page=userPortalConfigService.getPage(pNode.getPageRef());
    if (page == null)     continue;
    TreeNode treeNode=new TreeNode(portalName,navigation,resourceBundle,true);
    treeNode.setUserNode(pNode);
    treeNode.setChildrenByUserNodes(pNode.getChildren());
    list.add(treeNode);
  }
  setTreeNodeChildren(list);
}
Program: 102746
Project: 102746
Buggy source:
/** 
 * Instantiates a new tree node.
 * @param portalName the portal name
 * @param navigation the navigation
 * @param res the res
 * @param isPageNode the is page node
 */
public TreeNode(String portalName,final UserNavigation navigation,final ResourceBundle res,boolean isUserNode){
  this.portalName=portalName;
  this.navigation=navigation;
  this.resourceBundle=res;
  this.isUserNode=isUserNode;
}

Fixed version (ground truth):
/** 
 * Instantiates a new tree node.
 * @param portalName the portal name
 * @param navigation the navigation
 * @param res the res
 * @param isUserNode the is user node
 */
public TreeNode(String portalName,final UserNavigation navigation,final ResourceBundle res,boolean isUserNode){
  this.portalName=portalName;
  this.navigation=navigation;
  this.resourceBundle=res;
  this.isUserNode=isUserNode;
}
Program: 102747
Project: 102747
Buggy source:
public boolean createPowerPointDocument(String content,String fileName){
  try {
    SlideShow ppt=new SlideShow();
    Slide s1=ppt.createSlide();
    TextBox txt=new TextBox();
    txt.setText(content);
    s1.addShape(txt);
    FileOutputStream out=new FileOutputStream(fileName);
    ppt.write(out);
    out.close();
    return true;
  }
 catch (  Exception ex) {
    return false;
  }
}

Fixed version (ground truth):
public boolean createPowerPointDocument(String content,String fileName){
  try {
    SlideShow ppt=new HSLFSlideShow();
    Slide s1=ppt.createSlide();
    HSLFTextBox txt=new HSLFTextBox();
    txt.setText(content);
    s1.addShape(txt);
    FileOutputStream out=new FileOutputStream(fileName);
    ppt.write(out);
    out.close();
    return true;
  }
 catch (  Exception ex) {
    return false;
  }
}
Program: 102748
Project: 102748
Buggy source:
@Test public void whenAppendToFileUsingFileWriter_thenCorrect() throws IOException {
  String fileName="String_Node_Str";
  FileWriter fw=new FileWriter(fileName,true);
  BufferedWriter bw=new BufferedWriter(fw);
  bw.write("String_Node_Str");
  bw.newLine();
  bw.close();
  assertThat(StreamUtils.getStringFromInputStream(new FileInputStream(fileName))).isEqualTo("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Test public void whenAppendToFileUsingFileWriter_thenCorrect() throws IOException {
  FileWriter fw=new FileWriter(fileName,true);
  BufferedWriter bw=new BufferedWriter(fw);
  bw.write("String_Node_Str");
  bw.newLine();
  bw.close();
  assertThat(StreamUtils.getStringFromInputStream(new FileInputStream(fileName))).isEqualTo("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}
Program: 102749
Project: 102749
Buggy source:
@Test @Ignore public void givenConnection_thenFetchDbData(){
  List<Employee> employees=HikariCPDemo.fetchData();
  assertEquals(4,employees.size());
}

Fixed version (ground truth):
@Test @Ignore public void givenConnection_thenFetchDbData() throws SQLException {
  List<Employee> employees=HikariCPDemo.fetchData();
  assertEquals(4,employees.size());
}
Program: 102750
Project: 102750
Buggy source:
public void serialize(Distance distance,JsonGenerator generator,SerializerProvider provider) throws IOException, JsonProcessingException {
  generator.writeStartObject();
  generator.writeFieldName("String_Node_Str");
  generator.writeNumber(distance.name());
  generator.writeFieldName("String_Node_Str");
  generator.writeString(distance.getUnit());
  generator.writeFieldName("String_Node_Str");
  generator.writeNumber(distance.getMeters());
  generator.writeEndObject();
}

Fixed version (ground truth):
public void serialize(Distance distance,JsonGenerator generator,SerializerProvider provider) throws IOException, JsonProcessingException {
  generator.writeStartObject();
  generator.writeFieldName("String_Node_Str");
  generator.writeString(distance.name());
  generator.writeFieldName("String_Node_Str");
  generator.writeString(distance.getUnit());
  generator.writeFieldName("String_Node_Str");
  generator.writeNumber(distance.getMeters());
  generator.writeEndObject();
}