nus-yam/ex-repair huggingface dataset:
Program: 113822
Project: 113822
Buggy source:
/** 
 * Main loop.
 */
public void run(){
  RPCResponse<ServiceRegistrySet> r=null;
  try {
    r=client.service_get_by_type(null,Constants.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
  }
 catch (  Exception exc) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
    this.notifyCrashed(exc);
  }
 finally {
    if (r != null)     r.freeBuffers();
  }
  if (Logging.isInfo())   Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + config.getDirectoryService());
  notifyStarted();
  while (!quit) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
    r=null;
    try {
      r=client.service_get_by_type(null,Constants.SERVICE_TYPE_OSD);
      knownOSDs=r.get();
      evaluateResponse(knownOSDs);
    }
 catch (    Exception exc) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
    }
 finally {
      if (r != null)       r.freeBuffers();
    }
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
synchronized (this) {
      try {
        this.wait(checkIntervalMillis);
      }
 catch (      InterruptedException ex) {
      }
    }
  }
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  notifyStopped();
}

Fixed version (ground truth):
/** 
 * Main loop.
 */
public void run(){
  RPCResponse<ServiceRegistrySet> r=null;
  try {
    r=client.service_get_by_type(null,Constants.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
  }
 catch (  Exception exc) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
    this.notifyCrashed(exc);
  }
 finally {
    if (r != null)     r.freeBuffers();
  }
  if (Logging.isInfo())   Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + config.getDirectoryService());
  notifyStarted();
  while (!quit) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
    r=null;
    try {
      r=client.service_get_by_type(null,Constants.SERVICE_TYPE_OSD);
      knownOSDs=r.get();
      evaluateResponse(knownOSDs);
    }
 catch (    InterruptedException ex) {
      break;
    }
catch (    Exception exc) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
    }
 finally {
      if (r != null)       r.freeBuffers();
    }
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str");
synchronized (this) {
      try {
        this.wait(checkIntervalMillis);
      }
 catch (      InterruptedException ex) {
        break;
      }
    }
  }
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  notifyStopped();
}
Program: 113823
Project: 113823
Buggy source:
/** 
 * Shuts down the thread.
 */
public void shutdown(){
synchronized (this) {
    quit=true;
    this.notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Shuts down the thread.
 */
public void shutdown(){
synchronized (this) {
    quit=true;
    this.interrupt();
    this.notifyAll();
  }
}
Program: 113824
Project: 113824
Buggy source:
private long distance(ServiceRegistry osd) throws UnknownHostException {
  return 1;
}

Fixed version (ground truth):
private long distance(ServiceRegistry osd) throws UnknownHostException {
  String osduri=null;
  for (  KeyValuePair kv : osd.getData()) {
    if (kv.getKey().equals("String_Node_Str")) {
      osduri=kv.getValue();
      break;
    }
  }
  if (osduri == null)   return 10000000;
  byte[] osdAddress=InetAddress.getByName((URI.create(osduri).getHost())).getAddress();
  if (osdAddress[0] == clientAddress[0] && osdAddress[1] == clientAddress[1] && osdAddress[2] == clientAddress[2])   return 0;
  return Math.abs(inetAddressToLong(osdAddress) - clientAddressLong);
}
Program: 113826
Project: 113826
Buggy source:
public void run(){
}

Fixed version (ground truth):
@Override public void run(){
  try {
    for (    String fileName : fileList) {
      replicateFile(fileName);
    }
    shutdown();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 113830
Project: 113830
Buggy source:
@Override public FileMetadata createSymLink(long fileId,long parentId,String fileName,int atime,int ctime,int mtime,String userId,String groupId,String ref,AtomicDBUpdate update) throws DatabaseException {
  try {
    short collCount=BabuDBStorageHelper.findNextFreeFileCollisionNumber(database,dbName,parentId,fileName);
    if (collCount == -1)     throw new DatabaseException(ExceptionType.FILE_EXISTS);
    BufferBackedFileMetadata fileMetadata=new BufferBackedFileMetadata(parentId,fileName,userId,groupId,fileId,atime,ctime,mtime,ref.length(),(short)0xFFFF,0,(short)1,0,0,false,collCount);
    BufferBackedXAttr lt=new BufferBackedXAttr(fileId,SYSTEM_UID,LINK_TARGET_ATTR_NAME,ref,(short)0);
    update.addUpdate(XATTRS_INDEX,lt.getKeyBuf(),lt.getValBuf());
    update.addUpdate(FILE_INDEX,fileMetadata.getFCMetadataKey(),fileMetadata.getFCMetadataValue());
    update.addUpdate(FILE_INDEX,fileMetadata.getRCMetadata().getKey(),fileMetadata.getRCMetadata().getValue());
    update.addUpdate(FILE_ID_INDEX,BabuDBStorageHelper.createFileIdIndexKey(fileId,(byte)3),BabuDBStorageHelper.createFileIdIndexValue(parentId,fileName));
    return fileMetadata;
  }
 catch (  BabuDBException exc) {
    throw new DatabaseException(exc);
  }
}

Fixed version (ground truth):
@Override public FileMetadata createSymLink(long fileId,long parentId,String fileName,int atime,int ctime,int mtime,String userId,String groupId,String ref,AtomicDBUpdate update) throws DatabaseException {
  try {
    short collCount=BabuDBStorageHelper.findNextFreeFileCollisionNumber(database,dbName,parentId,fileName);
    if (collCount == -1)     throw new DatabaseException(ExceptionType.FILE_EXISTS);
    BufferBackedFileMetadata fileMetadata=new BufferBackedFileMetadata(parentId,fileName,userId,groupId,fileId,atime,ctime,mtime,ref.length(),0777,0,(short)1,0,0,false,collCount);
    BufferBackedXAttr lt=new BufferBackedXAttr(fileId,SYSTEM_UID,LINK_TARGET_ATTR_NAME,ref,(short)0);
    update.addUpdate(XATTRS_INDEX,lt.getKeyBuf(),lt.getValBuf());
    update.addUpdate(FILE_INDEX,fileMetadata.getFCMetadataKey(),fileMetadata.getFCMetadataValue());
    update.addUpdate(FILE_INDEX,fileMetadata.getRCMetadata().getKey(),fileMetadata.getRCMetadata().getValue());
    update.addUpdate(FILE_ID_INDEX,BabuDBStorageHelper.createFileIdIndexKey(fileId,(byte)3),BabuDBStorageHelper.createFileIdIndexValue(parentId,fileName));
    return fileMetadata;
  }
 catch (  BabuDBException exc) {
    throw new DatabaseException(exc);
  }
}
Program: 113831
Project: 113831
Buggy source:
@Override public void setOwnerAndGroup(String owner,String group){
  BufferBackedRCMetadata tmp=new BufferBackedRCMetadata(0,rcMetadata.getFileName(),owner,group,rcMetadata.getId(),rcMetadata.getPerms(),rcMetadata.getW32Attrs(),rcMetadata.getLinkCount(),rcMetadata.getEpoch(),rcMetadata.getIssuedEpoch(),rcMetadata.isReadOnly(),(short)0);
  rcMetadata=new BufferBackedRCMetadata(rcMetadata == null ? null : rcMetadata.getKey(),tmp.getValue());
}

Fixed version (ground truth):
@Override public void setOwnerAndGroup(String owner,String group){
  BufferBackedRCMetadata tmp=isDirectory() ? new BufferBackedRCMetadata(0,rcMetadata.getFileName(),owner,group,rcMetadata.getId(),rcMetadata.getPerms(),rcMetadata.getW32Attrs(),rcMetadata.getLinkCount(),(short)0) : new BufferBackedRCMetadata(0,rcMetadata.getFileName(),owner,group,rcMetadata.getId(),rcMetadata.getPerms(),rcMetadata.getW32Attrs(),rcMetadata.getLinkCount(),rcMetadata.getEpoch(),rcMetadata.getIssuedEpoch(),rcMetadata.isReadOnly(),(short)0);
  rcMetadata=new BufferBackedRCMetadata(rcMetadata == null ? null : rcMetadata.getKey(),tmp.getValue());
}
Program: 113833
Project: 113833
Buggy source:
public void enqueueFileForDeletion(String fileID){
  assert(this.isAlive());
  files.add(fileID);
}

Fixed version (ground truth):
public void enqueueFileForDeletion(String fileID){
  assert(this.isAlive());
  assert(fileID != null);
  files.add(fileID);
}
Program: 113835
Project: 113835
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    Args rqArgs=(Args)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    StorageManager sMan=vMan.getStorageManager(rqArgs.volumeID);
    String response=sMan == null ? "String_Node_Str" : "String_Node_Str";
    if (sMan != null)     try {
      if (rqArgs.fileIDs == null || rqArgs.fileIDs.size() == 0)       throw new UserException("String_Node_Str");
      for (      String fileId : rqArgs.fileIDs) {
        if (fileId == null)         throw new BackendException("String_Node_Str");
        response+=sMan.getMetadata(Long.parseLong(fileId)) != null ? "String_Node_Str" : "String_Node_Str";
      }
    }
 catch (    UserException ue) {
      response="String_Node_Str";
    }
catch (    BackendException be) {
      throw new BrainException("String_Node_Str" + be.getMessage());
    }
    rq.setData(ReusableBuffer.wrap(response.getBytes()));
    finishRequest(rq);
  }
 catch (  Exception exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,"String_Node_Str",exc));
  }
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq){
  try {
    Args rqArgs=(Args)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    StorageManager sMan=vMan.getStorageManager(rqArgs.volumeID);
    String response=sMan == null ? "String_Node_Str" : "String_Node_Str";
    if (sMan != null)     try {
      if (rqArgs.fileIDs == null || rqArgs.fileIDs.size() == 0)       throw new UserException("String_Node_Str");
      for (      String fileId : rqArgs.fileIDs) {
        if (fileId == null)         throw new BackendException("String_Node_Str");
        response+=sMan.getMetadata(Long.parseLong(fileId)) != null ? "String_Node_Str" : "String_Node_Str";
      }
    }
 catch (    UserException ue) {
      response="String_Node_Str";
    }
catch (    BackendException be) {
      throw new BrainException("String_Node_Str" + be.getMessage());
    }
    rq.setData(ReusableBuffer.wrap(JSONParser.writeJSON(response).getBytes()));
    finishRequest(rq);
  }
 catch (  Exception exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,"String_Node_Str",exc));
  }
}
Program: 113839
Project: 113839
Buggy source:
/** 
 * Converts an <code>XLocationsList</code> object to a list containing X-Locations data.
 * @param xLocList
 * @return
 */
