nus-yam/ex-repair huggingface dataset:
Program: 45496
Project: 45496
Buggy source:
public void triggerGoto(Vector3f position,Quaternion look){
  CellTransform transform=new CellTransform();
  transform.setRotation(look);
  transform.setTranslation(position);
  cell.getComponent(MovableComponent.class).localMoveRequest(transform);
  if (avatarCharacter != null)   avatarCharacter.getModelInst().setTransform(new PTransform(look,position,new Vector3f(1,1,1)));
}

Fixed version (ground truth):
public void triggerGoto(final Vector3f position,final Quaternion look){
  if (avatarCharacter != null) {
    SceneWorker.addWorker(new WorkCommit(){
      public void commit(){
        PTransform xform=new PTransform(look,position,new Vector3f(1,1,1));
        avatarCharacter.getModelInst().setTransform(xform);
      }
    }
);
  }
 else {
    CellTransform transform=new CellTransform();
    transform.setRotation(look);
    transform.setTranslation(position);
    cell.getComponent(MovableComponent.class).localMoveRequest(transform);
  }
}
Program: 45497
Project: 45497
Buggy source:
protected void sendUnloadMessages(Collection<CellDescription> removeCells){
  ManagedReference<AvatarCellCacheMO> viewCellCacheRef=AppContext.getDataManager().createReference(this);
  scheduler.startRevalidate();
  for (  CellDescription ref : removeCells) {
    if (setUnloaded(ref.getCellID())) {
      if (logger.isLoggable(Level.FINER)) {
        logger.fine("String_Node_Str" + ref.getCellID() + "String_Node_Str"+ identity.getUsername());
      }
      CellUnloadOp op=new CellUnloadOp(ref,clientID,viewCellCacheRef,capabilities);
      scheduler.schedule(op);
    }
  }
  scheduler.endRevalidate();
}

Fixed version (ground truth):
protected void sendUnloadMessages(Collection<CellDescription> removeCells){
  if (logger.isLoggable(Level.FINE)) {
    StringBuffer logBuf=new StringBuffer(getViewCell().getCellID() + "String_Node_Str");
    for (    CellDescription desc : removeCells) {
      logBuf.append(desc.getCellID() + "String_Node_Str");
    }
    logger.fine(logBuf.toString());
  }
  ManagedReference<AvatarCellCacheMO> viewCellCacheRef=AppContext.getDataManager().createReference(this);
  scheduler.startRevalidate();
  for (  CellDescription ref : removeCells) {
    if (setUnloaded(ref.getCellID())) {
      if (logger.isLoggable(Level.FINER)) {
        logger.fine("String_Node_Str" + ref.getCellID() + "String_Node_Str"+ identity.getUsername());
      }
      CellUnloadOp op=new CellUnloadOp(ref,clientID,viewCellCacheRef,capabilities);
      scheduler.schedule(op);
    }
  }
  scheduler.endRevalidate();
}
Program: 45498
Project: 45498
Buggy source:
protected void sendLoadMessages(Collection<CellDescription> cells){
  ManagedReference<AvatarCellCacheMO> viewCellCacheRef=AppContext.getDataManager().createReference(this);
  scheduler.startRevalidate();
  for (  CellDescription cellDescription : cells) {
    if (setLoaded(cellDescription.getCellID())) {
      if (logger.isLoggable(Level.FINER)) {
        logger.finer("String_Node_Str" + cellDescription.getCellID() + "String_Node_Str"+ identity.getUsername());
      }
      CellLoadOp op=new CellLoadOp(cellDescription,clientID,viewCellCacheRef,capabilities);
      scheduler.schedule(op);
    }
  }
  scheduler.endRevalidate();
}

Fixed version (ground truth):
protected void sendLoadMessages(Collection<CellDescription> cells){
  if (logger.isLoggable(Level.FINE)) {
    StringBuffer logBuf=new StringBuffer(getViewCell().getCellID() + "String_Node_Str");
    for (    CellDescription desc : cells) {
      logBuf.append(desc.getCellID() + "String_Node_Str");
    }
    logger.fine(logBuf.toString());
  }
  ManagedReference<AvatarCellCacheMO> viewCellCacheRef=AppContext.getDataManager().createReference(this);
  scheduler.startRevalidate();
  for (  CellDescription cellDescription : cells) {
    if (setLoaded(cellDescription.getCellID())) {
      if (logger.isLoggable(Level.FINER)) {
        logger.finer("String_Node_Str" + cellDescription.getCellID() + "String_Node_Str"+ identity.getUsername());
      }
      CellLoadOp op=new CellLoadOp(cellDescription,clientID,viewCellCacheRef,capabilities);
      scheduler.schedule(op);
    }
  }
  scheduler.endRevalidate();
}
Program: 45499
Project: 45499
Buggy source:
/** 
 * Update our cache because the given cells may have changed. Just like <code>generateLoadMessagesService()</code>, this method is responsible for enforcing security on the list of cells.
 * @param cells the cells to revalidate
 */
public void revalidateCellsService(Collection<CellDescription> cells){
  CellResourceManager crm=AppContext.getManager(CellResourceManager.class);
  SecurityManager security=AppContext.getManager(SecurityManager.class);
  ResourceMap rm=new ResourceMap();
  Map<CellID,CellDescription> check=new HashMap<CellID,CellDescription>();
  for (  CellDescription cell : cells) {
    Resource resource=crm.getCellResource(cell.getCellID());
    if (resource != null) {
      Resource r=new CellIDResource(cell.getCellID(),resource);
      rm.put(r.getId(),new ActionMap(r,new ViewAction()));
      check.put(cell.getCellID(),cell);
    }
  }
  if (check.size() > 0) {
    SecureTask checkCells=new RevalidateCellsTask(check,this);
    security.doSecure(rm,checkCells);
  }
}

Fixed version (ground truth):
/** 
 * Update our cache because the given cells may have changed. Just like <code>generateLoadMessagesService()</code>, this method is responsible for enforcing security on the list of cells.
 * @param cells the cells to revalidate
 */
