Program: 190162
Project: 190162
Buggy source:
private void addGroupTabs(){
  final Perspective[] perspectives=Lookup.getDefault().lookupAll(Perspective.class).toArray(new Perspective[0]);
  final PerspectiveMember[] members=Lookup.getDefault().lookupAll(PerspectiveMember.class).toArray(new PerspectiveMember[0]);
  buttons=new JPerspectiveButton[perspectives.length];
  int i=0;
  for (  final Perspective perspective : perspectives) {
    JPerspectiveButton toggleButton=new JPerspectiveButton(perspective.getDisplayName(),perspective.getIcon());
    toggleButton.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        for (        Perspective g : perspectives) {
          if (g != perspective) {
            TopComponentGroup tpg=WindowManager.getDefault().findTopComponentGroup(g.getName());
            tpg.close();
          }
        }
        TopComponentGroup tpg=WindowManager.getDefault().findTopComponentGroup(perspective.getName());
        tpg.open();
        Perspective closingPerspective=getPerspective(selectedPerspective);
        for (        PerspectiveMember member : members) {
          if (member.close(closingPerspective)) {
            if (member instanceof TopComponent) {
              ((TopComponent)member).close();
            }
          }
        }
        for (        PerspectiveMember member : members) {
          if (member.open(perspective)) {
            if (member instanceof TopComponent) {
              ((TopComponent)member).open();
            }
          }
        }
        selectedPerspective=perspective.getName();
      }
    }
);
    perspectivesButtonGroup.add(toggleButton);
    buttonsPanel.add(toggleButton);
    buttons[i++]=toggleButton;
  }
  refreshSelectedPerspective();
}

Fixed version (ground truth):
private void addGroupTabs(){
  final Perspective[] perspectives=Lookup.getDefault().lookupAll(Perspective.class).toArray(new Perspective[0]);
  buttons=new JPerspectiveButton[perspectives.length];
  int i=0;
  for (  final Perspective perspective : perspectives) {
    JPerspectiveButton toggleButton=new JPerspectiveButton(perspective.getDisplayName(),perspective.getIcon());
    toggleButton.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        for (        Perspective g : perspectives) {
          if (g != perspective) {
            TopComponentGroup tpg=WindowManager.getDefault().findTopComponentGroup(g.getName());
            tpg.close();
          }
        }
        TopComponentGroup tpg=WindowManager.getDefault().findTopComponentGroup(perspective.getName());
        tpg.open();
        PerspectiveMember[] members=Lookup.getDefault().lookupAll(PerspectiveMember.class).toArray(new PerspectiveMember[0]);
        Perspective closingPerspective=getPerspective(selectedPerspective);
        for (        PerspectiveMember member : members) {
          if (member.close(closingPerspective)) {
            if (member instanceof TopComponent) {
              boolean closed=((TopComponent)member).close();
              System.out.println("String_Node_Str" + member + "String_Node_Str"+ closed);
            }
          }
        }
        for (        PerspectiveMember member : members) {
          if (member.open(perspective)) {
            if (member instanceof TopComponent && !((TopComponent)member).isOpened()) {
              ((TopComponent)member).open();
              System.out.println("String_Node_Str" + member);
            }
          }
        }
        selectedPerspective=perspective.getName();
      }
    }
);
    perspectivesButtonGroup.add(toggleButton);
    buttonsPanel.add(toggleButton);
    buttons[i++]=toggleButton;
  }
  refreshSelectedPerspective();
}