public static List<Object> xLocListToList(XLocList xLocList){
  if (xLocList == null)   return null;
  List<Object> replicaList=new LinkedList<Object>();
  List<Object> list=new LinkedList<Object>();
  for (int i=0; i < xLocList.getReplicaCount(); i++) {
    XLoc replica=xLocList.getReplica(i);
    List<Object> replicaAsList=new ArrayList<Object>(2);
    Map<String,Object> policyMap=stripingPolicyToMap(replica.getStripingPolicy());
    List<String> osdList=new ArrayList<String>(replica.getOSDCount());
    for (int j=0; j < replica.getOSDCount(); j++)     osdList.add(replica.getOSD(i));
    replicaAsList.add(policyMap);
    replicaAsList.add(osdList);
    replicaList.add(replicaAsList);
  }
  list.add(replicaList);
  list.add(xLocList.getVersion());
  return list;
}

Fixed version (ground truth):
/** 
 * Converts an <code>XLocationsList</code> object to a list containing X-Locations data.
 * @param xLocList
 * @return
 */
public static List<Object> xLocListToList(XLocList xLocList){
  if (xLocList == null)   return null;
  List<Object> replicaList=new LinkedList<Object>();
  List<Object> list=new LinkedList<Object>();
  for (int i=0; i < xLocList.getReplicaCount(); i++) {
    XLoc replica=xLocList.getReplica(i);
    List<Object> replicaAsList=new ArrayList<Object>(2);
    Map<String,Object> policyMap=stripingPolicyToMap(replica.getStripingPolicy());
    List<String> osdList=new ArrayList<String>(replica.getOSDCount());
    for (int j=0; j < replica.getOSDCount(); j++)     osdList.add(replica.getOSD(j));
    replicaAsList.add(policyMap);
    replicaAsList.add(osdList);
    replicaList.add(replicaAsList);
  }
  list.add(replicaList);
  list.add(xLocList.getVersion());
  return list;
}
Program: 113840
Project: 113840
Buggy source:
@Override public StripingPolicy getDefaultStripingPolicy(long fileId) throws DatabaseException {
  try {
    String spString=getXAttr(fileId,SYSTEM_UID,DEFAULT_SP_ATTR_NAME);
    if (spString == null)     return null;
    return Converter.stringToStripingPolicy(this,spString);
  }
 catch (  DatabaseException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new DatabaseException(exc);
  }
}

