Program: 45803
Project: 45803
Buggy source:
/** 
 */
public void primaryViewCellChanged(ViewCell oldViewCell,final ViewCell newViewCell){
  if (avatarCellRenderer != null) {
    avatarCellRenderer.removeAvatarChangedListener(avatarChangedListener);
  }
  if (newViewCell != null) {
    logger.info("String_Node_Str" + newViewCell.getName());
    CellRenderer rend=newViewCell.getCellRenderer(RendererType.RENDERER_JME);
    if (!(rend instanceof AvatarImiJME)) {
      logger.warning("String_Node_Str" + newViewCell.getName() + "String_Node_Str");
      return;
    }
    avatarCellRenderer=(AvatarImiJME)rend;
    avatarCellRenderer.addAvatarChangedListener(avatarChangedListener);
    if (camState != null) {
      camState.setTargetCharacter(avatarCellRenderer.getAvatarCharacter());
      camModel.reset(camState);
    }
    if (gestureHUDRef != null && gestureHUDRef.get() != null) {
      gestureHUDRef.get().setAvatarCharacter(avatarCellRenderer.getAvatarCharacter());
    }
    if (inUseListener == null) {
      inUseListener=new AvatarInUseListener(){
        public void avatarInUse(        AvatarSPI avatar,        boolean isLocal){
          refreshAvatarInUse(newViewCell,isLocal);
        }
      }
;
      AvatarRegistry.getAvatarRegistry().addAvatarInUseListener(inUseListener);
    }
    refreshAvatarInUse(newViewCell,false);
    if (menusAdded == false) {
      MainFrame frame=JmeClientMain.getFrame();
      frame.addToWindowMenu(gestureMI,0);
      frame.addToToolsMenu(gravityEnabledMI,-1);
      frame.addToToolsMenu(collisionResponseEnabledMI,-1);
      frame.addToEditMenu(avatarConfigMI,0);
      if (frame instanceof MainFrameImpl) {
        ((MainFrameImpl)frame).addToCameraChoices(chaseCameraMI,3);
      }
 else {
        frame.addToViewMenu(chaseCameraMI,3);
      }
      if (avatarControlsMI != null) {
        frame.addToWindowMenu(avatarControlsMI,0);
      }
      if (avatarSettingsMI != null) {
        frame.addToEditMenu(avatarSettingsMI,1);
      }
      menusAdded=true;
    }
  }
}

Fixed version (ground truth):
/** 
 */
public void primaryViewCellChanged(ViewCell oldViewCell,final ViewCell newViewCell){
  if (avatarCellRenderer != null) {
    avatarCellRenderer.removeAvatarChangedListener(avatarChangedListener);
  }
  if (newViewCell == null) {
    return;
  }
  logger.info("String_Node_Str" + oldViewCell + "String_Node_Str"+ newViewCell+ "String_Node_Str"+ newViewCell.getName());
  CellRenderer rend=newViewCell.getCellRenderer(RendererType.RENDERER_JME);
  if (!(rend instanceof AvatarImiJME)) {
    logger.warning("String_Node_Str" + newViewCell.getName() + "String_Node_Str");
    return;
  }
  if (inUseListener == null) {
    inUseListener=new AvatarInUseListener(){
      public void avatarInUse(      AvatarSPI avatar,      boolean isLocal){
        refreshAvatarInUse(newViewCell,isLocal);
      }
    }
;
    AvatarRegistry.getAvatarRegistry().addAvatarInUseListener(inUseListener);
  }
  avatarCellRenderer=(AvatarImiJME)rend;
  avatarCellRenderer.addAvatarChangedListener(avatarChangedListener);
  if (camState != null) {
    camState.setTargetCharacter(avatarCellRenderer.getAvatarCharacter());
    camModel.reset(camState);
  }
  if (gestureHUDRef != null && gestureHUDRef.get() != null) {
    gestureHUDRef.get().setAvatarCharacter(avatarCellRenderer.getAvatarCharacter());
  }
  if (inUseListener == null) {
    inUseListener=new AvatarInUseListener(){
      public void avatarInUse(      AvatarSPI avatar,      boolean isLocal){
        refreshAvatarInUse(newViewCell,isLocal);
      }
    }
;
    AvatarRegistry.getAvatarRegistry().addAvatarInUseListener(inUseListener);
  }
  isAvatarSet=false;
  newViewCell.addComponentChangeListener(new ComponentChangeListener(){
    public void componentChanged(    Cell cell,    ChangeType type,    CellComponent component){
      AvatarConfigComponent c=cell.getComponent(AvatarConfigComponent.class);
      if (type == ChangeType.ADDED && c != null) {
        handleSetAvatar((ViewCell)cell);
      }
    }
  }
);
  if (newViewCell.getComponent(AvatarConfigComponent.class) != null) {
    handleSetAvatar(newViewCell);
  }
  if (menusAdded == false) {
    MainFrame frame=JmeClientMain.getFrame();
    frame.addToWindowMenu(gestureMI,0);
    frame.addToToolsMenu(gravityEnabledMI,-1);
    frame.addToToolsMenu(collisionResponseEnabledMI,-1);
    frame.addToEditMenu(avatarConfigMI,0);
    if (frame instanceof MainFrameImpl) {
      ((MainFrameImpl)frame).addToCameraChoices(chaseCameraMI,3);
    }
 else {
      frame.addToViewMenu(chaseCameraMI,3);
    }
    if (avatarControlsMI != null) {
      frame.addToWindowMenu(avatarControlsMI,0);
    }
    if (avatarSettingsMI != null) {
      frame.addToEditMenu(avatarSettingsMI,1);
    }
    menusAdded=true;
  }
}