nus-yam/ex-repair huggingface dataset:
Program: 46169
Project: 46169
Buggy source:
/** 
 * Configure (that is, resize, move or restack) a window.
 * @param win The window to configure.
 * @param msg The message arguments which have been read for the ConfigureWindow message.
 */
private void configureWindow(WindowXrw win,ConfigureWindowMsgArgs msg){
  if (msg.clientId == clientId) {
    if (msg.wAndBorder != win.getWidth() || msg.hAndBorder != win.getHeight()) {
    }
 else {
    }
  }
  WindowXrw sibWin=lookupWindow(msg.sibid);
  win.setScreenPosition(msg.x,msg.y);
  win.setSize(msg.wAndBorder,msg.hAndBorder);
  win.restackAbove(sibWin);
}

Fixed version (ground truth):
/** 
 * Configure (that is, resize, move or restack) a window.
 * @param win The window to configure.
 * @param msg The message arguments which have been read for the ConfigureWindow message.
 */
private void configureWindow(WindowXrw win,ConfigureWindowMsgArgs msg){
  if (msg.clientId == clientId) {
    if (msg.wAndBorder != win.getWidth() || msg.hAndBorder != win.getHeight()) {
    }
 else {
    }
  }
  if (msg.wAndBorder > WINDOW_MAX_WIDTH) {
    msg.wAndBorder=WINDOW_MAX_WIDTH;
    AppXrw.logger.warning("String_Node_Str" + msg.wAndBorder + "String_Node_Str");
  }
  if (msg.hAndBorder > WINDOW_MAX_HEIGHT) {
    msg.hAndBorder=WINDOW_MAX_HEIGHT;
    AppXrw.logger.warning("String_Node_Str" + msg.hAndBorder + "String_Node_Str");
  }
  WindowXrw sibWin=lookupWindow(msg.sibid);
  win.setScreenPosition(msg.x,msg.y);
  win.setSize(msg.wAndBorder,msg.hAndBorder);
  win.restackAbove(sibWin);
}
Program: 46170
Project: 46170
Buggy source:
/** 
 * Actually perform the pick.
 */
private PickInfo pickEventScreenPos(int x,int y){
  if (cameraComp == null)   return null;
  logger.fine("String_Node_Str" + x + "String_Node_Str"+ y);
  Ray pickRayWorld=calcPickRayWorld(x,y);
  return collisionSys.pickAllWorldRay(pickRayWorld,true,false,true,cameraComp);
}

Fixed version (ground truth):
/** 
 * Actually perform the pick.
 */
PickInfo pickEventScreenPos(int x,int y){
  if (cameraComp == null)   return null;
  logger.fine("String_Node_Str" + x + "String_Node_Str"+ y);
  Ray pickRayWorld=calcPickRayWorld(x,y);
  return collisionSys.pickAllWorldRay(pickRayWorld,true,false,true,cameraComp);
}
Program: 46171
Project: 46171
Buggy source:
/** 
 * Given a point in the pixel space of the Wonderland canvas calculates the texel coordinates of the point on the geometry where a ray starting from the current eye position intersects the geometry. Note on subclassing: If the geometry is nonplanar it is recommended that the subclass implement this method by performing a pick. If this pick misses the subclass will need to decide how to handle the miss. One possible way to handle this is to assume that there is a planar "halo" surrounding the the window with which the ray can be intersected.
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  Ray rayWorld=InputManager3D.getInputManager().pickRayWorld(x,y);
  float width=view.getDisplayerLocalWidth();
  float height=view.getDisplayerLocalHeight();
  Vector3f topLeftLocal=new Vector3f(-width / 2f,height / 2f,0f);
  Matrix4f local2World=getLocalToWorldMatrix(null);
  Vector3f topLeftWorld=local2World.mult(topLeftLocal,new Vector3f());
  Vector3f planeNormalWorld=getPlaneNormalWorld();
  Vector3f intPointWorld=calcPlanarIntersection(rayWorld,topLeftWorld,planeNormalWorld);
  if (intPointWorld == null) {
    return null;
  }
  Point pt=calcPositionInPixelCoordinates(intPointWorld,false);
  logger.fine("String_Node_Str" + pt);
  return pt;
}

Fixed version (ground truth):
/** 
 * Given a point in the pixel space of the Wonderland canvas calculates the texel coordinates of the point on the geometry where a ray starting from the current eye position intersects the geometry. Note on subclassing: If the geometry is nonplanar it is recommended that the subclass implement this method by performing a pick. If this pick misses the subclass will need to decide how to handle the miss. One possible way to handle this is to assume that there is a planar "halo" surrounding the the window with which the ray can be intersected.
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  Ray rayWorld=InputManager3D.getInputManager().pickRayWorld(x,y);
  float width=view.getDisplayerLocalWidth();
  float height=view.getDisplayerLocalHeight();
  Vector3f topLeftLocal=new Vector3f(-width / 2f,height / 2f,0f);
  Matrix4f local2World=getLocalToWorldMatrix(null);
  Vector3f topLeftWorld=local2World.mult(topLeftLocal,new Vector3f());
  Vector3f planeNormalWorld=getPlaneNormalWorld();
  Vector3f intPointWorld=calcPlanarIntersection(rayWorld,topLeftWorld,planeNormalWorld);
  if (intPointWorld == null) {
    return null;
  }
  logger.fine("String_Node_Str" + intPointWorld);
  Point pt=calcPositionInPixelCoordinates(intPointWorld,false);
  logger.fine("String_Node_Str" + pt);
  return pt;
}
Program: 46172
Project: 46172
Buggy source:
private Vector3f calcOffsetTranslation(){
  Vector3f translation=new Vector3f();
  if (parent == null)   return translation;
  Vector2f pixelScale=getPixelScaleCurrent();
  Dimension parentSize=parent.getSizeApp();
  translation.x=-parentSize.width * pixelScale.x / 2f;
  translation.y=parentSize.height * pixelScale.y / 2f;
  translation.x+=sizeApp.width * pixelScale.x / 2f;
  translation.y-=sizeApp.height * pixelScale.y / 2f;
  translation.x+=offset.x * pixelScale.x;
  translation.y-=offset.y * pixelScale.y;
  return translation;
}

Fixed version (ground truth):
private Vector3f calcOffsetTranslation(){
  Vector3f translation=new Vector3f();
  if (parent == null)   return translation;
  if (ortho) {
    if (type == Type.PRIMARY || type == Type.UNKNOWN) {
      translation.x=locationOrtho.x;
      translation.y=locationOrtho.y;
    }
 else {
      translation.x=locationOrtho.x - sizeApp.width / 2f + offset.x;
      translation.y=locationOrtho.y + sizeApp.height / 2f - offset.y;
    }
    logger.fine("String_Node_Str" + this);
    logger.fine("String_Node_Str" + translation);
  }
 else {
    Vector2f pixelScale=getPixelScaleCurrent();
    Dimension parentSize=parent.getSizeApp();
    translation.x=-parentSize.width * pixelScale.x / 2f;
    translation.y=parentSize.height * pixelScale.y / 2f;
    translation.x+=sizeApp.width * pixelScale.x / 2f;
    translation.y-=sizeApp.height * pixelScale.y / 2f;
    translation.x+=offset.x * pixelScale.x;
    translation.y-=offset.y * pixelScale.y;
  }
  return translation;
}
Program: 46173
Project: 46173
Buggy source:
/** 
 * Specifies whether the view entity is to be displayed in ortho mode ("on the glass"). Update if specified.
 */