Fixed version (ground truth):
@Override public StripingPolicy getDefaultStripingPolicy(long fileId) throws DatabaseException {
  try {
    String spString=getXAttr(fileId,SYSTEM_UID,DEFAULT_SP_ATTR_NAME);
    if (spString == null)     return null;
    return Converter.mapToStripingPolicy(this,(Map<String,Object>)JSONParser.parseJSON(new JSONString(spString)));
  }
 catch (  DatabaseException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new DatabaseException(exc);
  }
}
Program: 113844
Project: 113844
Buggy source:
/** 
 * Converts a map containing striping policy information to a <code>StripingPolicy</code> object.
 * @param policyMap
 * @return
 */
public static StripingPolicy mapToStripingPolicy(StorageManager sMan,Map<String,Object> policyMap){
  if (policyMap == null || policyMap.isEmpty())   return null;
  StripingPolicy policy=sMan.createStripingPolicy((String)policyMap.get("String_Node_Str"),((Long)policyMap.get("String_Node_Str")).intValue(),((Long)policyMap.get("String_Node_Str")).intValue());
  return policy;
}

Fixed version (ground truth):
/** 
 * Converts a map containing striping policy information to a <code>StripingPolicy</code> object.
 * @param policyMap
 * @return
 */
public static StripingPolicy mapToStripingPolicy(StorageManager sMan,Map<String,Object> policyMap){
  if (policyMap == null || policyMap.isEmpty() || ((String)policyMap.get("String_Node_Str")).isEmpty())   return null;
  StripingPolicy policy=sMan.createStripingPolicy((String)policyMap.get("String_Node_Str"),((Long)policyMap.get("String_Node_Str")).intValue(),((Long)policyMap.get("String_Node_Str")).intValue());
  return policy;
}
Program: 113846
Project: 113846
Buggy source:
@Override public void execute() throws DatabaseException {
  try {
    if (listener != null)     database.asyncInsert(ig,listener,context);
 else     database.syncInsert(ig);
  }
 catch (  BabuDBException exc) {
    throw new DatabaseException(exc);
  }
}

Fixed version (ground truth):
@Override public void execute() throws DatabaseException {
  try {
    if (listener != null) {
      database.syncInsert(ig);
      listener.insertFinished(context);
    }
 else     database.syncInsert(ig);
  }
 catch (  BabuDBException exc) {
    throw new DatabaseException(exc);
  }
}
Program: 113847
Project: 113847
Buggy source:
public VolumeInfo getVolumeById(String volumeId) throws DatabaseException, UserException {
  return volIdMap.get(volumeId);
}

Fixed version (ground truth):
public VolumeInfo getVolumeById(String volumeId) throws DatabaseException, UserException {
  VolumeInfo volume=volIdMap.get(volumeId);
  if (volume == null)   throw new UserException(ErrNo.ENOENT,"String_Node_Str" + volumeId + "String_Node_Str");
  return volume;
}
Program: 113848
Project: 113848
Buggy source:
public VolumeInfo getVolumeByName(String volumeName) throws DatabaseException, UserException {
  return volNameMap.get(volumeName);
}

Fixed version (ground truth):
public VolumeInfo getVolumeByName(String volumeName) throws DatabaseException, UserException {
  VolumeInfo info=volNameMap.get(volumeName);
  if (info == null)   throw new UserException(ErrNo.ENOENT,"String_Node_Str" + volumeName + "String_Node_Str");
  return info;
}
Program: 113850
Project: 113850
Buggy source:
@Override public void init(String ownerId,String owningGroupId,int perms,ACLEntry[] acl,Map<String,Object> rootDirDefSp,AtomicDBUpdate update) throws DatabaseException {
  int time=(int)(TimeSync.getGlobalTime() / 1000);
  createDir(1,0,volumeName,time,time,time,ownerId,owningGroupId,perms,0,update);
  setLastFileId(1,update);
  if (rootDirDefSp != null)   setDefaultStripingPolicy(1,Converter.mapToStripingPolicy(this,rootDirDefSp),update);
  if (acl != null)   for (  ACLEntry entry : acl)   setACLEntry(1L,entry.getEntity(),entry.getRights(),update);
}

Fixed version (ground truth):
@Override public void init(String ownerId,String owningGroupId,int perms,ACLEntry[] acl,Map<String,Object> rootDirDefSp,AtomicDBUpdate update) throws DatabaseException {
  try {
    int time=(int)(TimeSync.getGlobalTime() / 1000);
    createDir(1,0,volumeName,time,time,time,ownerId,owningGroupId,perms,0,update);
    setLastFileId(1,update);
    if (rootDirDefSp != null)     setDefaultStripingPolicy(1,Converter.mapToStripingPolicy(this,rootDirDefSp),update);
    if (acl != null)     for (    ACLEntry entry : acl)     setACLEntry(1L,entry.getEntity(),entry.getRights(),update);
  }
 catch (  UserException exc) {
    throw new DatabaseException(exc);
  }
}
Program: 113854
Project: 113854
Buggy source:
public void shutdown() throws Exception {
  try {
    String statusPageSnapshot=getStatusPage();
    BufferedWriter writer=new BufferedWriter(new FileWriter(config.getDbDir() + "String_Node_Str"));
    writer.write(statusPageSnapshot);
    writer.close();
  }
 catch (  Exception exc) {
  }
  if (pinkyStage != null)   pinkyStage.shutdown();
  if (dirServiceStage != null)   dirServiceStage.shutdown();
  if (pinkyStage != null)   pinkyStage.waitForShutdown();
  if (dirServiceStage != null)   dirServiceStage.waitForShutdown();
}

