Program: 127016
Project: 127016
Buggy source:
/** 
 * DOC Comment method "setPerspectiveTabs".
 */
public static void setPerspectiveTabs(){
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage activePage=activeWorkbenchWindow.getActivePage();
  PerspectiveBarManager barManager=((WorkbenchWindow)activeWorkbenchWindow).getPerspectiveBar();
  try {
    createPerspective(activePage,IBrandingConfiguration.PERSPECTIVE_CAMEL_ID);
  }
 catch (  Exception e) {
    createPerspective(activePage,barManager,IBrandingConfiguration.PERSPECTIVE_CAMEL_ID);
  }
  try {
    createPerspective(activePage,IBrandingConfiguration.PERSPECTIVE_MDM_ID);
  }
 catch (  Exception e) {
    createPerspective(activePage,barManager,IBrandingConfiguration.PERSPECTIVE_MDM_ID);
  }
  try {
    createPerspective(activePage,IBrandingConfiguration.PERSPECTIVE_DQ_ID);
  }
 catch (  Exception e) {
    createPerspective(activePage,barManager,IBrandingConfiguration.PERSPECTIVE_DQ_ID);
  }
  try {
    createPerspective(activePage,IBrandingConfiguration.PERSPECTIVE_DI_ID);
  }
 catch (  Exception e) {
    createPerspective(activePage,barManager,IBrandingConfiguration.PERSPECTIVE_DI_ID);
  }
  barManager.update(false);
}

Fixed version (ground truth):
/** 
 * DOC Comment method "setPerspectiveTabs".
 */
public static void setPerspectiveTabs(){
  IWorkbenchWindow activeWorkbenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  ((WorkbenchWindow)activeWorkbenchWindow).addPerspectiveReorderListener(null);
  PerspectiveBarManager barManager=((WorkbenchWindow)activeWorkbenchWindow).getPerspectiveBar();
  if (barManager != null && (barManager instanceof PerspectiveBarManager)) {
    cleanPerspectiveBar();
    IContributionItem lastPerspective=null;
    IContributionItem diCItem=barManager.find(IBrandingConfiguration.PERSPECTIVE_DI_ID);
    if (null == diCItem) {
      IPerspectiveDescriptor diMailPerspective=WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(IBrandingConfiguration.PERSPECTIVE_DI_ID);
      if (null != diMailPerspective && (diMailPerspective instanceof IPerspectiveDescriptor)) {
        PerspectiveBarContributionItem diItem=new PerspectiveBarContributionItem(diMailPerspective,activeWorkbenchWindow.getActivePage());
        if (null != diItem && (diItem instanceof PerspectiveBarContributionItem)) {
          barManager.addItem(diItem);
          diCItem=diItem;
        }
      }
    }
    lastPerspective=diCItem;
    IContributionItem dqCItem=barManager.find(IBrandingConfiguration.PERSPECTIVE_DQ_ID);
    if (null == dqCItem) {
      IPerspectiveDescriptor dqMailPerspective=WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(IBrandingConfiguration.PERSPECTIVE_DQ_ID);
      if (null != dqMailPerspective && (dqMailPerspective instanceof IPerspectiveDescriptor)) {
        PerspectiveBarContributionItem dqItem=new PerspectiveBarContributionItem(dqMailPerspective,activeWorkbenchWindow.getActivePage());
        if (null != dqItem && (dqItem instanceof PerspectiveBarContributionItem)) {
          if (diCItem != null) {
            barManager.insertAfter(diCItem.getId(),dqItem);
          }
 else {
            barManager.addItem(dqItem);
          }
          dqCItem=dqItem;
        }
      }
    }
    if (dqCItem != null) {
      lastPerspective=dqCItem;
    }
    IContributionItem mdmCItem=barManager.find(IBrandingConfiguration.PERSPECTIVE_MDM_ID);
    if (null == mdmCItem) {
      IPerspectiveDescriptor mdmMailPerspective=WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(IBrandingConfiguration.PERSPECTIVE_MDM_ID);
      if (null != mdmMailPerspective && (mdmMailPerspective instanceof IPerspectiveDescriptor)) {
        PerspectiveBarContributionItem mdmItem=new PerspectiveBarContributionItem(mdmMailPerspective,activeWorkbenchWindow.getActivePage());
        if (null != mdmItem && (mdmItem instanceof PerspectiveBarContributionItem)) {
          if (lastPerspective != null) {
            barManager.insertAfter(lastPerspective.getId(),mdmItem);
          }
 else {
            barManager.addItem(mdmItem);
          }
          mdmCItem=mdmItem;
        }
      }
    }
    if (mdmCItem != null) {
      lastPerspective=mdmCItem;
    }
    IContributionItem esbCItem=barManager.find(IBrandingConfiguration.PERSPECTIVE_CAMEL_ID);
    if (null == esbCItem) {
      IPerspectiveDescriptor esbPerspective=WorkbenchPlugin.getDefault().getPerspectiveRegistry().findPerspectiveWithId(IBrandingConfiguration.PERSPECTIVE_CAMEL_ID);
      if (null != esbPerspective && (esbPerspective instanceof IPerspectiveDescriptor)) {
        PerspectiveBarContributionItem esbItem=new PerspectiveBarContributionItem(esbPerspective,activeWorkbenchWindow.getActivePage());
        if (null != esbItem && (esbItem instanceof PerspectiveBarContributionItem)) {
          if (lastPerspective != null) {
            barManager.insertAfter(lastPerspective.getId(),esbItem);
          }
 else {
            barManager.addItem(esbItem);
          }
          mdmCItem=esbItem;
        }
      }
    }
    barManager.update(false);
  }
}