public synchronized void setOrtho(boolean ortho,boolean update){
  if (this.ortho == ortho)   return;
  logger.info("String_Node_Str" + this);
  logger.info("String_Node_Str" + ortho);
  this.ortho=ortho;
  changeMask|=CHANGED_ORTHO;
  if (update) {
    update();
  }
}

Fixed version (ground truth):
/** 
 * Specifies whether the view entity is to be displayed in ortho mode ("on the glass"). Update if specified. Also changes the ortho attribute of all descendent views.
 */
public synchronized void setOrtho(boolean ortho,boolean update){
  if (this.ortho == ortho)   return;
  logger.info("String_Node_Str" + this);
  logger.info("String_Node_Str" + ortho);
  this.ortho=ortho;
  changeMask|=CHANGED_ORTHO;
  logger.info("String_Node_Str");
  logger.info("String_Node_Str" + children.size());
  for (  View2DEntity child : children) {
    child.setOrtho(ortho,false);
  }
  if (update) {
    update();
  }
}
Program: 46175
Project: 46175
Buggy source:
/** 
 * Given a point in the pixel space of the Wonderland canvas calculates the texel coordinates of the point on the geometry where a ray starting from the current eye position intersects the geometry. Note on subclassing: If the geometry is nonplanar it is recommended that the subclass implement this method by performing a pick. If this pick misses the subclass will need to decide how to handle the miss. One possible way to handle this is to assume that there is a planar "halo" surrounding the the window with which the ray can be intersected.
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  Ray rayWorld=InputManager3D.getInputManager().pickRayWorld(x,y);
  float width=view.getDisplayerLocalWidth();
  float height=view.getDisplayerLocalHeight();
  Vector3f topLeftLocal=new Vector3f(-width / 2f,height / 2f,0f);
  Matrix4f local2World=getLocalToWorldMatrix(null);
  Vector3f topLeftWorld=local2World.mult(topLeftLocal,new Vector3f());
  Vector3f planeNormalWorld=getPlaneNormalWorld();
  Vector3f intPointWorld=calcPlanarIntersection(rayWorld,topLeftWorld,planeNormalWorld);
  if (intPointWorld == null) {
    return null;
  }
  logger.fine("String_Node_Str" + intPointWorld);
  Point pt=calcPositionInPixelCoordinates(intPointWorld,false);
  logger.fine("String_Node_Str" + pt);
  return pt;
}

Fixed version (ground truth):
/** 
 * Given a point in the pixel space of the Wonderland canvas calculates the texel coordinates of the point on the geometry where a ray starting from the current eye position intersects the geometry. This method is used only for drag events that start on an view which is in the  world (that is, it is not in the ortho plane). Note on subclassing: If the geometry is nonplanar it is recommended that the subclass implement this method by performing a pick. If this pick misses the subclass will need to decide how to handle the miss. One possible way to handle this is to assume that there is a planar "halo" surrounding the the window with which the ray can be intersected.
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  Ray rayWorld=InputManager3D.getInputManager().pickRayWorld(x,y);
  float width=view.getDisplayerLocalWidth();
  float height=view.getDisplayerLocalHeight();
  Vector3f topLeftLocal=new Vector3f(-width / 2f,height / 2f,0f);
  Matrix4f local2World=getLocalToWorldMatrix(null);
  Vector3f topLeftWorld=local2World.mult(topLeftLocal,new Vector3f());
  Vector3f planeNormalWorld=getPlaneNormalWorld();
  Vector3f intPointWorld=calcPlanarIntersection(rayWorld,topLeftWorld,planeNormalWorld);
  if (intPointWorld == null) {
    return null;
  }
  logger.fine("String_Node_Str" + intPointWorld);
  Point pt=calcPositionInPixelCoordinates(intPointWorld,false);
  logger.fine("String_Node_Str" + pt);
  return pt;
}
Program: 46176
Project: 46176
Buggy source:
/** 
 * Calculates the point in world coordinates where the given ray intersects the "world plane"  of this geometry. Returns null if the ray doesn't intersect the plane. <br><br> All inputs are in world coordinates.      <br><br>
 * @param ray The ray.
 * @param planePoint A point on the plane.
 * @param planeNormal The plane normal vector.
 * @return The intersection point.
 */
protected Vector3f calcPlanarIntersection(Ray ray,Vector3f planePoint,Vector3f planeNormal){
  Vector3f pointDiffVec=new Vector3f(planePoint);
  pointDiffVec.subtractLocal(ray.getOrigin());
  float numerator=planeNormal.dot(pointDiffVec);
  float denominator=planeNormal.dot(ray.getDirection());
  if (denominator == 0f) {
    return null;
  }
  float t=numerator / denominator;
  Vector3f x=ray.getDirection().mult(t).add(ray.getOrigin());
  logger.fine("String_Node_Str" + x);
  return x;
}

Fixed version (ground truth):
/** 
 * Calculates the point in world coordinates where the given ray intersects the "world plane"  of this geometry. Returns null if the ray doesn't intersect the plane. <br><br> All inputs are in world coordinates.      <br><br>
 * @param ray The ray.
 * @param planePoint A point on the plane.
 * @param planeNormal The plane normal vector.
 * @return The intersection point.
 */