Fixed version (ground truth):
public void shutdown() throws Exception {
  if (pinkyStage != null)   pinkyStage.shutdown();
  if (dirServiceStage != null)   dirServiceStage.shutdown();
  if (pinkyStage != null)   pinkyStage.waitForShutdown();
  if (dirServiceStage != null)   dirServiceStage.waitForShutdown();
}
Program: 113855
Project: 113855
Buggy source:
public void requestFinished(MRCRequest request){
  assert(request != null);
  final PinkyRequest pr=request.getPinkyRequest();
  assert(pr != null);
  if (request.getError() != null) {
    final ErrorRecord error=request.getError();
switch (error.getErrorClass()) {
case REDIRECT:
{
        Logging.logMessage(Logging.LEVEL_ERROR,this,error.getErrorMessage() + "String_Node_Str" + request);
        HTTPHeaders headers=new HTTPHeaders();
        headers.addHeader(HTTPHeaders.HDR_LOCATION + "String_Node_Str" + error.getErrorMessage());
        pr.setResponse(HTTPUtils.SC_SEE_OTHER,null,DATA_TYPE.JSON,headers);
      }
case INTERNAL_SERVER_ERROR:
{
      Logging.logMessage(Logging.LEVEL_ERROR,this,error.getErrorMessage() + "String_Node_Str" + request);
      pr.setResponse(HTTPUtils.SC_SERVER_ERROR,error.getErrorMessage() + "String_Node_Str");
      break;
    }
case USER_EXCEPTION:
{
    pr.setResponse(HTTPUtils.SC_USER_EXCEPTION,error.toJSON());
    break;
  }
case BAD_REQUEST:
{
  pr.setResponse(HTTPUtils.SC_BAD_REQUEST,error.getErrorMessage());
  break;
}
default :
{
pr.setResponse(HTTPUtils.SC_SERVER_ERROR,"String_Node_Str" + error);
break;
}
}
if (request.getData() != null) BufferPool.free(request.getData());
}
 else {
if (request.getDataType() == null) request.setDataType(DATA_TYPE.JSON);
pr.setResponse(HTTPUtils.SC_OKAY,request.getData(),request.getDataType(),request.getAdditionalResponseHeaders());
}
pinkyStage.sendResponse(pr);
}

Fixed version (ground truth):
public void requestFinished(MRCRequest request){
  assert(request != null);
  final PinkyRequest pr=request.getPinkyRequest();
  assert(pr != null);
  if (request.getError() != null) {
    final ErrorRecord error=request.getError();
switch (error.getErrorClass()) {
case REDIRECT:
{
        Logging.logMessage(Logging.LEVEL_ERROR,this,error.getErrorMessage() + "String_Node_Str" + request);
        HTTPHeaders headers=new HTTPHeaders();
        headers.addHeader(HTTPHeaders.HDR_LOCATION + "String_Node_Str" + error.getErrorMessage());
        pr.setResponse(HTTPUtils.SC_SEE_OTHER,null,DATA_TYPE.JSON,headers);
        break;
      }
case INTERNAL_SERVER_ERROR:
{
      Logging.logMessage(Logging.LEVEL_ERROR,this,error.getErrorMessage() + "String_Node_Str" + request);
      pr.setResponse(HTTPUtils.SC_SERVER_ERROR,error.getErrorMessage() + "String_Node_Str");
      break;
    }
case USER_EXCEPTION:
{
    pr.setResponse(HTTPUtils.SC_USER_EXCEPTION,error.toJSON());
    break;
  }
case BAD_REQUEST:
{
  pr.setResponse(HTTPUtils.SC_BAD_REQUEST,error.getErrorMessage());
  break;
}
default :
{
pr.setResponse(HTTPUtils.SC_SERVER_ERROR,"String_Node_Str" + error);
break;
}
}
if (request.getData() != null) BufferPool.free(request.getData());
}
 else {
if (request.getDataType() == null) request.setDataType(DATA_TYPE.JSON);
pr.setResponse(HTTPUtils.SC_OKAY,request.getData(),request.getDataType(),request.getAdditionalResponseHeaders());
}
pinkyStage.sendResponse(pr);
}
Program: 113856
Project: 113856
Buggy source:
public void startup() throws Exception {
  speedyStage.start();
  speedyStage.waitForStartup();
  osdMonitor.start();
  osdMonitor.waitForStartup();
  procStage.start();
  procStage.waitForStartup();
  heartbeatThread.start();
  pinkyStage.start();
  pinkyStage.waitForStartup();
  volumeManager.init();
  volumeManager.addVolumeChangeListener(osdMonitor);
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + config.getPort());
}

Fixed version (ground truth):
public void startup() throws Exception {
  TimeSync.initialize(dirClient,config.getRemoteTimeSync(),config.getLocalClockRenew(),authString);
  UUIDResolver.start(dirClient,10 * 1000,600 * 1000);
  UUIDResolver.addLocalMapping(config.getUUID(),config.getPort(),config.isUsingSSL());
  speedyStage.start();
  speedyStage.waitForStartup();
  osdMonitor.start();
  osdMonitor.waitForStartup();
  procStage.start();
  procStage.waitForStartup();
  heartbeatThread.start();
  pinkyStage.start();
  pinkyStage.waitForStartup();
  volumeManager.init();
  volumeManager.addVolumeChangeListener(osdMonitor);
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + config.getPort());
}
Program: 113857
Project: 113857
Buggy source:
public void shutdown() throws Exception {
  pinkyStage.shutdown();
  pinkyStage.waitForShutdown();
  heartbeatThread.shutdown();
  osdMonitor.shutdown();
  osdMonitor.waitForShutdown();
  procStage.shutdown();
  procStage.waitForShutdown();
  UUIDResolver.shutdown();
  TimeSync.getInstance().shutdown();
  speedyStage.shutdown();
  speedyStage.waitForShutdown();
  volumeManager.shutdown();
}

Fixed version (ground truth):
public void shutdown() throws Exception {
  pinkyStage.shutdown();
  pinkyStage.waitForShutdown();
  heartbeatThread.shutdown();
  osdMonitor.shutdown();
  osdMonitor.waitForShutdown();
  procStage.shutdown();
  procStage.waitForShutdown();
  UUIDResolver.shutdown();
  speedyStage.shutdown();
  speedyStage.waitForShutdown();
  volumeManager.shutdown();
  TimeSync.getInstance().shutdown();
}
Program: 113859
Project: 113859
Buggy source:
@Override public void removeACLEntries(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,List<Object> entities,AtomicDBUpdate update) throws MRCException, UserException {
  try {
    Map<String,Object> entries=new HashMap<String,Object>();
    for (    Object entity : entities)     entries.put((String)entity,null);
    setACLEntries(sMan,file,parentId,userId,groupIds,entries,update);
  }
 catch (  UserException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new MRCException(exc);
  }
}

Fixed version (ground truth):
@Override public void removeACLEntries(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,List<Object> entities,AtomicDBUpdate update) throws MRCException, UserException {
  Map<String,Object> entries=new HashMap<String,Object>();
  for (  Object entity : entities)   entries.put((String)entity,null);
  setACLEntries(sMan,file,parentId,userId,groupIds,entries,update);
}
Program: 113860
Project: 113860
Buggy source:
@Override public void checkPermission(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,String accessMode) throws UserException, MRCException {
  assert(file != null);
  try {
    if (checkIfAllowed(sMan,accessMode,toRelativeACLRights(file.getPerms(),file,parentId,userId,groupIds),file,parentId,userId))     return;
 else     accessDenied(sMan.getVolumeId(),file,accessMode);
  }
 catch (  UserException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new MRCException(exc);
  }
}