public void revalidateCellsService(Collection<CellDescription> cells){
  CellResourceManager crm=AppContext.getManager(CellResourceManager.class);
  SecurityManager security=AppContext.getManager(SecurityManager.class);
  ResourceMap rm=new ResourceMap();
  Map<CellID,CellDescription> cellsMap=new LinkedHashMap<CellID,CellDescription>();
  for (  CellDescription cell : cells) {
    cellsMap.put(cell.getCellID(),cell);
    Resource resource=crm.getCellResource(cell.getCellID());
    if (resource != null) {
      Resource r=new CellIDResource(cell.getCellID(),resource);
      rm.put(r.getId(),new ActionMap(r,new ViewAction()));
    }
  }
  SecureTask checkCells=new RevalidateCellsTask(cellsMap,this);
  security.doSecure(rm,checkCells);
}
Program: 45500
Project: 45500
Buggy source:
public void run(ResourceMap grants){
  List<CellDescription> load=new LinkedList<CellDescription>();
  List<CellDescription> unload=new LinkedList<CellDescription>();
  ViewCellCacheMO cache=viewCellCacheRef.get();
  for (  ActionMap am : grants.values()) {
    CellID id=((CellIDResource)am.getResource()).getCellID();
    CellDescription desc=check.get(id);
    if (am.size() == 1 && !cache.isLoaded(id)) {
      load.add(desc);
    }
 else     if (am.size() == 0 && cache.isLoaded(id)) {
      unload.add(desc);
    }
  }
  cache.sendLoadMessages(load);
  cache.sendUnloadMessages(unload);
}

Fixed version (ground truth):
public void run(ResourceMap grants){
  Map<CellID,CellDescription> unloadCells=new LinkedHashMap<CellID,CellDescription>(cells);
  ViewCellCacheMO cache=viewCellCacheRef.get();
  for (  ActionMap am : grants.values()) {
    CellID id=((CellIDResource)am.getResource()).getCellID();
    if (am.size() == 0) {
      cells.remove(id);
    }
 else {
      unloadCells.remove(id);
    }
  }
  for (Iterator<CellID> loadCells=cells.keySet().iterator(); loadCells.hasNext(); ) {
    CellID loadID=loadCells.next();
    if (cache.isLoaded(loadID)) {
      loadCells.remove();
    }
    unloadCells.remove(loadID);
  }
  for (Iterator<CellID> unloads=unloadCells.keySet().iterator(); unloads.hasNext(); ) {
    CellID unloadID=unloads.next();
    if (!cache.isLoaded(unloadID)) {
      unloads.remove();
    }
  }
  cache.sendLoadMessages(cells.values());
  cache.sendUnloadMessages(unloadCells.values());
}
Program: 45501
Project: 45501
Buggy source:
public RevalidateCellsTask(Map<CellID,CellDescription> check,ViewCellCacheMO viewCellCache){
  this.check=check;
  viewCellCacheRef=AppContext.getDataManager().createReference(viewCellCache);
}

Fixed version (ground truth):
public RevalidateCellsTask(Map<CellID,CellDescription> cells,ViewCellCacheMO viewCellCache){
  this.cells=cells;
  viewCellCacheRef=AppContext.getDataManager().createReference(viewCellCache);
}
Program: 45502
Project: 45502
Buggy source:
/** 
 * Called by the UniverseService to request this cache generate load messages for the given cells.  Note that this list contains all the possible cells to load, regardless of any security on those cells. It is up to the cache to enforce security on this list, and only send updates to clients that this cell is allowed to see.
 * @param cells the set of cells to load
 */
public void generateLoadMessagesService(Collection<CellDescription> cells){
  CellResourceManager crm=AppContext.getManager(CellResourceManager.class);
  SecurityManager security=AppContext.getManager(SecurityManager.class);
  ResourceMap rm=new ResourceMap();
  Map<CellID,CellDescription> granted=new HashMap<CellID,CellDescription>();
  Map<CellID,CellDescription> check=new HashMap<CellID,CellDescription>();
  for (  CellDescription cell : cells) {
    Resource resource=crm.getCellResource(cell.getCellID());
    if (resource == null) {
      granted.put(cell.getCellID(),cell);
    }
 else {
      Resource r=new CellIDResource(cell.getCellID(),resource);
      rm.put(r.getId(),new ActionMap(r,new ViewAction()));
      check.put(cell.getCellID(),cell);
    }
  }
  if (check.size() > 0) {
    SecureTask checkLoad=new LoadCellsTask(check,granted,this);
    security.doSecure(rm,checkLoad);
  }
 else {
    sendLoadMessages(cells);
  }
}

Fixed version (ground truth):
/** 
 * Called by the UniverseService to request this cache generate load messages for the given cells.  Note that this list contains all the possible cells to load, regardless of any security on those cells. It is up to the cache to enforce security on this list, and only send updates to clients that this cell is allowed to see.
 * @param cells the set of cells to load
 */
public void generateLoadMessagesService(Collection<CellDescription> cells){
  CellResourceManager crm=AppContext.getManager(CellResourceManager.class);
  SecurityManager security=AppContext.getManager(SecurityManager.class);
  ResourceMap rm=new ResourceMap();
  Map<CellID,CellDescription> cellsMap=new LinkedHashMap<CellID,CellDescription>();
  for (  CellDescription cell : cells) {
    cellsMap.put(cell.getCellID(),cell);
    Resource resource=crm.getCellResource(cell.getCellID());
    if (resource != null) {
      Resource r=new CellIDResource(cell.getCellID(),resource);
      rm.put(r.getId(),new ActionMap(r,new ViewAction()));
    }
  }
  if (!rm.isEmpty()) {
    SecureTask checkLoad=new LoadCellsTask(cellsMap,this);
    security.doSecure(rm,checkLoad);
  }
 else {
    sendLoadMessages(cells);
  }
}
Program: 45503
Project: 45503
Buggy source:
public LoadCellsTask(Map<CellID,CellDescription> check,Map<CellID,CellDescription> granted,ViewCellCacheMO viewCellCache){
  this.check=check;
  this.granted=granted;
  viewCellCacheRef=AppContext.getDataManager().createReference(viewCellCache);
}