protected Vector3f calcPlanarIntersection(Ray ray,Vector3f planePoint,Vector3f planeNormal){
  Vector3f pointDiffVec=new Vector3f(planePoint);
  pointDiffVec.subtractLocal(ray.getOrigin());
  float numerator=planeNormal.dot(pointDiffVec);
  float denominator=planeNormal.dot(ray.getDirection());
  if (denominator == 0f) {
    return null;
  }
  float t=numerator / denominator;
  Vector3f x=ray.getDirection().mult(t).add(ray.getOrigin());
  return x;
}
Program: 46177
Project: 46177
Buggy source:
/** 
 * {@inheritDoc} 
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  if (geometryNode == null) {
    return null;
  }
  return geometryNode.calcIntersectionPixelOfEyeRay(x,y);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public Point calcIntersectionPixelOfEyeRay(int x,int y){
  if (geometryNode == null) {
    return null;
  }
  if (isOrtho()) {
    return geometryNode.calcIntersectionPixelOfEyeRayOrtho(x,y);
  }
 else {
    return geometryNode.calcIntersectionPixelOfEyeRay(x,y);
  }
}
Program: 46178
Project: 46178
Buggy source:
/** 
 * Specify the location of a primary view used when the view is in ortho mode. The location is an offset relative to the origin of the displayer and is in the coordinate system of the ortho plane. Update if specified. This attribute is ignored for non-primary views. Note: there is no corresponding attribute for cell mode because the cell itself automatically controls the location of a primary view within the cell (usually centered) and the cell location within the world is derived from WFS and other input. 
 */
public synchronized void setLocationOrtho(Vector2f location,boolean update){
  logger.info("String_Node_Str" + this);
  logger.info("String_Node_Str" + location);
  this.locationOrtho=location.clone();
  changeMask|=CHANGED_LOCATION_ORTHO;
  if (update) {
    update();
  }
}

Fixed version (ground truth):
/** 
 * Specify the location of a primary view used when the view is in ortho mode. The location the offset of the view center relative to the origin of the displayer  and is in the coordinate system of the ortho plane. Update if specified. This attribute is ignored for non-primary views. Note: there is no corresponding attribute for cell mode because the cell itself automatically controls the location of a primary view within the cell (usually centered) and the cell location within the world is derived from WFS and other input. 
 */
public synchronized void setLocationOrtho(Vector2f location,boolean update){
  logger.info("String_Node_Str" + this);
  logger.info("String_Node_Str" + location);
  this.locationOrtho=location.clone();
  changeMask|=CHANGED_LOCATION_ORTHO;
  if (update) {
    update();
  }
}
Program: 46179
Project: 46179
Buggy source:
public void run(){
  ReconnectFrame rf=new ReconnectFrame(JmeClientMain.this,mgr);
  rf.pack();
  rf.setLocationRelativeTo(JmeClientMain.getFrame().getFrame());
  rf.setVisible(true);
}

Fixed version (ground truth):
public void run(){
  frame.getFrame().setVisible(true);
}
Program: 46180
Project: 46180
Buggy source:
/** 
 * Create all of the Swing windows - and the 3D window
 */
private void createUI(WorldManager wm){
  frame=new MainFrameImpl(wm,width,height);
  frame.getFrame().setLocationRelativeTo(null);
  frame.getFrame().setVisible(true);
  JPanel canvas3D=frame.getCanvas3DPanel();
  ViewManager.initialize(canvas3D.getWidth(),canvas3D.getHeight());
  ViewManager.getViewManager().attachViewCanvas(canvas3D);
  CameraComponent cameraComp=ViewManager.getViewManager().getCameraComponent();
  InputManager inputManager=ClientContext.getInputManager();
  inputManager.initialize(frame.getCanvas(),cameraComp);
  inputManager.addKeyMouseFocus(inputManager.getGlobalFocusEntity());
}

Fixed version (ground truth):
/** 
 * Create all of the Swing windows - and the 3D window
 */
private void createUI(WorldManager wm){
  frame=new MainFrameImpl(wm,width,height);
  frame.getFrame().setLocationRelativeTo(null);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      frame.getFrame().setVisible(true);
    }
  }
);
  JPanel canvas3D=frame.getCanvas3DPanel();
  ViewManager.initialize(canvas3D.getWidth(),canvas3D.getHeight());
  ViewManager.getViewManager().attachViewCanvas(canvas3D);
  CameraComponent cameraComp=ViewManager.getViewManager().getCameraComponent();
  InputManager inputManager=ClientContext.getInputManager();
  inputManager.initialize(frame.getCanvas(),cameraComp);
  inputManager.addKeyMouseFocus(inputManager.getGlobalFocusEntity());
}
Program: 46181
Project: 46181
Buggy source:
public CellClientSession createSession(WonderlandServerInfo serverInfo,ClassLoader loader){
  CellClientSession ccs=new CellClientSession(serverInfo,loader){
    @Override protected CellCache createCellCache(){
      CellCacheBasicImpl impl=new CellCacheBasicImpl(this,getClassLoader(),getCellCacheConnection(),getCellChannelConnection()){
        @Override protected CellRenderer createCellRenderer(        Cell cell){
          return null;
        }
      }
;
      getCellCacheConnection().addListener(impl);
      return impl;
    }
  }
;
  ccs.addSessionStatusListener(Client3DSim.this);
  final LocalAvatar avatar=ccs.getLocalAvatar();
  avatar.addViewCellConfiguredListener(new ViewCellConfiguredListener(){
    public void viewConfigured(    LocalAvatar localAvatar){
      userSim.start();
    }
  }
);
  userSim=new UserSimulator(avatar);
  return ccs;
}

Fixed version (ground truth):
public CellClientSession createSession(ServerSessionManager sessionMgr,WonderlandServerInfo serverInfo,ClassLoader loader){
  CellClientSession ccs=new CellClientSession(sessionMgr,serverInfo,loader){
    @Override protected CellCache createCellCache(){
      CellCacheBasicImpl impl=new CellCacheBasicImpl(this,getClassLoader(),getCellCacheConnection(),getCellChannelConnection()){
        @Override protected CellRenderer createCellRenderer(        Cell cell){
          return null;
        }
      }
;
      getCellCacheConnection().addListener(impl);
      return impl;
    }
  }
;
  ccs.addSessionStatusListener(Client3DSim.this);
  final LocalAvatar avatar=ccs.getLocalAvatar();
  avatar.addViewCellConfiguredListener(new ViewCellConfiguredListener(){
    public void viewConfigured(    LocalAvatar localAvatar){
      userSim.start();
    }
  }
);
  userSim=new UserSimulator(avatar);
  return ccs;
}
Program: 46183
Project: 46183
Buggy source:
/** 
 * @param status
 */
@Override public void setStatus(CellStatus status){
  super.setStatus(status);
switch (status) {
case DISK:
    if (entity != null)     ClientContextJME.getWorldManager().removeEntity(entity);
  break;
case BOUNDS:
cell.getComponent(MovableComponent.class).addServerCellMoveListener(new CellMoveListener(){
  public void cellMoved(  CellTransform transform,  CellMoveSource source){
    if (source == CellMoveSource.REMOTE) {
      avatarCharacter.getModelInst().setTransform(new PTransform(transform.getRotation(null),transform.getTranslation(null),new Vector3f(1,1,1)));
    }
  }
}
);
break;
}
}