Fixed version (ground truth):
@Override public void checkPermission(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,String accessMode) throws UserException, MRCException {
  assert(file != null);
  try {
    if (sMan.getACL(file.getId()).hasNext()) {
      ACLEntry entry=getRelevantACLEntry(sMan,file,parentId,userId,groupIds,accessMode);
      assert(entry != null);
      if (OTHER.equals(entry.getEntity()) || OWNER.equals(entry.getEntity())) {
        if (checkIfAllowed(sMan,accessMode,entry.getRights(),file,parentId,userId)) {
          return;
        }
 else         accessDenied(sMan.getVolumeId(),file,accessMode);
      }
      ACLEntry maskEntry=sMan.getACLEntry(file.getId(),MASK);
      if (checkIfAllowed(sMan,accessMode,entry.getRights(),file,parentId,userId) && (maskEntry == null || checkIfAllowed(sMan,accessMode,maskEntry.getRights(),file,parentId,userId)))       return;
 else       accessDenied(sMan.getVolumeId(),file,accessMode);
    }
 else {
      if (checkIfAllowed(sMan,accessMode,toRelativeACLRights(file.getPerms(),file,parentId,userId,groupIds),file,parentId,userId))       return;
 else       accessDenied(sMan.getVolumeId(),file,accessMode);
    }
  }
 catch (  UserException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new MRCException(exc);
  }
}
Program: 113862
Project: 113862
Buggy source:
@Override public ErrorRecord parseRPCBody(MRCRequest rq,List<Object> arguments){
  Args args=new Args();
  try {
    args.filePath=(String)arguments.get(0);
    if (arguments.size() == 1) {
      args.mode=511;
      return null;
    }
    args.xAttrs=(Map<String,Object>)arguments.get(1);
    args.mode=((Long)arguments.get(2)).shortValue();
    if (arguments.size() == 3)     return null;
    throw new Exception();
  }
 catch (  Exception exc) {
    try {
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str"+ JSONParser.writeJSON(arguments));
    }
 catch (    JSONException je) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str");
    }
  }
 finally {
    rq.setRequestArgs(args);
  }
}

Fixed version (ground truth):
@Override public ErrorRecord parseRPCBody(MRCRequest rq,List<Object> arguments){
  Args args=new Args();
  try {
    args.filePath=(String)arguments.get(0);
    if (arguments.size() == 1) {
      args.mode=511;
      return null;
    }
    args.xAttrs=(Map<String,Object>)arguments.get(1);
    args.mode=((Long)arguments.get(2)).intValue();
    if (arguments.size() == 3)     return null;
    throw new Exception();
  }
 catch (  Exception exc) {
    try {
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str"+ JSONParser.writeJSON(arguments));
    }
 catch (    JSONException je) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str");
    }
  }
 finally {
    rq.setRequestArgs(args);
  }
}
Program: 113863
Project: 113863
Buggy source:
@Override public ErrorRecord parseRPCBody(MRCRequest rq,List<Object> arguments){
  Args args=new Args();
  try {
    args.filePath=(String)arguments.get(0);
    if (arguments.size() == 1) {
      args.mode=511;
      return null;
    }
    args.xAttrs=(Map<String,Object>)arguments.get(1);
    args.stripingPolicy=(Map<String,Object>)arguments.get(2);
    args.mode=((Long)arguments.get(3)).shortValue();
    if (arguments.size() == 4)     return null;
    args.open=(Boolean)arguments.get(4);
    if (arguments.size() == 5)     return null;
    args.assignedXLocList=(List<Object>)arguments.get(5);
    if (arguments.size() == 6)     return null;
    throw new Exception();
  }
 catch (  Exception exc) {
    try {
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str"+ JSONParser.writeJSON(arguments));
    }
 catch (    JSONException je) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str");
    }
  }
 finally {
    rq.setRequestArgs(args);
  }
}

