Program: 47588
Project: 47588
Buggy source:
protected void setPluginPerspectives(final ArrayList<IPluginPerspective> perspectives){
  this.perspectives=perspectives;
  clear();
  setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
  setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
  Collections.sort(perspectives,new Comparator<IPluginPerspective>(){
    public int compare(    IPluginPerspective o1,    IPluginPerspective o2){
      Integer p1=new Integer(o1.getLayoutPriority());
      Integer p2=new Integer(o2.getLayoutPriority());
      return p1.compareTo(p2);
    }
  }
);
  for (  final IPluginPerspective perspective : perspectives) {
    if (perspective.getOverlays() != null) {
      overlays.addAll(perspective.getOverlays());
    }
    ToggleButton tb=new ToggleButton(perspective.getTitle(),perspective.getTitle(),new ClickHandler(){
      public void onClick(      ClickEvent event){
        if (((ToggleButton)event.getSource()).isDown()) {
          History.newItem(perspective.getId());
        }
 else {
          IPluginPerspective defaultPerspective=perspectives.get(0);
          History.newItem(defaultPerspective.getId());
        }
        showPerspective((ToggleButton)event.getSource(),perspective);
      }
    }
);
    tb.setStyleName("String_Node_Str");
    tb.getElement().setAttribute("String_Node_Str","String_Node_Str" + perspective.getLayoutPriority());
    toggles.add(tb);
    add(tb);
    loadResourceBundle(tb,perspective);
  }
  XulMainToolbar.getInstance().loadOverlays(overlays);
  XulMainMenubar.getInstance().loadOverlays(overlays);
  String historyTokenPerspectiveId=History.getToken();
  boolean loadDefaultPerspective=setPerspective(historyTokenPerspectiveId);
  if (loadDefaultPerspective) {
    showPerspective(toggles.get(0),perspectives.get(0));
  }
}

Fixed version (ground truth):
protected void setPluginPerspectives(final ArrayList<IPluginPerspective> perspectives){
  this.perspectives=perspectives;
  clear();
  setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
  setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
  Collections.sort(perspectives,new Comparator<IPluginPerspective>(){
    public int compare(    IPluginPerspective o1,    IPluginPerspective o2){
      Integer p1=new Integer(o1.getLayoutPriority());
      Integer p2=new Integer(o2.getLayoutPriority());
      return p1.compareTo(p2);
    }
  }
);
  for (  final IPluginPerspective perspective : perspectives) {
    if (perspective.getOverlays() != null) {
      overlays.addAll(perspective.getOverlays());
    }
    ToggleButton tb=new ToggleButton(perspective.getTitle(),perspective.getTitle(),new ClickHandler(){
      public void onClick(      ClickEvent event){
        if (((ToggleButton)event.getSource()).isDown()) {
          History.newItem(perspective.getId());
        }
 else {
          IPluginPerspective defaultPerspective=perspectives.get(0);
          History.newItem(defaultPerspective.getId());
        }
        showPerspective((ToggleButton)event.getSource(),perspective);
      }
    }
);
    tb.setStyleName("String_Node_Str");
    tb.getElement().setAttribute("String_Node_Str","String_Node_Str" + perspective.getLayoutPriority());
    toggles.add(tb);
    add(tb);
    loadResourceBundle(tb,perspective);
  }
  XulMainToolbar.getInstance().loadOverlays(overlays);
  XulMainMenubar.getInstance().loadOverlays(overlays);
  String historyTokenPerspectiveId=History.getToken();
  boolean loadedFromHistory=setPerspective(historyTokenPerspectiveId);
  if (!loadedFromHistory) {
    setPerspective(perspectives.get(0).getId());
  }
}