Fixed version (ground truth):
/** 
 * @param status
 */
@Override public void setStatus(CellStatus status){
  super.setStatus(status);
switch (status) {
case DISK:
    if (entity != null)     ClientContextJME.getWorldManager().removeEntity(entity);
  break;
case BOUNDS:
cell.getComponent(MovableComponent.class).addServerCellMoveListener(new CellMoveListener(){
  public void cellMoved(  CellTransform transform,  CellMoveSource source){
    if (source == CellMoveSource.REMOTE) {
      if (avatarCharacter != null) {
        if (avatarCharacter.getModelInst() == null) {
          logger.severe("String_Node_Str");
          Thread.dumpStack();
          return;
        }
        avatarCharacter.getModelInst().setTransform(new PTransform(transform.getRotation(null),transform.getTranslation(null),new Vector3f(1,1,1)));
      }
    }
  }
}
);
break;
}
}
Program: 46184
Project: 46184
Buggy source:
public void cellMoved(CellTransform transform,CellMoveSource source){
  if (source == CellMoveSource.REMOTE) {
    avatarCharacter.getModelInst().setTransform(new PTransform(transform.getRotation(null),transform.getTranslation(null),new Vector3f(1,1,1)));
  }
}

Fixed version (ground truth):
public void cellMoved(CellTransform transform,CellMoveSource source){
  if (source == CellMoveSource.REMOTE) {
    if (avatarCharacter != null) {
      if (avatarCharacter.getModelInst() == null) {
        logger.severe("String_Node_Str");
        Thread.dumpStack();
        return;
      }
      avatarCharacter.getModelInst().setTransform(new PTransform(transform.getRotation(null),transform.getTranslation(null),new Vector3f(1,1,1)));
    }
  }
}
Program: 46185
Project: 46185
Buggy source:
/** 
 * Updates the GUI with values currently set in the cell 
 */
private void updateGUI(){
  if (cellProperties != null) {
    cellProperties.updateGUI(cellServerState);
  }
  basicPanel.updateGUI(cellServerState);
  positionPanel.updateGUI();
  Iterator<Map.Entry<String,CellComponentPropertiesSPI>> it=componentPropertiesMap.entrySet().iterator();
  while (it.hasNext() == true) {
    Map.Entry<String,CellComponentPropertiesSPI> entry=it.next();
    entry.getValue().updateGUI(cellServerState);
  }
}

Fixed version (ground truth):
/** 
 * Updates the GUI with values currently set in the cell 
 */
private void updateGUI(){
  if (cellProperties != null) {
    cellProperties.updateGUI(cellServerState);
  }
  basicPanel.updateGUI(cellServerState);
  positionPanel.setLocalChanges(true);
  positionPanel.updateGUI();
  positionPanel.setLocalChanges(false);
  Iterator<Map.Entry<String,CellComponentPropertiesSPI>> it=componentPropertiesMap.entrySet().iterator();
  while (it.hasNext() == true) {
    Map.Entry<String,CellComponentPropertiesSPI> entry=it.next();
    entry.getValue().updateGUI(cellServerState);
  }
}
Program: 46186
Project: 46186
Buggy source:
public void setViewCell(final ViewCell newViewCell){
  Thread t=new Thread(){
    public void run(){
      boolean ready=false;
      while (!ready) {
synchronized (avatarConfigServers) {
          if (avatarConfigServers.containsKey(newViewCell.getCellCache().getSession().getSessionManager()))           ready=true;
        }
        if (!ready) {
          try {
            Thread.sleep(100);
          }
 catch (          InterruptedException ex) {
            Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
          }
        }
      }
      AvatarConfigComponent configComponent=newViewCell.getComponent(AvatarConfigComponent.class);
      URL selectedURL=AvatarConfigManager.getAvatarConfigManager().getDefaultAvatarServerURL(newViewCell.getCellCache().getSession().getSessionManager());
      logger.info("String_Node_Str" + selectedURL);
      System.err.println("String_Node_Str" + selectedURL);
      if (selectedURL != null) {
        configComponent.requestConfigChange(selectedURL);
      }
    }
  }
;
  t.start();
}

Fixed version (ground truth):
public void setViewCell(final ViewCell newViewCell){
  Thread t=new Thread(){
    public void run(){
      boolean ready=false;
      while (!ready) {
synchronized (avatarConfigServers) {
          if (avatarConfigServers.containsKey(newViewCell.getCellCache().getSession().getSessionManager()))           ready=true;
        }
        if (!ready) {
          try {
            Thread.sleep(100);
          }
 catch (          InterruptedException ex) {
            Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.SEVERE,null,ex);
          }
        }
      }
      AvatarConfigComponent configComponent=newViewCell.getComponent(AvatarConfigComponent.class);
      URL selectedURL=AvatarConfigManager.getAvatarConfigManager().getDefaultAvatarServerURL(newViewCell.getCellCache().getSession().getSessionManager());
      logger.info("String_Node_Str" + selectedURL);
      if (selectedURL != null) {
        configComponent.requestConfigChange(selectedURL);
      }
    }
  }