Fixed version (ground truth):
@Override public ErrorRecord parseRPCBody(MRCRequest rq,List<Object> arguments){
  Args args=new Args();
  try {
    args.filePath=(String)arguments.get(0);
    if (arguments.size() == 1) {
      args.mode=511;
      return null;
    }
    args.xAttrs=(Map<String,Object>)arguments.get(1);
    args.stripingPolicy=(Map<String,Object>)arguments.get(2);
    args.mode=((Long)arguments.get(3)).intValue();
    if (arguments.size() == 4)     return null;
    args.open=(Boolean)arguments.get(4);
    if (arguments.size() == 5)     return null;
    args.assignedXLocList=(List<Object>)arguments.get(5);
    if (arguments.size() == 6)     return null;
    throw new Exception();
  }
 catch (  Exception exc) {
    try {
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str"+ JSONParser.writeJSON(arguments));
    }
 catch (    JSONException je) {
      Logging.logMessage(Logging.LEVEL_ERROR,this,exc);
      return new ErrorRecord(ErrorClass.BAD_REQUEST,"String_Node_Str" + getClass().getSimpleName() + "String_Node_Str");
    }
  }
 finally {
    rq.setRequestArgs(args);
  }
}
Program: 113866
Project: 113866
Buggy source:
public void setPosixAccessRights(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,short posixAccessRights,AtomicDBUpdate update) throws MRCException, UserException {
  try {
    file.setPerms(posixAccessRights);
    sMan.setMetadata(parentId,file.getFileName(),file,FileMetadata.RC_METADATA,update);
    if (!sMan.getACL(file.getId()).hasNext())     return;
    short owr=(posixAccessRights & POSIX_OWNER_EXEC) > 0 ? EXEC_MASK : 0;
    owr|=(posixAccessRights & POSIX_OWNER_WRITE) > 0 ? WRITE_MASK : 0;
    owr|=(posixAccessRights & POSIX_OWNER_READ) > 0 ? READ_MASK : 0;
    owr|=(posixAccessRights & POSIX_SUID) > 0 ? PERM_SUID_SGID : 0;
    short grr=(posixAccessRights & POSIX_GROUP_EXEC) > 0 ? EXEC_MASK : 0;
    grr|=(posixAccessRights & POSIX_GROUP_WRITE) > 0 ? WRITE_MASK : 0;
    grr|=(posixAccessRights & POSIX_GROUP_READ) > 0 ? READ_MASK : 0;
    grr|=(posixAccessRights & POSIX_SGID) > 0 ? PERM_SUID_SGID : 0;
    short otr=(posixAccessRights & POSIX_OTHER_EXEC) > 0 ? EXEC_MASK : 0;
    otr|=(posixAccessRights & POSIX_OTHER_WRITE) > 0 ? WRITE_MASK : 0;
    otr|=(posixAccessRights & POSIX_OTHER_READ) > 0 ? READ_MASK : 0;
    sMan.setACLEntry(file.getId(),OWNER,owr,update);
    sMan.setACLEntry(file.getId(),OWNER_GROUP,grr,update);
    sMan.setACLEntry(file.getId(),MASK,grr,update);
    sMan.setACLEntry(file.getId(),OTHER,otr,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}

Fixed version (ground truth):
public void setPosixAccessRights(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,short posixAccessRights,AtomicDBUpdate update) throws MRCException, UserException {
  try {
    file.setPerms(posixAccessRights);
    sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
    if (!sMan.getACL(file.getId()).hasNext())     return;
    short owr=(posixAccessRights & POSIX_OWNER_EXEC) > 0 ? EXEC_MASK : 0;
    owr|=(posixAccessRights & POSIX_OWNER_WRITE) > 0 ? WRITE_MASK : 0;
    owr|=(posixAccessRights & POSIX_OWNER_READ) > 0 ? READ_MASK : 0;
    owr|=(posixAccessRights & POSIX_SUID) > 0 ? PERM_SUID_SGID : 0;
    short grr=(posixAccessRights & POSIX_GROUP_EXEC) > 0 ? EXEC_MASK : 0;
    grr|=(posixAccessRights & POSIX_GROUP_WRITE) > 0 ? WRITE_MASK : 0;
    grr|=(posixAccessRights & POSIX_GROUP_READ) > 0 ? READ_MASK : 0;
    grr|=(posixAccessRights & POSIX_SGID) > 0 ? PERM_SUID_SGID : 0;
    short otr=(posixAccessRights & POSIX_OTHER_EXEC) > 0 ? EXEC_MASK : 0;
    otr|=(posixAccessRights & POSIX_OTHER_WRITE) > 0 ? WRITE_MASK : 0;
    otr|=(posixAccessRights & POSIX_OTHER_READ) > 0 ? READ_MASK : 0;
    sMan.setACLEntry(file.getId(),OWNER,owr,update);
    sMan.setACLEntry(file.getId(),OWNER_GROUP,grr,update);
    sMan.setACLEntry(file.getId(),MASK,grr,update);
    sMan.setACLEntry(file.getId(),OTHER,otr,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}
Program: 113867
Project: 113867
Buggy source:
private static boolean checkIfAllowed(StorageManager sMan,String accessMode,short aclRights,FileMetadata file,long parentId,String userId) throws DatabaseException {
  if (accessMode.length() == 1) {
switch (accessMode.charAt(0)) {
case 'r':
      return (aclRights & PERM_READ) != 0;
case 'w':
    return (aclRights & PERM_WRITE) != 0;
case 'x':
  return (aclRights & PERM_EXECUTE) != 0;
case 'a':
return (aclRights & PERM_APPEND) != 0;
case 'c':
return (aclRights & PERM_CREATE) != 0;
case 't':
return (aclRights & PERM_TRUNCATE) != 0;
case 'd':
return (aclRights & PERM_DELETE) != 0;
case 'm':
assert(parentId != 0);
Object[] parentsParentIdAndName=sMan.getParentIdAndFileName(parentId);
FileMetadata parent=sMan.getMetadata((Long)parentsParentIdAndName[0],(String)parentsParentIdAndName[1]);
if ((parent.getPerms() & POSIX_STICKY) != 0) return file.getOwnerId().equals(userId);
 else return true;
}
}
 else if (accessMode.length() == 2) {
if (accessMode.equals("String_Node_Str") && (aclRights & PERM_GFS_APPEND) != 0) return true;
 else if (accessMode.equals("String_Node_Str") && (aclRights & PERM_STRICT_READ) != 0) return true;
}
return false;
}

Fixed version (ground truth):
private static boolean checkIfAllowed(StorageManager sMan,String accessMode,short aclRights,FileMetadata file,long parentId,String userId) throws DatabaseException {
  if (accessMode.length() == 1) {
switch (accessMode.charAt(0)) {
case 'r':
      return (aclRights & PERM_READ) != 0;
case 'w':
    return (aclRights & PERM_WRITE) != 0;
case 'x':
  return (aclRights & PERM_EXECUTE) != 0;
case 'a':
return (aclRights & PERM_APPEND) != 0;
case 'c':
return (aclRights & PERM_CREATE) != 0;
case 't':
return (aclRights & PERM_TRUNCATE) != 0;
case 'd':
return (aclRights & PERM_DELETE) != 0;
case 'm':
assert(parentId != 0);
FileMetadata parent=sMan.getMetadata(parentId);
if ((parent.getPerms() & POSIX_STICKY) != 0) return file.getOwnerId().equals(userId);
 else return true;
}
}
 else if (accessMode.length() == 2) {
if (accessMode.equals("String_Node_Str") && (aclRights & PERM_GFS_APPEND) != 0) return true;
 else if (accessMode.equals("String_Node_Str") && (aclRights & PERM_STRICT_READ) != 0) return true;
}
return false;
}
Program: 113870
Project: 113870
Buggy source:
public static long getId(BabuDB database,String dbName,long parentId,String fileName) throws BabuDBException {
  byte[] prefix=createFilePrefixKey(parentId,fileName,BufferBackedFileMetadata.RC_METADATA);
  Iterator<Entry<byte[],byte[]>> it=database.syncPrefixLookup(dbName,BabuDBStorageManager.FILE_INDEX,prefix);
  long id=-1;
  while (it.hasNext()) {
    Entry<byte[],byte[]> curr=it.next();
    String entryFileName=null;
    long entryId=-1;
    if (curr.getValue()[0] == 2) {
      entryId=ByteBuffer.wrap(curr.getValue()).getLong();
      entryFileName=new String(curr.getValue(),8,curr.getValue().length - 8);
    }
 else {
      BufferBackedRCMetadata md=new BufferBackedRCMetadata(curr.getKey(),curr.getValue());
      entryFileName=md.getFileName();
      entryId=md.getId();
    }
    if (entryFileName.equals(fileName)) {
      id=entryId;
      break;
    }
  }
  return id;
}

Fixed version (ground truth):
public static long getId(BabuDB database,String dbName,long parentId,String fileName) throws BabuDBException {
  byte[] prefix=createFilePrefixKey(parentId,fileName,BufferBackedFileMetadata.RC_METADATA);
  Iterator<Entry<byte[],byte[]>> it=database.syncPrefixLookup(dbName,BabuDBStorageManager.FILE_INDEX,prefix);
  long id=-1;
  while (it.hasNext()) {
    Entry<byte[],byte[]> curr=it.next();
    String entryFileName=null;
    long entryId=-1;
    if (curr.getValue()[0] == 2) {
      entryId=ByteBuffer.wrap(curr.getValue()).getLong();
      entryFileName=new String(curr.getValue(),9,curr.getValue().length - 9);
    }
 else {
      BufferBackedRCMetadata md=new BufferBackedRCMetadata(curr.getKey(),curr.getValue());
      entryFileName=md.getFileName();
      entryId=md.getId();
    }
    if (entryFileName.equals(fileName)) {
      id=entryId;
      break;
    }
  }
  return id;
}
Program: 113871
Project: 113871
Buggy source:
public ChildrenIterator(BabuDB database,String dbName,long parentId,Iterator<Entry<byte[],byte[]>> it){
  this.database=database;
  this.dbName=dbName;
  this.parentId=parentId;
  this.it=it;
  this.keyMap=new HashMap<Short,byte[][]>();
  this.valMap=new HashMap<Short,byte[][]>();
}

Fixed version (ground truth):
public ChildrenIterator(BabuDB database,String dbName,Iterator<Entry<byte[],byte[]>> it){
  this.database=database;
  this.dbName=dbName;
  this.it=it;
  this.keyMap=new HashMap<Short,byte[][]>();
  this.valMap=new HashMap<Short,byte[][]>();
}
Program: 113872
Project: 113872
Buggy source:
public static byte getType(byte[] key,boolean link){
  return key[link ? 8 : 12];
}

Fixed version (ground truth):
public static byte getType(byte[] key,int index){
  return key[index == BabuDBStorageManager.FILE_ID_INDEX ? 8 : 12];
}
Program: 113873
Project: 113873
Buggy source:
public SymbolScope buildSymbolScope(IResource resource){
  IFile file=(IFile)resource;
  String body="String_Node_Str";
  try {
    body=CharStreams.toString(new InputStreamReader(file.getContents()));
  }
 catch (  CoreException|IOException e) {
  }
  SourceFile virtualSourceFile=SourceFile.builder().setBody(body).setNamespace(Namespaces.EMPTY).build();
  ApexCompiler compiler=ApexCompiler.builder().setInput(new CompilationInput(Collections.singleton(virtualSourceFile),EmptySymbolProvider.get(),null,null,null)).build();
  SymbolScope scope=new SymbolScope(new StandardSymbolResolver(compiler),new Errors());
  return scope;
}

Fixed version (ground truth):
public SymbolScope buildSymbolScope(IResource resource){
  IFile file=(IFile)resource;
  String body="String_Node_Str";
  try {
    body=CharStreams.toString(new InputStreamReader(file.getContents()));
  }
 catch (  CoreException|IOException e) {
  }
  SourceFile virtualSourceFile=SourceFile.builder().setBody(body).setNamespace(Namespaces.EMPTY).build();
  return buildSymbolScope(virtualSourceFile);
}
Program: 113874
Project: 113874
Buggy source:
public AllUnitTests(){
  addTest(new com.salesforce.ide.ui.actions.AllUnitTests());
  addTest(new com.salesforce.ide.ui.packagemanifest.AllUnitTests());
  addTest(new com.salesforce.ide.ui.views.log.AllUnitTests());
  addTest(new com.salesforce.ide.ui.views.runtest.AllUnitTests());
}

Fixed version (ground truth):
public AllUnitTests(){
  addTest(new com.salesforce.ide.ui.actions.AllUnitTests());
  addTest(new com.salesforce.ide.ui.packagemanifest.AllUnitTests());
  addTest(new com.salesforce.ide.ui.views.log.AllUnitTests());
  addTest(new com.salesforce.ide.ui.views.runtest.test.AllUnitTests());
}
Program: 113875
Project: 113875
Buggy source:
public void setActiveProject(IProject project){
  if (project == null) {
    project=getFirstProject();
  }
  setSelectedProjectCombo(project);
  executeAnonymousController.setProject(project);
  if (loggingComposite != null) {
    loggingComposite.setProject(project);
  }
  if (project != null && project.getName().equals(projectCombo.getText())) {
    enableComposite(true);
  }
 else {
    enableComposite(false);
  }
}

Fixed version (ground truth):
/** 
 * Update the combo box and ExecuteAnonymousController with the selected project
 * @param project
 */
public void setActiveProject(IProject project){
  if (project == null) {
    project=getFirstProject();
  }
  setSelectedProjectCombo(project);
  executeAnonymousController.setProject(project);
  if (loggingComposite != null) {
    loggingComposite.setProject(project);
  }
  if (project != null && project.getName().equals(projectCombo.getText())) {
    enableComposite(true);
  }
 else {
    enableComposite(false);
  }
}
Program: 113876
Project: 113876
Buggy source:
private void updateProjectComboProjectedAdded(){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      List<IProject> projects=executeAnonymousController.getForceProjects();
      loadProjects(projects);
      return new Status(Status.OK,ForceIdeCorePlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
;
  job.setSystem(true);
  job.schedule();
}

Fixed version (ground truth):
/** 
 * Refresh the list of active projects, update the combo box, and stay on the already selected project
 */
private void updateProjectComboProjectedAdded(){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      List<IProject> projects=executeAnonymousController.getForceProjects();
      loadProjects(projects);
      return new Status(Status.OK,ForceIdeCorePlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
;
  job.setSystem(true);
  job.schedule();
}
Program: 113877
Project: 113877
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public void widgetSelected(org.eclipse.swt.events.SelectionEvent e){
  Combo tmpCboProject=(Combo)e.widget;
  if (tmpCboProject.getData() != null && tmpCboProject.getData() instanceof List) {
    List<IProject> projects=(List<IProject>)tmpCboProject.getData();
    if (Utils.isNotEmpty(projects)) {
      int selectionIndex=((Combo)e.widget).getSelectionIndex();
      IProject selectedProject=projects.get(selectionIndex);
      if (selectedProject != null) {
        setActiveProject(selectedProject);
      }
    }
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void widgetSelected(org.eclipse.swt.events.SelectionEvent e){
  Combo tmpCboProject=(Combo)e.widget;
  if (tmpCboProject.getData() != null && tmpCboProject.getData() instanceof List) {
    List<IProject> projects=(List<IProject>)tmpCboProject.getData();
    if (Utils.isNotEmpty(projects)) {
      int selectionIndex=((Combo)e.widget).getSelectionIndex();
      selectedProject=projects.get(selectionIndex);
      if (selectedProject != null) {
        setActiveProject(selectedProject);
      }
    }
  }
}
Program: 113878
Project: 113878
Buggy source:
protected void createProjectComposite(Composite cmpSource){
  projectComposite=new Composite(cmpSource,SWT.NONE);
  projectComposite.setLayoutData(new GridData(SWT.BEGINNING));
  GridLayout gridLayout=new GridLayout();
  gridLayout.numColumns=3;
  projectComposite.setLayout(gridLayout);
  CLabel lblProject=new CLabel(projectComposite,SWT.NONE);
  lblProject.setLayoutData(new GridData(SWT.BEGINNING));
  lblProject.setText("String_Node_Str");
  projectCombo=new Combo(projectComposite,SWT.DROP_DOWN | SWT.READ_ONLY);
  projectCombo.addSelectionListener(new org.eclipse.swt.events.SelectionListener(){
    @Override @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      Combo tmpCboProject=(Combo)e.widget;
      if (tmpCboProject.getData() != null && tmpCboProject.getData() instanceof List) {
        List<IProject> projects=(List<IProject>)tmpCboProject.getData();
        if (Utils.isNotEmpty(projects)) {
          int selectionIndex=((Combo)e.widget).getSelectionIndex();
          IProject selectedProject=projects.get(selectionIndex);
          if (selectedProject != null) {
            setActiveProject(selectedProject);
          }
        }
      }
    }
    @Override public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
      widgetSelected(e);
    }
  }
);
}

Fixed version (ground truth):
protected void createProjectComposite(Composite cmpSource){
  projectComposite=new Composite(cmpSource,SWT.NONE);
  projectComposite.setLayoutData(new GridData(SWT.BEGINNING));
  GridLayout gridLayout=new GridLayout();
  gridLayout.numColumns=3;
  projectComposite.setLayout(gridLayout);
  CLabel lblProject=new CLabel(projectComposite,SWT.NONE);
  lblProject.setLayoutData(new GridData(SWT.BEGINNING));
  lblProject.setText("String_Node_Str");
  projectCombo=new Combo(projectComposite,SWT.DROP_DOWN | SWT.READ_ONLY);
  projectCombo.addSelectionListener(new org.eclipse.swt.events.SelectionListener(){
    @Override @SuppressWarnings("String_Node_Str") public void widgetSelected(    org.eclipse.swt.events.SelectionEvent e){
      Combo tmpCboProject=(Combo)e.widget;
      if (tmpCboProject.getData() != null && tmpCboProject.getData() instanceof List) {
        List<IProject> projects=(List<IProject>)tmpCboProject.getData();
        if (Utils.isNotEmpty(projects)) {
          int selectionIndex=((Combo)e.widget).getSelectionIndex();
          selectedProject=projects.get(selectionIndex);
          if (selectedProject != null) {
            setActiveProject(selectedProject);
          }
        }
      }
    }
    @Override public void widgetDefaultSelected(    org.eclipse.swt.events.SelectionEvent e){
      widgetSelected(e);
    }
  }
);
}
Program: 113879
Project: 113879
Buggy source:
private void updateProjectComboProjectRemoved(final IProject project){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      if (projectCombo.getItemCount() > 0 && ArrayUtils.contains(projectCombo.getItems(),project.getName())) {
        projectCombo.remove(project.getName());
        if (projectCombo.getItemCount() > 0) {
          projectCombo.select(DEFAULT_PROJ_SELECTION);
        }
 else {
          projectCombo.setData(null);
          projectCombo.setEnabled(false);
          enableComposite(false);
        }
      }
      return new Status(Status.OK,ForceIdeCorePlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
;
  job.setSystem(true);
  job.schedule();
}

Fixed version (ground truth):
/** 
 * Remove the project from the combo box and  select first item in project list.
 */
private void updateProjectComboProjectRemoved(final IProject project){
  UIJob job=new UIJob("String_Node_Str"){
    @Override public IStatus runInUIThread(    IProgressMonitor monitor){
      if (projectCombo.getItemCount() > 0 && ArrayUtils.contains(projectCombo.getItems(),project.getName())) {
        projectCombo.remove(project.getName());
        if (projectCombo.getItemCount() > 0) {
          projectCombo.select(DEFAULT_PROJ_SELECTION);
        }
 else {
          projectCombo.setData(null);
          projectCombo.setEnabled(false);
          enableComposite(false);
        }
      }
      return new Status(Status.OK,ForceIdeCorePlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
;
  job.setSystem(true);
  job.schedule();
}
Program: 113880
Project: 113880
Buggy source:
private void loadProjects(List<IProject> projects){
  if (projectCombo.getItemCount() > 0)   projectCombo.removeAll();
  projectCombo.setData(projects);
  Collections.sort(projects,new Comparator<IProject>(){
    @Override public int compare(    IProject o1,    IProject o2){
      return String.CASE_INSENSITIVE_ORDER.compare(o1.getName(),o2.getName());
    }
  }
);
  for (  IProject project : projects) {
    projectCombo.add(project.getName());
  }
  projectCombo.select(DEFAULT_PROJ_SELECTION);
  projectCombo.setEnabled(true);
  projectAndLoggingContainerComposite.pack();
  projectAndLoggingContainerComposite.layout(true,true);
  enableComposite(true);
}

Fixed version (ground truth):
private void loadProjects(List<IProject> projects){
  if (projectCombo.getItemCount() > 0)   projectCombo.removeAll();
  projectCombo.setData(projects);
  Collections.sort(projects,new Comparator<IProject>(){
    @Override public int compare(    IProject o1,    IProject o2){
      return String.CASE_INSENSITIVE_ORDER.compare(o1.getName(),o2.getName());
    }
  }
);
  for (  IProject project : projects) {
    projectCombo.add(project.getName());
  }
  setActiveProject(selectedProject);
  projectCombo.setEnabled(true);
  projectAndLoggingContainerComposite.pack();
  projectAndLoggingContainerComposite.layout(true,true);
}