Fixed version (ground truth):
public LoadCellsTask(Map<CellID,CellDescription> cells,ViewCellCacheMO viewCellCache){
  this.cells=cells;
  viewCellCacheRef=AppContext.getDataManager().createReference(viewCellCache);
}
Program: 45504
Project: 45504
Buggy source:
public void run() throws Exception {
  List<CellOp> ops=opsRef.get();
  if (AGGREGATE_MESSAGES) {
    messageList=new MessageList();
  }
  int num=Math.min(ops.size(),count);
  for (int i=0; i < num; i++) {
    CellOp op=ops.remove(0);
    if (AGGREGATE_MESSAGES) {
      op.setMessageList(messageList);
    }
 else {
      op.setClientSender(sender);
    }
    op.run();
  }
  if (AGGREGATE_MESSAGES) {
    sender.send(clientID,messageList);
  }
  if (num > 0) {
    TaskManager tm=AppContext.getTaskManager();
    tm.scheduleTask(new SharedListRevalidateTask(sender,clientID,count,opsRef));
  }
}

Fixed version (ground truth):
public void run() throws Exception {
  List<CellOp> ops=opsRef.get();
  if (AGGREGATE_MESSAGES) {
    messageList=new MessageList();
  }
  int size=ops.size();
  int num=Math.min(size,count);
  for (int i=0; i < num; i++) {
    CellOp op=ops.remove(0);
    if (AGGREGATE_MESSAGES) {
      op.setMessageList(messageList);
    }
 else {
      op.setClientSender(sender);
    }
    op.run();
  }
  if (AGGREGATE_MESSAGES) {
    sender.send(clientID,messageList);
  }
  if (size - num > 0) {
    logger.fine("String_Node_Str" + (size - num) + "String_Node_Str"+ "String_Node_Str"+ count);
    TaskManager tm=AppContext.getTaskManager();
    tm.scheduleTask(new SharedListRevalidateTask(sender,clientID,count,opsRef));
  }
 else {
    logger.fine("String_Node_Str");
    opsRef.get().setTaskRunning(false);
  }
}
Program: 45505
Project: 45505
Buggy source:
public SharedListRevalidateScheduler(WonderlandClientSender sender,int count){
  this.sender=sender;
  this.count=count;
  DataManager dm=AppContext.getDataManager();
  List<CellOp> opsList=new ManagedLinkedList<CellOp>();
  opsRef=dm.createReference(opsList);
}

Fixed version (ground truth):
public SharedListRevalidateScheduler(WonderlandClientSender sender,int count){
  this.sender=sender;
  this.count=count;
  DataManager dm=AppContext.getDataManager();
  opsRef=dm.createReference(new OpsList());
}
Program: 45506
Project: 45506
Buggy source:
public SharedListRevalidateTask(WonderlandClientSender sender,WonderlandClientID clientID,int count,ManagedReference<List<CellOp>> opsRef){
  this.sender=sender;
  this.clientID=clientID;
  this.count=count;
  this.opsRef=opsRef;
}

Fixed version (ground truth):
public SharedListRevalidateTask(WonderlandClientSender sender,WonderlandClientID clientID,int count,ManagedReference<OpsList> opsRef){
  this.sender=sender;
  this.clientID=clientID;
  this.count=count;
  this.opsRef=opsRef;
}
Program: 45507
Project: 45507
Buggy source:
public void endRevalidate(){
  if (opsRef.get().size() > 0) {
    TaskManager tm=AppContext.getTaskManager();
    tm.scheduleTask(new SharedListRevalidateTask(sender,clientID,count,opsRef));
  }
}

Fixed version (ground truth):
public void endRevalidate(){
  logger.fine("String_Node_Str" + opsRef.get().size() + "String_Node_Str"+ "String_Node_Str"+ count+ "String_Node_Str"+ opsRef.get().isTaskRunning());
  if (!(opsRef.get().isTaskRunning())) {
    opsRef.get().setTaskRunning(true);
    TaskManager tm=AppContext.getTaskManager();
    tm.scheduleTask(new SharedListRevalidateTask(sender,clientID,count,opsRef));
  }
}
Program: 45508
Project: 45508
Buggy source:
/** 
 * Unload the cell from memory, sets the Cells status to DISK
 * @param cellId
 */
public void unloadCell(CellID cellId){
  Cell cell=cells.remove(cellId);
  if (cell != null) {
    logger.fine("String_Node_Str" + cell.getName());
    fireCellUnloaded(cell);
    setCellStatus(cell,CellStatus.DISK);
    if (cell.getParent() == null) {
      logger.fine("String_Node_Str" + cell.getName());
      rootCells.remove(cell);
    }
  }
 else {
    logger.log(Level.WARNING,"String_Node_Str" + cellId);
  }
}

Fixed version (ground truth):
/** 
 * Unload the cell from memory, sets the Cells status to DISK
 * @param cellId
 */
public void unloadCell(CellID cellId){
  Cell cell=cells.remove(cellId);
  if (cell != null) {
    logger.fine("String_Node_Str" + cell.getName());
    fireCellUnloaded(cell);
    setCellStatus(cell,CellStatus.DISK);
    if (cell.getParent() == null) {
      logger.fine("String_Node_Str" + cell.getName());
      rootCells.remove(cell);
    }
 else {
      cell.getParent().removeChild(cell);
    }
  }
 else {
    logger.log(Level.WARNING,"String_Node_Str" + cellId);
  }
}
Program: 45509
Project: 45509
Buggy source:
/** 
 * Remove a session from a communications protocol
 * @param protocol the communications protocol
 * @param session the client session associated with the given protocol
 */
public void remove(CommunicationsProtocol protocol,ClientSession session){
  DataManager dm=AppContext.getDataManager();
  ManagedReference sessionRef=dm.createReference(session);
  ManagedReference<ProtocolClientSet> ref=clientMap.get(protocol);
  if (ref != null) {
    ProtocolClientSet sessions=ref.getForUpdate();
    sessions.remove(sessionRef);
    if (sessions.isEmpty()) {
      clientMap.remove(protocol);
    }
  }
  protocolMap.remove(sessionRef);
}

Fixed version (ground truth):
/** 
 * Remove a session from a communications protocol
 * @param protocol the communications protocol
 * @param sessionRef a reference to the client session associated withthe given protocol
 */
public void remove(CommunicationsProtocol protocol,ManagedReference<ClientSession> sessionRef){
  ManagedReference<ProtocolClientSet> ref=clientMap.get(protocol);
  if (ref != null) {
    ProtocolClientSet sessions=ref.getForUpdate();
    sessions.remove(sessionRef);
    if (sessions.isEmpty()) {
      clientMap.remove(protocol);
    }
  }
  protocolMap.remove(sessionRef);
}
Program: 45510
Project: 45510
Buggy source:
/** 
 * Record a client of the given type disconnecting
 * @param protocol the protocol the session connected with
 * @param session the session that connected
 */