;
  t.start();
}
Program: 46187
Project: 46187
Buggy source:
private void notifyConfigUpdate(AvatarConfigMessage msg){
  System.err.println("String_Node_Str" + msg.getModelConfigURL());
  if ((avatarConfigURL != null && avatarConfigURL.toExternalForm().equals(msg.getModelConfigURL()) || msg.getModelConfigURL() == null))   return;
  try {
    avatarConfigURL=new URL(msg.getModelConfigURL());
synchronized (avatarChangeListeners) {
      for (      AvatarConfigChangeListener l : avatarChangeListeners) {
        l.AvatarConfigChanged(msg);
      }
    }
  }
 catch (  MalformedURLException ex) {
    Logger.getLogger(AvatarConfigComponent.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
private void notifyConfigUpdate(AvatarConfigMessage msg){
  if ((avatarConfigURL != null && avatarConfigURL.toExternalForm().equals(msg.getModelConfigURL()) || msg.getModelConfigURL() == null))   return;
  try {
    avatarConfigURL=new URL(msg.getModelConfigURL());
synchronized (avatarChangeListeners) {
      for (      AvatarConfigChangeListener l : avatarChangeListeners) {
        l.AvatarConfigChanged(msg);
      }
    }
  }
 catch (  MalformedURLException ex) {
    Logger.getLogger(AvatarConfigComponent.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 46188
Project: 46188
Buggy source:
public void requestConfigChange(URL configURL){
  System.err.println("String_Node_Str" + configURL);
  if (avatarConfigURL != null && avatarConfigURL.equals(configURL))   return;
synchronized (this) {
    if (channelComp == null) {
      pendingChange=configURL;
    }
 else {
      channelComp.send(AvatarConfigMessage.newRequestMessage(configURL));
    }
  }
}

Fixed version (ground truth):
public void requestConfigChange(URL configURL){
  if (avatarConfigURL != null && avatarConfigURL.equals(configURL))   return;
synchronized (this) {
    if (channelComp == null) {
      pendingChange=configURL;
    }
 else {
      channelComp.send(AvatarConfigMessage.newRequestMessage(configURL));
    }
  }
}
Program: 46189
Project: 46189
Buggy source:
@Override public void setClientState(CellComponentClientState clientState){
  super.setClientState(clientState);
  try {
    String str=((AvatarConfigComponentClientState)clientState).getConfigURL();
    System.err.println("String_Node_Str" + str);
    if (str != null)     avatarConfigURL=new URL(str);
 else     avatarConfigURL=null;
  }
 catch (  MalformedURLException ex) {
    Logger.getLogger(AvatarConfigComponent.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
@Override public void setClientState(CellComponentClientState clientState){
  super.setClientState(clientState);
  try {
    String str=((AvatarConfigComponentClientState)clientState).getConfigURL();
    if (str != null)     avatarConfigURL=new URL(str);
 else     avatarConfigURL=null;
  }
 catch (  MalformedURLException ex) {
    Logger.getLogger(AvatarConfigComponent.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 46193
Project: 46193
Buggy source:
/** 
 * Construct a new cache using the specified folder.
 * @param cacheFolder
 */
public WonderlandAvatarCache(File cacheFolder){
  if (cacheFolder == null)   throw new ExceptionInInitializerError("String_Node_Str");
 else   this.cacheFolder=cacheFolder;
}

Fixed version (ground truth):
/** 
 * Construct a new cache using the specified folder.
 * @param cacheFolder
 */
public WonderlandAvatarCache(String baseURL,File cacheFolder){
  this.baseURL=baseURL;
  if (cacheFolder == null) {
    throw new ExceptionInInitializerError("String_Node_Str");
  }
 else {
    this.cacheFolder=cacheFolder;
  }
}
Program: 46194
Project: 46194
Buggy source:
private File urlToCacheFile(URL location){
  File localFile=null;
  if (location.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    try {
      localFile=new File(location.toURI());
    }
 catch (    URISyntaxException ex) {
      logger.severe("String_Node_Str");
    }
  }
  String urlString=location.toString();
  int assetsIndex=urlString.indexOf("String_Node_Str");
  if (assetsIndex != 1)   urlString=urlString.substring(assetsIndex + 7);
  String hashFileName=MD5HashUtils.getStringFromHash(urlString.getBytes());
  File result=new File(cacheFolder,hashFileName);
  if (localFile != null) {
    if (localFile.lastModified() > result.lastModified())     result.delete();
  }
  System.err.println("String_Node_Str" + location.toExternalForm() + "String_Node_Str"+ result);
  return result;
}

Fixed version (ground truth):
private File urlToCacheFile(URL location){
  File localFile=null;
  if (location.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    try {
      localFile=new File(location.toURI());
    }
 catch (    URISyntaxException ex) {
      logger.severe("String_Node_Str");
    }
  }
  String urlString=location.toString();
  int assetsIndex=urlString.indexOf("String_Node_Str");
  if (assetsIndex != 1) {
    urlString=urlString.substring(assetsIndex + 7);
  }
  String hashFileName=MD5HashUtils.getStringFromHash(urlString.getBytes());
  File result=new File(cacheFolder,hashFileName);
  if (localFile != null) {
    if (localFile.lastModified() > result.lastModified()) {
      result.delete();
    }
  }
  System.err.println("String_Node_Str" + location.toExternalForm() + "String_Node_Str"+ result);
  return result;
}
Program: 46195
Project: 46195
Buggy source:
@Override public InputStream getStreamToResource(URL location){
  File cacheFile=urlToCacheFile(location);
  InputStream result=null;
  if (cacheFile != null && cacheFile.exists()) {
    try {
      result=new FileInputStream(cacheFile);
    }
 catch (    FileNotFoundException ex) {
      logger.severe("String_Node_Str" + "String_Node_Str");
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public InputStream getStreamToResource(URL location){
  File cacheFile=urlToCacheFile(location);
  InputStream result=null;
  if (cacheFile != null && cacheFile.exists()) {
    System.err.println("String_Node_Str" + location.toExternalForm());
    try {
      result=new FileInputStream(cacheFile);
    }
 catch (    FileNotFoundException ex) {
      logger.severe("String_Node_Str" + "String_Node_Str");
    }
  }
  return result;
}
Program: 46196
Project: 46196
Buggy source:
public Texture loadTexture(URL location){
  return TextureManager.loadTexture(location);
}

Fixed version (ground truth):
public Texture loadTexture(URL location){
  if (location.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    String relativePath=location.toExternalForm();
    int assetsIndex=relativePath.indexOf("String_Node_Str");
    if (assetsIndex != -1) {
      relativePath=relativePath.substring(assetsIndex);
    }
    URL localURL=null;
    try {
      localURL=new URL(baseURL + relativePath);
      return TextureManager.loadTexture(localURL);
    }
 catch (    MalformedURLException ex) {
      logger.warning("String_Node_Str" + baseURL + relativePath);
    }
  }
  return TextureManager.loadTexture(location);
}
Program: 46197
Project: 46197
Buggy source:
@Override public boolean clearCache(){
  for (  File file : cacheFolder.listFiles())   file.delete();
  if (cacheFolder.listFiles().length == 0)   return true;
 else   return false;
}

Fixed version (ground truth):
@Override public boolean clearCache(){
  for (  File file : cacheFolder.listFiles()) {
    file.delete();
  }
  if (cacheFolder.listFiles().length == 0) {
    return true;
  }
 else {
    return false;
  }
}
Program: 46198
Project: 46198
Buggy source:
@Override protected void activate(){
  ContentBrowserManager manager=ContentBrowserManager.getContentBrowserManager();
  defaultBrowser=new ContentBrowserJDialog(getSessionManager());
  manager.setDefaultContentBrowser(defaultBrowser);
  JmeClientMain.getFrame().addToToolsMenu(oldBrowserItem,5);
  JmeClientMain.getFrame().addToToolsMenu(newBrowserItem,6);
}

Fixed version (ground truth):
@Override protected void activate(){
  ContentBrowserManager manager=ContentBrowserManager.getContentBrowserManager();
  defaultBrowser=new ContentBrowserJDialog(getSessionManager());
  manager.setDefaultContentBrowser(defaultBrowser);
  JmeClientMain.getFrame().addToToolsMenu(newBrowserItem,6);
}
Program: 46200
Project: 46200
Buggy source:
@Override protected void deactivate(){
  ContentBrowserManager manager=ContentBrowserManager.getContentBrowserManager();
  if (defaultBrowser == manager.getDefaultContentBrowser()) {
    manager.setDefaultContentBrowser(null);
    defaultBrowser=null;
  }
  JmeClientMain.getFrame().removeFromToolsMenu(oldBrowserItem);
  JmeClientMain.getFrame().removeFromToolsMenu(newBrowserItem);
}

Fixed version (ground truth):
@Override protected void deactivate(){
  ContentBrowserManager manager=ContentBrowserManager.getContentBrowserManager();
  if (defaultBrowser == manager.getDefaultContentBrowser()) {
    manager.setDefaultContentBrowser(null);
    defaultBrowser=null;
  }
  JmeClientMain.getFrame().removeFromToolsMenu(newBrowserItem);
}
Program: 46202
Project: 46202
Buggy source:
public ServerSyncThread(ServerSessionManager session) throws ContentRepositoryException {
  super(ThreadManager.getThreadGroup(),"String_Node_Str");
  logger.info("String_Node_Str" + this);
  repository=ContentRepositoryRegistry.getInstance().getRepository(session);
  System.err.println("String_Node_Str" + repository);
  ContentCollection userDir=repository.getUserRoot(true);
  avatarsDir=(ContentCollection)userDir.getChild("String_Node_Str");
  if (avatarsDir == null) {
    avatarsDir=(ContentCollection)userDir.createChild("String_Node_Str",Type.COLLECTION);
  }
synchronized (avatarConfigServers) {
    avatarConfigServers.put(session,this);
  }
  session.getPrimarySession().addSessionStatusListener(new SessionStatusListener(){
    public void sessionStatusChanged(    WonderlandSession session,    Status status){
      if (status == Status.DISCONNECTED) {
synchronized (avatarConfigServers) {
          avatarConfigServers.remove(session);
          connected=false;
        }
      }
    }
  }
);
  this.start();
}

Fixed version (ground truth):
public ServerSyncThread(ServerSessionManager session) throws ContentRepositoryException {
  super(ThreadManager.getThreadGroup(),"String_Node_Str");
  logger.info("String_Node_Str" + this);
  repository=ContentRepositoryRegistry.getInstance().getRepository(session);
  ContentCollection userDir=repository.getUserRoot(true);
  avatarsDir=(ContentCollection)userDir.getChild("String_Node_Str");
  if (avatarsDir == null) {
    avatarsDir=(ContentCollection)userDir.createChild("String_Node_Str",Type.COLLECTION);
  }
synchronized (avatarConfigServers) {
    avatarConfigServers.put(session,this);
  }
  session.getPrimarySession().addSessionStatusListener(new SessionStatusListener(){
    public void sessionStatusChanged(    WonderlandSession session,    Status status){
      if (status == Status.DISCONNECTED) {
synchronized (avatarConfigServers) {
          avatarConfigServers.remove(session);
          connected=false;
        }
      }
    }
  }
);
  this.start();
}
Program: 46203
Project: 46203
Buggy source:
private void getURLImpl(Job job){
  System.err.println("String_Node_Str" + serverAvatars.size() + "String_Node_Str"+ job.filename);
  for (  AvatarConfigFile f : serverAvatars.values())   System.err.println(f);
  AvatarConfigFile r=serverAvatars.get(job.filename);
  if (r == null) {
    logger.log(Level.SEVERE,"String_Node_Str" + job.filename);
    job.returnURL(null);
  }
  try {
    System.err.println("String_Node_Str" + r);
    System.err.println(r.avatarName + "String_Node_Str" + r.resource.getURL());
    job.returnURL(r.resource.getURL());
  }
 catch (  ContentRepositoryException ex) {
    Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.WARNING,"String_Node_Str" + job.filename,ex);
  }
}

Fixed version (ground truth):
private void getURLImpl(Job job){
  AvatarConfigFile r=serverAvatars.get(job.filename);
  if (r == null) {
    logger.log(Level.SEVERE,"String_Node_Str" + job.filename);
    job.returnURL(null);
  }
 else {
    try {
      logger.fine("String_Node_Str" + r + "String_Node_Str"+ r.avatarName+ "String_Node_Str"+ r.resource.getURL());
      job.returnURL(r.resource.getURL());
    }
 catch (    ContentRepositoryException ex) {
      Logger.getLogger(AvatarConfigManager.class.getName()).log(Level.WARNING,"String_Node_Str" + job.filename,ex);
    }
  }
}
Program: 46204
Project: 46204
Buggy source:
/** 
 * Returns the details for this server
 */
@GET public Response getServerDetails(){
  ServerDetails out=ServerInfo.getServerDetails().clone();
  out.setServerURL(getServerURL());
  try {
    ResponseBuilder rb=Response.ok(out);
    return rb.build();
  }
 catch (  Exception excp) {
    logger.log(Level.WARNING,"String_Node_Str",excp);
    ResponseBuilder rb=Response.status(Response.Status.BAD_REQUEST);
    return rb.build();
  }
}

Fixed version (ground truth):
/** 
 * Returns the details for this server
 */
@GET public Response getServerDetails(){
  ServerDetails out=ServerInfo.getServerDetails().clone();
  try {
    ResponseBuilder rb=Response.ok(out);
    return rb.build();
  }
 catch (  Exception excp) {
    logger.log(Level.WARNING,"String_Node_Str",excp);
    ResponseBuilder rb=Response.status(Response.Status.BAD_REQUEST);
    return rb.build();
  }
}
Program: 46205
Project: 46205
Buggy source:
public void done(){
synchronized (detachedOrbList) {
    detachedOrbList.remove(orbCell);
    reorderDetachedOrbs();
    if (hostCell != null) {
      ArrayList<OrbCell> attachedOrbList=attachedOrbMap.get(hostCell);
      if (attachedOrbList != null) {
        attachedOrbList.remove(orbCell);
      }
    }
    reorderAttachedOrbs();
  }
  channelComp.removeMessageReceiver(OrbAttachMessage.class);
  channelComp.removeMessageReceiver(OrbChangeNameMessage.class);
  channelComp.removeMessageReceiver(OrbEndCallMessage.class);
  channelComp.removeMessageReceiver(OrbMuteCallMessage.class);
  channelComp.removeMessageReceiver(OrbSetVolumeMessage.class);
  channelComp.removeMessageReceiver(OrbSpeakingMessage.class);
  orbRootNode.detachChild(nameTag);
  nameTag.done();
  pm.removeSession(presenceInfo);
}

Fixed version (ground truth):
public void done(){
  if (done) {
    return;
  }
  done=true;
synchronized (detachedOrbList) {
    detachedOrbList.remove(orbCell);
    reorderDetachedOrbs();
    if (hostCell != null) {
      ArrayList<OrbCell> attachedOrbList=attachedOrbMap.get(hostCell);
      if (attachedOrbList != null) {
        attachedOrbList.remove(orbCell);
      }
    }
    reorderAttachedOrbs();
  }
  followMe.done();
  channelComp.removeMessageReceiver(OrbAttachMessage.class);
  channelComp.removeMessageReceiver(OrbChangeNameMessage.class);
  channelComp.removeMessageReceiver(OrbEndCallMessage.class);
  channelComp.removeMessageReceiver(OrbMuteCallMessage.class);
  channelComp.removeMessageReceiver(OrbSetVolumeMessage.class);
  channelComp.removeMessageReceiver(OrbSpeakingMessage.class);
  orbRootNode.detachChild(nameTag);
  nameTag.done();
  pm.removeSession(presenceInfo);
}
Program: 46207
Project: 46207
Buggy source:
/** 
 * Create an instance of HUDView2D with a specified geometry node.
 * @param window The window displayed in this view.
 * @param geometryNode The geometry node on which to display the view.
 */
public HUDView2D(View2DDisplayer displayer,Window2D window,GeometryNode geometryNode){
  super(window,geometryNode);
  this.displayer=displayer;
  entity=new Entity("String_Node_Str" + name);
  viewNode=new Node("String_Node_Str" + name);
  RenderComponent rc=ClientContextJME.getWorldManager().getRenderManager().createRenderComponent(viewNode);
  entity.addComponent(RenderComponent.class,rc);
  entityMakePickable(entity);
  changeMask=CHANGED_ALL;
  update();
}

Fixed version (ground truth):
/** 
 * Create an instance of HUDView2D with a specified geometry node.
 * @param window The window displayed in this view.
 * @param geometryNode The geometry node on which to display the view.
 */
public HUDView2D(View2DDisplayer displayer,Window2D window,GeometryNode geometryNode){
  super(window,geometryNode);
  this.displayer=displayer;
  changeMask=CHANGED_ALL;
  update();
}
Program: 46208
Project: 46208
Buggy source:
void changeAvatar(WlAvatarCharacter newAvatar){
  LoadingInfo.startedLoading(cell.getCellID(),newAvatar.getName());
  ViewManager viewManager=ViewManager.getViewManager();
  if (viewManager.getPrimaryViewCell() == cell) {
    ViewManager.getViewManager().detach();
  }
  PMatrix currentLocation=null;
  WorldManager wm=ClientContextJME.getWorldManager();
  if (avatarCharacter != null) {
    currentLocation=avatarCharacter.getModelInst().getTransform().getWorldMatrix(true);
    wm.removeEntity(avatarCharacter);
    avatarCharacter.destroy();
  }
  avatarCharacter=newAvatar;
  RenderComponent rc=(RenderComponent)avatarCharacter.getComponent(RenderComponent.class);
  if (rc != null) {
    addDefaultComponents(avatarCharacter,rc.getSceneRoot());
  }
 else {
    logger.warning("String_Node_Str");
  }
  if (currentLocation != null) {
    avatarCharacter.getModelInst().setTransform(new PTransform(currentLocation));
  }
  wm.addEntity(avatarCharacter);
  entity=newAvatar;
  if (viewManager.getPrimaryViewCell() == cell) {
    ViewManager.getViewManager().attach(cell);
  }
  controlScheme=null;
  selectForInput(selectedForInput);
  LoadingInfo.finishedLoading(cell.getCellID(),newAvatar.getName());
}

Fixed version (ground truth):
void changeAvatar(WlAvatarCharacter newAvatar){
  LoadingInfo.startedLoading(cell.getCellID(),newAvatar.getName());
  ViewManager viewManager=ViewManager.getViewManager();
  if (viewManager.getPrimaryViewCell() == cell) {
    ViewManager.getViewManager().detach();
  }
  PMatrix currentLocation=null;
  WorldManager wm=ClientContextJME.getWorldManager();
  if (avatarCharacter != null) {
    if (nameTag != null) {
      avatarCharacter.getJScene().getExternalKidsRoot().detachChild(nameTag);
    }
    currentLocation=avatarCharacter.getModelInst().getTransform().getWorldMatrix(true);
    wm.removeEntity(avatarCharacter);
    avatarCharacter.destroy();
  }
  avatarCharacter=newAvatar;
  RenderComponent rc=(RenderComponent)avatarCharacter.getComponent(RenderComponent.class);
  if (rc != null) {
    addDefaultComponents(avatarCharacter,rc.getSceneRoot());
  }
 else {
    logger.warning("String_Node_Str");
  }
  if (currentLocation != null) {
    avatarCharacter.getModelInst().setTransform(new PTransform(currentLocation));
  }
  if (nameTag != null) {
    avatarCharacter.getJScene().getExternalKidsRoot().attachChild(nameTag);
  }
  wm.addEntity(avatarCharacter);
  entity=newAvatar;
  if (viewManager.getPrimaryViewCell() == cell) {
    ViewManager.getViewManager().attach(cell);
  }
  controlScheme=null;
  selectForInput(selectedForInput);
  LoadingInfo.finishedLoading(cell.getCellID(),newAvatar.getName());
}
Program: 46210
Project: 46210
Buggy source:
public void run(){
  ReconnectFrame rf=new ReconnectFrame(JmeClientMain.this,mgr);
  rf.pack();
  rf.setVisible(true);
}

Fixed version (ground truth):
public void run(){
  ReconnectFrame rf=new ReconnectFrame(JmeClientMain.this,mgr);
  rf.pack();
  rf.setLocationRelativeTo(JmeClientMain.getFrame().getFrame());
  rf.setVisible(true);
}
Program: 46211
Project: 46211
Buggy source:
public void sessionStatusChanged(WonderlandSession session,Status status){
  if (status == Status.DISCONNECTED) {
    ClientContextJME.removeAllPhysicsSystems(session.getSessionManager());
    ClientContextJME.removeAllCollisionSystems(session.getSessionManager());
    boolean inLogout;
synchronized (JmeClientMain.this) {
      inLogout=loggingOut;
    }
    if (!inLogout) {
      final ServerSessionManager mgr=curSession.getSessionManager();
      logger.warning("String_Node_Str");
      logout();
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          ReconnectFrame rf=new ReconnectFrame(JmeClientMain.this,mgr);
          rf.pack();
          rf.setVisible(true);
        }
      }
);
    }
 else {
synchronized (JmeClientMain.this) {
        loggingOut=false;
      }
    }
  }
}

Fixed version (ground truth):
public void sessionStatusChanged(WonderlandSession session,Status status){
  if (status == Status.DISCONNECTED) {
    ClientContextJME.removeAllPhysicsSystems(session.getSessionManager());
    ClientContextJME.removeAllCollisionSystems(session.getSessionManager());
    boolean inLogout;
synchronized (JmeClientMain.this) {
      inLogout=loggingOut;
    }
    if (!inLogout) {
      final ServerSessionManager mgr=curSession.getSessionManager();
      logger.warning("String_Node_Str");
      logout();
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          ReconnectFrame rf=new ReconnectFrame(JmeClientMain.this,mgr);
          rf.pack();
          rf.setLocationRelativeTo(JmeClientMain.getFrame().getFrame());
          rf.setVisible(true);
        }
      }
);
    }
 else {
synchronized (JmeClientMain.this) {
        loggingOut=false;
      }
    }
  }
}
Program: 46213
Project: 46213
Buggy source:
/** 
 * Unregister and menus we have created, etc.
 */
public void unregister(){
  loginInfo.removeLifecycleListener(sessionListener);
  JmeClientMain.getFrame().removeFromWindowMenu(menu);
}

Fixed version (ground truth):
/** 
 * Unregister and menus we have created, etc.
 */
public void unregister(){
  JFrame userListJFrame=userListFrameRef.get();
  userListJFrame.setVisible(false);
  userListJFrame.dispose();
  for (  Map.Entry<String,WeakReference<TextChatJFrame>> entry : textChatFrameRefMap.entrySet()) {
    TextChatJFrame frame=entry.getValue().get();
    frame.setVisible(false);
    frame.dispose();
  }
  textChatFrameRefMap.clear();
  loginInfo.removeLifecycleListener(sessionListener);
  JmeClientMain.getFrame().removeFromWindowMenu(menu);
}
Program: 46214
Project: 46214
Buggy source:
public void actionPerformed(ActionEvent e){
  ViewCell cell=ClientContextJME.getViewManager().getPrimaryViewCell();
  if (cell instanceof AvatarCell) {
    AvatarImiJME rend=(AvatarImiJME)((AvatarCell)cell).getCellRenderer(ClientContext.getRendererType());
    AvatarConfigFrame f=new AvatarConfigFrame(rend);
    f.setVisible(true);
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  GameContext context=curAvatar.getAvatarCharacter().getContext();
  CharacterSteeringHelm helm=curAvatar.getAvatarCharacter().getContext().getSteering();
  helm.addTaskToTop(new GoTo(new Vector3f(0,0,0),context));
  helm.setEnable(true);
}
Program: 46215
Project: 46215
Buggy source:
public void primaryViewCellChanged(ViewCell oldViewCell,ViewCell newViewCell){
  CellRenderer rend=newViewCell.getCellRenderer(Cell.RendererType.RENDERER_JME);
  if (!(rend instanceof AvatarImiJME)) {
    return;
  }
  curAvatar=(AvatarImiJME)rend;
  if (testPanelRef == null || testPanelRef.get() == null) {
  }
 else {
    testPanelRef.get().setAvatarCharactar(curAvatar.getAvatarCharacter());
  }
  AvatarConfigManager.getAvatarConfigManager().setViewCell(newViewCell);
  if (!menusAdded) {
    JmeClientMain.getFrame().addToWindowMenu(avatarControlsMI,0);
    JmeClientMain.getFrame().addToEditMenu(avatarMI,0);
    JmeClientMain.getFrame().addToEditMenu(avatarSettingsMI,1);
    JmeClientMain.getFrame().addToPlacemarksMenu(startingLocationMI,0);
    JmeClientMain.getFrame().addToEditMenu(avatarConfigFrameMI);
    menusAdded=true;
  }
}

Fixed version (ground truth):
public void primaryViewCellChanged(ViewCell oldViewCell,ViewCell newViewCell){
  CellRenderer rend=newViewCell.getCellRenderer(Cell.RendererType.RENDERER_JME);
  if (!(rend instanceof AvatarImiJME)) {
    return;
  }
  curAvatar=(AvatarImiJME)rend;
  if (testPanelRef == null || testPanelRef.get() == null) {
  }
 else {
    testPanelRef.get().setAvatarCharactar(curAvatar.getAvatarCharacter());
  }
  AvatarConfigManager.getAvatarConfigManager().setViewCell(newViewCell);
  if (!menusAdded) {
    JmeClientMain.getFrame().addToWindowMenu(avatarControlsMI,0);
    JmeClientMain.getFrame().addToEditMenu(avatarMI,0);
    JmeClientMain.getFrame().addToEditMenu(avatarSettingsMI,1);
    JmeClientMain.getFrame().addToPlacemarksMenu(startingLocationMI,0);
    menusAdded=true;
  }
}
Program: 46217
Project: 46217
Buggy source:
@Override protected void deactivate(){
  if (menusAdded) {
    JmeClientMain.getFrame().removeFromWindowMenu(avatarControlsMI);
    JmeClientMain.getFrame().removeFromEditMenu(avatarMI);
    JmeClientMain.getFrame().removeFromEditMenu(avatarSettingsMI);
    JmeClientMain.getFrame().removeFromPlacemarksMenu(startingLocationMI);
    JmeClientMain.getFrame().removeFromEditMenu(avatarConfigFrameMI);
    menusAdded=false;
  }
  ClientContextJME.getViewManager().removeViewManagerListener(this);
}

Fixed version (ground truth):
@Override protected void deactivate(){
  if (menusAdded) {
    JmeClientMain.getFrame().removeFromWindowMenu(avatarControlsMI);
    JmeClientMain.getFrame().removeFromEditMenu(avatarMI);
    JmeClientMain.getFrame().removeFromEditMenu(avatarSettingsMI);
    JmeClientMain.getFrame().removeFromPlacemarksMenu(startingLocationMI);
    menusAdded=false;
  }
  ClientContextJME.getViewManager().removeViewManagerListener(this);
}