protected void recordDisconnect(CommunicationsProtocol protocol,ClientSession session){
  ProtocolClientMap pcm=getProtocolClientMap();
  DataManager dm=AppContext.getDataManager();
  dm.markForUpdate(pcm);
  pcm.remove(protocol,session);
}

Fixed version (ground truth):
/** 
 * Record a client of the given type disconnecting
 * @param protocol the protocol the session connected with
 * @param sessionRef a reference to the session that connected
 */
protected void recordDisconnect(CommunicationsProtocol protocol,ManagedReference<ClientSession> sessionRef){
  ProtocolClientMap pcm=getProtocolClientMap();
  DataManager dm=AppContext.getDataManager();
  dm.markForUpdate(pcm);
  pcm.remove(protocol,sessionRef);
}
Program: 45511
Project: 45511
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void releaseControlPerform(){
  if (!hasControl()) {
    return;
  }
  appControl=false;
  logger.info("String_Node_Str");
  updateControl();
  if (hasControl()) {
    return;
  }
  inputManager.removeKeyMouseFocus(new Entity[]{app.getFocusEntity()});
  numControlledApps--;
  if (numControlledApps <= 0) {
    App2D.invokeLater(new Runnable(){
      public void run(){
        releaseControlAllButtonSetVisible(false);
      }
    }
);
    inputManager.addKeyMouseFocus(inputManager.getGlobalFocusEntity());
    Canvas canvas=JmeClientMain.getFrame().getCanvas();
    if (!canvas.requestFocusInWindow()) {
      logger.info("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void releaseControlPerform(){
  if (!hasControl()) {
    return;
  }
  appControl=false;
  logger.info("String_Node_Str");
  updateControl();
  if (hasControl()) {
    return;
  }
  inputManager.removeKeyMouseFocus(new Entity[]{app.getFocusEntity()});
  numControlledApps--;
  if (numControlledApps <= 0) {
    App2D.invokeLater(new Runnable(){
      public void run(){
        releaseControlAllButtonSetVisible(false);
      }
    }
);
    inputManager.addKeyMouseFocus(inputManager.getGlobalFocusEntity());
    Canvas canvas=JmeClientMain.getFrame().getCanvas();
    canvas.setFocusable(true);
    if (!canvas.requestFocusInWindow()) {
      logger.info("String_Node_Str");
    }
  }
}
Program: 45512
Project: 45512
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void takeControlPerform(){
  if (hasControl()) {
    return;
  }
  logger.info("String_Node_Str");
  appControl=true;
  updateControl();
  if (!hasControl()) {
    return;
  }
  inputManager.addKeyMouseFocus(new Entity[]{app.getFocusEntity()});
  numControlledApps++;
  if (numControlledApps == 1) {
    inputManager.removeKeyMouseFocus(inputManager.getGlobalFocusEntity());
    App2D.invokeLater(new Runnable(){
      public void run(){
        releaseControlAllButtonSetVisible(true);
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void takeControlPerform(){
  if (hasControl()) {
    return;
  }
  logger.info("String_Node_Str");
  appControl=true;
  updateControl();
  if (!hasControl()) {
    return;
  }
  inputManager.addKeyMouseFocus(new Entity[]{app.getFocusEntity()});
  numControlledApps++;
  if (numControlledApps == 1) {
    inputManager.removeKeyMouseFocus(inputManager.getGlobalFocusEntity());
    JmeClientMain.getFrame().getCanvas().setFocusable(false);
    App2D.invokeLater(new Runnable(){
      public void run(){
        releaseControlAllButtonSetVisible(true);
      }
    }
);
  }
}
Program: 45514
Project: 45514
Buggy source:
public void update(Object obj){
  CellTransform transform=cell.getWorldTransform();
  Vector3f translation=transform.getTranslation(null);
  translation=translation.add(bounds.getCenter());
  rootNode.setLocalTranslation(translation);
  rootNode.setLocalRotation(transform.getRotation(null));
  wm.addToUpdateList(rootNode);
}

Fixed version (ground truth):
public void update(Object obj){
  CellTransform transform=cell.getWorldTransform();
  rootNode.setLocalTranslation(transform.getTranslation(null));
  rootNode.setLocalRotation(transform.getRotation(null));
  rootNode.setLocalScale(transform.getScaling(null));
  wm.addToUpdateList(rootNode);
}
Program: 45515
Project: 45515
Buggy source:
public void transformChanged(final Cell cell,ChangeSource source){
  final WorldManager wm=ClientContextJME.getWorldManager();
  RenderUpdater u=new RenderUpdater(){
    public void update(    Object obj){
      CellTransform transform=cell.getWorldTransform();
      Vector3f translation=transform.getTranslation(null);
      translation=translation.add(bounds.getCenter());
      rootNode.setLocalTranslation(translation);
      rootNode.setLocalRotation(transform.getRotation(null));
      wm.addToUpdateList(rootNode);
    }
  }
;
  wm.addRenderUpdater(u,this);
}

Fixed version (ground truth):
public void transformChanged(final Cell cell,ChangeSource source){
  final WorldManager wm=ClientContextJME.getWorldManager();
  RenderUpdater u=new RenderUpdater(){
    public void update(    Object obj){
      CellTransform transform=cell.getWorldTransform();
      rootNode.setLocalTranslation(transform.getTranslation(null));
      rootNode.setLocalRotation(transform.getRotation(null));
      rootNode.setLocalScale(transform.getScaling(null));
      wm.addToUpdateList(rootNode);
    }
  }
;
  wm.addRenderUpdater(u,this);
}
Program: 45518
Project: 45518
Buggy source:
public void removeRootSpatialCell(SpatialCellImpl cell){
  logger.fine("String_Node_Str" + cell.getCellID() + "String_Node_Str"+ getName());
synchronized (rootCells) {
    rootCells.remove(cell);
  }
synchronized (viewCaches) {
    cell.removeViewCache(viewCaches,this);
    ViewCache[] caches=viewCaches.toArray(new ViewCache[viewCaches.size()]);
    for (    ViewCache cache : caches)     cache.rootCellRemoved(cell);
  }
}

Fixed version (ground truth):
public void removeRootSpatialCell(SpatialCellImpl cell){
  logger.fine("String_Node_Str" + cell.getCellID() + "String_Node_Str"+ getName());
  try {
    acquireRootCellWriteLock();
    rootCells.remove(cell);
  }
  finally {
    releaseRootCellWriteLock();
  }
synchronized (viewCaches) {
    cell.removeViewCache(viewCaches,this);
    ViewCache[] caches=viewCaches.toArray(new ViewCache[viewCaches.size()]);
    for (    ViewCache cache : caches)     cache.rootCellRemoved(cell);
  }
}
Program: 45519
Project: 45519
Buggy source:
public void addRootSpatialCell(SpatialCellImpl cell){
  logger.fine("String_Node_Str" + cell.getCellID() + "String_Node_Str"+ getName());
synchronized (rootCells) {
    rootCells.add(cell);
  }
synchronized (viewCaches) {
    cell.addViewCache(viewCaches,this);
    ViewCache[] caches=viewCaches.toArray(new ViewCache[viewCaches.size()]);
    for (    ViewCache cache : caches)     cache.rootCellAdded(cell);
  }
}

Fixed version (ground truth):
public void addRootSpatialCell(SpatialCellImpl cell){
  logger.fine("String_Node_Str" + cell.getCellID() + "String_Node_Str"+ getName());
  try {
    acquireRootCellWriteLock();
    rootCells.add(cell);
  }
  finally {
    releaseRootCellWriteLock();
  }
synchronized (viewCaches) {
    cell.addViewCache(viewCaches,this);
    ViewCache[] caches=viewCaches.toArray(new ViewCache[viewCaches.size()]);
    for (    ViewCache cache : caches)     cache.rootCellAdded(cell);
  }
}
Program: 45520
Project: 45520
Buggy source:
/** 
 * Returns a snapshot of the set of root cells (no need to hold a lock when calling this method)
 * @return
 */
public Collection<SpatialCellImpl> getRootCells(){
synchronized (rootCells) {
    return (Collection<SpatialCellImpl>)rootCells.clone();
  }
}

Fixed version (ground truth):
/** 
 * Returns a snapshot of the set of root cells (no need to hold a lock when calling this method)
 * @return
 */
public Collection<SpatialCellImpl> getRootCells(){
  try {
    acquireRootCellReadLock();
    return (Collection<SpatialCellImpl>)rootCells.clone();
  }
  finally {
    releaseRootCellReadLock();
  }
}
Program: 45521
Project: 45521
Buggy source:
public void addViewCache(ViewCache cache){
synchronized (viewCaches) {
    viewCaches.add(cache);
synchronized (rootCells) {
      for (      SpatialCellImpl rootCell : rootCells) {
        rootCell.addViewCache(Collections.singletonList(cache),this);
      }
    }
  }
}

Fixed version (ground truth):
public void addViewCache(ViewCache cache){
  try {
    acquireRootCellReadLock();
synchronized (viewCaches) {
      viewCaches.add(cache);
      for (      SpatialCellImpl rootCell : rootCells) {
        rootCell.addViewCache(Collections.singletonList(cache),this);
      }
    }
  }
  finally {
    releaseRootCellReadLock();
  }
}
Program: 45522
Project: 45522
Buggy source:
public void removeViewCache(ViewCache cache){
synchronized (viewCaches) {
    viewCaches.remove(cache);
synchronized (rootCells) {
      for (      SpatialCellImpl rootCell : rootCells) {
        rootCell.removeViewCache(Collections.singletonList(cache),this);
      }
    }
  }
}

Fixed version (ground truth):
public void removeViewCache(ViewCache cache){
  try {
    acquireRootCellReadLock();
synchronized (viewCaches) {
      viewCaches.remove(cache);
      for (      SpatialCellImpl rootCell : rootCells) {
        rootCell.removeViewCache(Collections.singletonList(cache),this);
      }
    }
  }
  finally {
    releaseRootCellReadLock();
  }
}
Program: 45523
Project: 45523
Buggy source:
@Override public void commitEvent(Event event){
  SwingEnterExitEvent3D seeEvent=(SwingEnterExitEvent3D)event;
  if (!seeEvent.isEntered()) {
    InputManager.ensureKeyFocusInMainWindow();
  }
}

Fixed version (ground truth):
@Override public void commitEvent(Event event){
  SwingEnterExitEvent3D seeEvent=(SwingEnterExitEvent3D)event;
}
Program: 45524
Project: 45524
Buggy source:
/** 
 * Destroy this cell.
 */
public void destroy(){
  CellManagerMO.getCellManager().removeCellFromWorld(this);
  serverState=null;
  connectionInfo=null;
}

Fixed version (ground truth):
/** 
 * Destroy this cell.
 */
public void destroy(){
  CellManagerMO.getCellManager().removeCellFromWorld(this);
  connectionInfo=null;
}
Program: 45525
Project: 45525
Buggy source:
public UniverseService(Properties props,ComponentRegistry registry,TransactionProxy proxy){
  super(props,registry,proxy,logger);
  logger.log(Level.CONFIG,"String_Node_Str",props);
  PropertiesWrapper wrappedProps=new PropertiesWrapper(props);
  cellLoadCount=wrappedProps.getIntProperty(CELL_LOAD_PROP,CELL_LOAD_DEFAULT);
  ctxFactory=new TransactionContextFactoryImpl(proxy);
  changeApplication=new ChangeApplication();
  universe=new UniverseImpl(registry,proxy);
  try {
    transactionScheduler.runTask(new KernelRunnable(){
      public String getBaseTaskType(){
        return NAME + "String_Node_Str";
      }
      public void run(){
        checkServiceVersion(VERSION_KEY,MAJOR_VERSION,MINOR_VERSION);
      }
    }
,taskOwner);
  }
 catch (  Exception ex) {
    logger.logThrow(Level.SEVERE,ex,"String_Node_Str");
  }
}

Fixed version (ground truth):
public UniverseService(Properties props,ComponentRegistry registry,TransactionProxy proxy){
  super(props,registry,proxy,logger);
  logger.log(Level.CONFIG,"String_Node_Str",props);
  PropertiesWrapper wrappedProps=new PropertiesWrapper(props);
  cellLoadCount=wrappedProps.getIntProperty(CELL_LOAD_PROP,CELL_LOAD_DEFAULT);
  ctxFactory=new TransactionContextFactoryImpl(proxy);
  changeApplication=new ChangeApplication();
  universe=new UniverseImpl(registry,proxy,taskOwner);
  try {
    transactionScheduler.runTask(new KernelRunnable(){
      public String getBaseTaskType(){
        return NAME + "String_Node_Str";
      }
      public void run(){
        checkServiceVersion(VERSION_KEY,MAJOR_VERSION,MINOR_VERSION);
      }
    }
,taskOwner);
  }
 catch (  Exception ex) {
    logger.logThrow(Level.SEVERE,ex,"String_Node_Str");
  }
}
Program: 45526
Project: 45526
Buggy source:
void addTransformChangeListener(TransformChangeListenerSrv listener){
synchronized (transformChangeListenersSync) {
    if (transformChangeListeners == null)     transformChangeListeners=new ArrayList();
    transformChangeListeners.add(listener);
  }
}

Fixed version (ground truth):
void addTransformChangeListener(TransformChangeListenerSrv listener){
synchronized (transformChangeListenersSync) {
    if (transformChangeListeners == null)     transformChangeListeners=new ArrayList();
    transformChangeListeners.add(listener);
    Collection<TransformChangeListenerSrv> listeners=Collections.singleton(listener);
    UniverseImpl.getUniverse().scheduleTransaction(new TransformChangeNotificationTask(listeners,cellID,localTransform,worldTransform),null);
  }
}
Program: 45527
Project: 45527
Buggy source:
public void scheduleQueuedTransaction(KernelRunnable task,Identity identity,Object queueOwner){
synchronized (taskQueues) {
    TaskQueue queue=taskQueues.get(queueOwner);
    if (queue == null) {
      queue=transactionScheduler.createTaskQueue();
      taskQueues.put(queueOwner,queue);
    }
    queue.addTask(task,identity);
  }
}

Fixed version (ground truth):
public void scheduleQueuedTransaction(KernelRunnable task,Identity identity,Object queueOwner){
  if (identity == null) {
    identity=defaultTaskOwner;
  }
synchronized (taskQueues) {
    TaskQueue queue=taskQueues.get(queueOwner);
    if (queue == null) {
      queue=transactionScheduler.createTaskQueue();
      taskQueues.put(queueOwner,queue);
    }
    queue.addTask(task,identity);
  }
}
Program: 45528
Project: 45528
Buggy source:
public UniverseImpl(ComponentRegistry componentRegistry,TransactionProxy transactionProxy){
  this.transactionProxy=transactionProxy;
  this.dataService=transactionProxy.getService(DataService.class);
  this.transactionScheduler=componentRegistry.getComponent(TransactionScheduler.class);
  universe=this;
  logger.setLevel(Level.ALL);
}

Fixed version (ground truth):
public UniverseImpl(ComponentRegistry componentRegistry,TransactionProxy transactionProxy,Identity defaultTaskOwner){
  this.transactionProxy=transactionProxy;
  this.dataService=transactionProxy.getService(DataService.class);
  this.transactionScheduler=componentRegistry.getComponent(TransactionScheduler.class);
  this.defaultTaskOwner=defaultTaskOwner;
  universe=this;
  logger.setLevel(Level.ALL);
}
Program: 45529
Project: 45529
Buggy source:
public void scheduleTransaction(KernelRunnable transaction,Identity identity){
  transactionScheduler.scheduleTask(transaction,identity);
}

Fixed version (ground truth):
public void scheduleTransaction(KernelRunnable transaction,Identity identity){
  if (identity == null) {
    identity=defaultTaskOwner;
  }
  transactionScheduler.scheduleTask(transaction,identity);
}
Program: 45531
Project: 45531
Buggy source:
/** 
 * Specify the Swing component displayed in this window. The component is validated (that is it is layed out). Note: After you call <code>setComponent</code> the window will be in "preferred size" mode,  that is, it the window will be sized according to the Swing component's preferred sizes and  the component's layout manager. If you call <code>WindowSwing.setSize(int width, int height)</code> or  <code>WindowSwing.setSize(Dimension dims)</code> with a non-null <code>dims</code> the window will be  in "forced size" mode. This means that the window will always be the size you specify and this will constrain the sizes of the contained component. To switch back into preferred size mode call <code>WindowSwing.setSize(null)</code>.
 * @param component The component to be displayed.
 */
public void setComponent(Component component){
  if (this.component == component) {
    return;
  }
  this.component=component;
  if (embeddedPeer != null) {
    embeddedPeer.dispose();
    embeddedPeer=null;
  }
  if (component != null) {
    checkContainer();
  }
  addEventListener(new MySwingEnterExitListener());
  embeddedPeer.validate();
  embeddedPeer.repaint();
}

Fixed version (ground truth):
/** 
 * Specify the Swing component displayed in this window. The component is validated (that is it is layed out). Note: After you call <code>setComponent</code> the window will be in "preferred size" mode,  that is, it the window will be sized according to the Swing component's preferred sizes and  the component's layout manager. If you call <code>WindowSwing.setSize(int width, int height)</code> or  <code>WindowSwing.setSize(Dimension dims)</code> with a non-null <code>dims</code> the window will be  in "forced size" mode. This means that the window will always be the size you specify and this will constrain the sizes of the contained component. To switch back into preferred size mode call <code>WindowSwing.setSize(null)</code>.
 * @param component The component to be displayed.
 */
public void setComponent(Component component){
  if (this.component == component) {
    return;
  }
  this.component=component;
  if (embeddedPeer != null) {
    embeddedPeer.dispose();
    embeddedPeer=null;
  }
  if (component != null) {
    checkContainer();
  }
  addEventListener(new MySwingEnterExitListener());
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      embeddedPeer.validate();
    }
  }
);
  embeddedPeer.repaint();
}
Program: 45532
Project: 45532
Buggy source:
private void resolveAnnotations(Class clazz,Object o){
  Field[] fields=clazz.getDeclaredFields();
  for (  Field f : fields) {
    UsesCellComponent a=f.getAnnotation(UsesCellComponent.class);
    if (a != null) {
      if (logger.isLoggable(Level.FINE)) {
        logger.fine("String_Node_Str" + f.getName() + "String_Node_Str"+ f.getType());
      }
      Class componentClazz=f.getType();
      CellComponent comp=getComponent(CellComponent.getLookupClass(componentClazz));
      if (comp == null) {
        try {
          comp=(CellComponent)componentClazz.getConstructor(Cell.class).newInstance(this);
          addComponent(comp);
        }
 catch (        IllegalArgumentException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        InvocationTargetException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        NoSuchMethodException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        SecurityException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        InstantiationException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        IllegalAccessException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
      }
      try {
        f.setAccessible(true);
        f.set(o,comp);
      }
 catch (      IllegalArgumentException ex) {
        logger.log(Level.SEVERE,null,ex);
      }
catch (      IllegalAccessException ex) {
        logger.log(Level.SEVERE,null,ex);
      }
    }
  }
}

Fixed version (ground truth):
private void resolveAnnotations(Class clazz,Object o){
  Field[] fields=clazz.getDeclaredFields();
  for (  Field f : fields) {
    UsesCellComponent a=f.getAnnotation(UsesCellComponent.class);
    if (a != null) {
      if (logger.isLoggable(Level.FINE)) {
        logger.fine("String_Node_Str" + f.getName() + "String_Node_Str"+ f.getType());
      }
      Class componentClazz=f.getType();
      CellComponent comp=getComponent(CellComponentUtils.getLookupClass(componentClazz));
      if (comp == null) {
        try {
          comp=(CellComponent)componentClazz.getConstructor(Cell.class).newInstance(this);
          addComponent(comp);
        }
 catch (        IllegalArgumentException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        InvocationTargetException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        NoSuchMethodException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        SecurityException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        InstantiationException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
catch (        IllegalAccessException ex) {
          logger.log(Level.SEVERE,null,ex);
        }
      }
      try {
        f.setAccessible(true);
        f.set(o,comp);
      }
 catch (      IllegalArgumentException ex) {
        logger.log(Level.SEVERE,null,ex);
      }
catch (      IllegalAccessException ex) {
        logger.log(Level.SEVERE,null,ex);
      }
    }
  }
}
Program: 45534
Project: 45534
Buggy source:
/** 
 * Handles when a "remove" component message has been received by the client. Checks to see if the component class exists, and removes it
 */
private void removeComponent(CellClientComponentMessage message){
  String className=message.getCellComponentClientClassName();
  if (className == null) {
    return;
  }
  WonderlandSession session=cell.getCellCache().getSession();
  ServerSessionManager ssm=session.getSessionManager();
  ClassLoader cl=ssm.getClassloader();
  try {
    Class compClazz=cl.loadClass(className);
    Class clazz=CellComponent.getLookupClass(compClazz);
    cell.removeComponent(clazz);
  }
 catch (  java.lang.ClassNotFoundException excp) {
    logger.log(Level.WARNING,"String_Node_Str",excp);
  }
}

Fixed version (ground truth):
/** 
 * Handles when a "remove" component message has been received by the client. Checks to see if the component class exists, and removes it
 */
private void removeComponent(CellClientComponentMessage message){
  String className=message.getCellComponentClientClassName();
  if (className == null) {
    return;
  }
  WonderlandSession session=cell.getCellCache().getSession();
  ServerSessionManager ssm=session.getSessionManager();
  ClassLoader cl=ssm.getClassloader();
  try {
    Class compClazz=cl.loadClass(className);
    Class clazz=CellComponentUtils.getLookupClass(compClazz);
    cell.removeComponent(clazz);
  }
 catch (  java.lang.ClassNotFoundException excp) {
    logger.log(Level.WARNING,"String_Node_Str",excp);
  }
}
Program: 45535
Project: 45535
Buggy source:
/** 
 * Handles when an "add" component message has been received by the client. Checks to see if the component exists, and creates it if necessary.
 */
private void addComponent(CellClientComponentMessage message){
  CellComponentClientState clientState=message.getCellComponentClientState();
  String compClassname=message.getCellComponentClientClassName();
  if (compClassname == null) {
    return;
  }
  try {
    WonderlandSession session=cell.getCellCache().getSession();
    ServerSessionManager ssm=session.getSessionManager();
    ClassLoader cl=ssm.getClassloader();
    Class compClazz=cl.loadClass(compClassname);
    Class lookupClazz=CellComponent.getLookupClass(compClazz);
    CellComponent component=cell.getComponent(lookupClazz);
    if (component == null) {
      Constructor<CellComponent> constructor=compClazz.getConstructor(Cell.class);
      component=constructor.newInstance(cell);
      component.setClientState(clientState);
      cell.addComponent(component,CellComponent.getLookupClass(component.getClass()));
    }
 else {
      component.setClientState(clientState);
    }
  }
 catch (  InstantiationException ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + compClassname + "String_Node_Str"+ getClass().getName(),ex);
  }
catch (  ClassNotFoundException ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + compClassname,ex);
  }
catch (  Exception ex) {
    logger.log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
/** 
 * Handles when an "add" component message has been received by the client. Checks to see if the component exists, and creates it if necessary.
 */
private void addComponent(CellClientComponentMessage message){
  CellComponentClientState clientState=message.getCellComponentClientState();
  String compClassname=message.getCellComponentClientClassName();
  if (compClassname == null) {
    return;
  }
  try {
    WonderlandSession session=cell.getCellCache().getSession();
    ServerSessionManager ssm=session.getSessionManager();
    ClassLoader cl=ssm.getClassloader();
    Class compClazz=cl.loadClass(compClassname);
    Class lookupClazz=CellComponentUtils.getLookupClass(compClazz);
    CellComponent component=cell.getComponent(lookupClazz);
    if (component == null) {
      Constructor<CellComponent> constructor=compClazz.getConstructor(Cell.class);
      component=constructor.newInstance(cell);
      component.setClientState(clientState);
      cell.addComponent(component,CellComponentUtils.getLookupClass(component.getClass()));
    }
 else {
      component.setClientState(clientState);
    }
  }
 catch (  InstantiationException ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + compClassname + "String_Node_Str"+ getClass().getName(),ex);
  }
catch (  ClassNotFoundException ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + compClassname,ex);
  }
catch (  Exception ex) {
    logger.log(Level.SEVERE,null,ex);
  }
}
Program: 45536
Project: 45536
Buggy source:
/** 
 * Returns a CellComponentServerState given its Class, or null if a server state object is not present on the cell server state class of the given Class type.
 * @param clazz The Class of the component server-state object
 * @return The component server state object if it exist, null otherwise
 */
public CellComponentServerState getComponentServerState(Class clazz){
  return internalComponentMap.get(clazz);
}

Fixed version (ground truth):
/** 
 * Returns a CellComponentServerState given its Class, or null if a server state object is not present on the cell server state class of the given Class type.
 * @param clazz The Class of the component server-state object
 * @return The component server state object if it exist, null otherwise
 */
public CellComponentServerState getComponentServerState(Class clazz){
  Class lookupClass=CellComponentUtils.getLookupClass(clazz);
  return internalComponentMap.get(lookupClass);
}
Program: 45537
Project: 45537
Buggy source:
/** 
 * Takes the input reader of the XML file and instantiates an instance of the CellServerState class. Also takes the unmarshaller to use to decode the server state. Appropriate unmarshallers can be retrieved from the CellServerStateFactory. <p>
 * @param r The input data of the version XML data
 * @param unmarshaller the unmarshaller to use while decoding. If nounmashaller is specified, the unmarshaller associated with the system classloader will be used.
 * @throw ClassCastException If the input data does not map to CellServerState
 * @throw JAXBException Upon error reading the XML data
 */
public static CellServerState decode(Reader r,Unmarshaller unmarshaller) throws JAXBException {
  if (unmarshaller == null) {
    unmarshaller=CellServerStateFactory.getUnmarshaller(null);
  }
  CellServerState setup=(CellServerState)unmarshaller.unmarshal(r);
  if (setup.metadata != null) {
    ListIterator<HashMapEntry> iterator=setup.metadata.entries.listIterator();
    setup.internalMetaData=new HashMap<String,String>();
    while (iterator.hasNext() == true) {
      HashMapEntry entry=iterator.next();
      setup.internalMetaData.put(entry.key,entry.value);
    }
  }
 else {
    setup.internalMetaData=null;
  }
  if (setup.components != null) {
    setup.internalComponentMap=new HashMap();
    for (    CellComponentServerState state : setup.components) {
      setup.internalComponentMap.put(state.getClass(),state);
    }
  }
 else {
    setup.internalComponentMap=null;
  }
  return setup;
}

Fixed version (ground truth):
/** 
 * Takes the input reader of the XML file and instantiates an instance of the CellServerState class. Also takes the unmarshaller to use to decode the server state. Appropriate unmarshallers can be retrieved from the CellServerStateFactory. <p>
 * @param r The input data of the version XML data
 * @param unmarshaller the unmarshaller to use while decoding. If nounmashaller is specified, the unmarshaller associated with the system classloader will be used.
 * @throw ClassCastException If the input data does not map to CellServerState
 * @throw JAXBException Upon error reading the XML data
 */
public static CellServerState decode(Reader r,Unmarshaller unmarshaller) throws JAXBException {
  if (unmarshaller == null) {
    unmarshaller=CellServerStateFactory.getUnmarshaller(null);
  }
  CellServerState setup=(CellServerState)unmarshaller.unmarshal(r);
  if (setup.metadata != null) {
    ListIterator<HashMapEntry> iterator=setup.metadata.entries.listIterator();
    setup.internalMetaData=new HashMap<String,String>();
    while (iterator.hasNext() == true) {
      HashMapEntry entry=iterator.next();
      setup.internalMetaData.put(entry.key,entry.value);
    }
  }
 else {
    setup.internalMetaData=null;
  }
  if (setup.components != null) {
    setup.internalComponentMap=new HashMap();
    for (    CellComponentServerState state : setup.components) {
      Class lookupClass=CellComponentUtils.getLookupClass(state.getClass());
      setup.internalComponentMap.put(lookupClass,state);
    }
  }
 else {
    setup.internalComponentMap=null;
  }
  return setup;
}
Program: 45538
Project: 45538
Buggy source:
/** 
 * Removes a CellComponentServerState given its Class. If a server state for the given Class does not exist, this method does nothing.
 * @param clazz The Class of the component server-state object
 */
public void removeComponentServerState(Class clazz){
  internalComponentMap.remove(clazz);
}

Fixed version (ground truth):
/** 
 * Removes a CellComponentServerState given its Class. If a server state for the given Class does not exist, this method does nothing.
 * @param clazz The Class of the component server-state object
 */
public void removeComponentServerState(Class clazz){
  Class lookupClass=CellComponentUtils.getLookupClass(clazz);
  internalComponentMap.remove(lookupClass);
}
Program: 45539
Project: 45539
Buggy source:
/** 
 * Adds a component server state. If a server state of the same Class has already been added, this replaces the existing server state.
 * @param serverState The component server state to add
 */
public void addComponentServerState(CellComponentServerState serverState){
  internalComponentMap.put(serverState.getClass(),serverState);
}

Fixed version (ground truth):
/** 
 * Adds a component server state. If a server state of the same Class has already been added, this replaces the existing server state.
 * @param serverState The component server state to add
 */
public void addComponentServerState(CellComponentServerState serverState){
  Class lookupClass=CellComponentUtils.getLookupClass(serverState.getClass());
  internalComponentMap.put(lookupClass,serverState);
}
Program: 45540
Project: 45540
Buggy source:
private boolean isInGroup(Set<Principal> principals){
  for (  Principal p : principals) {
    System.out.println("String_Node_Str" + p + "String_Node_Str"+ group);
    if (p.getType() == Type.GROUP) {
      String name=p.getId();
      if (name.equals(group) || name.equals("String_Node_Str")) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isInGroup(Set<Principal> principals){
  logger.fine("String_Node_Str" + principals.size() + "String_Node_Str"+ group);
  for (  Principal p : principals) {
    logger.fine("String_Node_Str" + p + "String_Node_Str"+ group);
    if (p.getType() == Type.GROUP) {
      String name=p.getId();
      if (name.equals(group) || name.equals("String_Node_Str")) {
        logger.fine("String_Node_Str" + p + "String_Node_Str"+ group);
        return true;
      }
    }
  }
  return false;
}