Program: 125962
Project: 125962
Buggy source:
private void retrieveLicensesModel(){
  final Element licenseRoot=new Element();
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        List<ModuleToInstall> mti=modulesToInstall;
        if (mti == null) {
          mti=new ArrayList<ModuleToInstall>();
        }
        Map<String,License> typeToLicense=new HashMap<String,License>();
        for (        ModuleToInstall moduleToInstall : mti) {
          String licenseType=moduleToInstall.getLicenseType();
          if (licenseType == null) {
            licenseType=UNKNOWN_LICENSE;
          }
          boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(licenseType);
          if (isLicenseAccepted) {
            continue;
          }
          License license=typeToLicense.get(licenseType);
          if (license == null) {
            license=new License();
            String licenseUrl=RemoteModulesHelper.getInstance().getLicenseUrl(licenseType);
            license.setName(licenseType);
            license.setType(licenseType);
            license.setUrl(licenseUrl);
            license.setParent(licenseRoot);
            licenseRoot.addChild(license);
            typeToLicense.put(licenseType,license);
            licenseTypeToStatus.put(licenseType,false);
          }
          Module module=new Module();
          module.setName(moduleToInstall.getName());
          module.setParent(license);
          license.addChild(module);
        }
      }
  finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  licenseTypeViewer.setInput(licenseRoot);
  if (licenseTypeViewer.getTree().getItems().length > 0) {
    TreeItem item=licenseTypeViewer.getTree().getItem(0);
    if (item != null) {
      licenseTypeViewer.setSelection(new StructuredSelection(item.getData()),true);
    }
  }
}

Fixed version (ground truth):
private void retrieveLicensesModel(){
  final Element licenseRoot=new Element();
  IRunnableWithProgress runnableWithProgress=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
      try {
        List<ModuleToInstall> mti=modulesToInstall;
        if (mti == null) {
          mti=new ArrayList<ModuleToInstall>();
        }
        Map<String,License> typeToLicense=new HashMap<String,License>();
        for (        ModuleToInstall moduleToInstall : mti) {
          if (moduleToInstall.isFromCustomNexus()) {
            continue;
          }
          String licenseType=moduleToInstall.getLicenseType();
          if (licenseType == null) {
            licenseType=UNKNOWN_LICENSE;
          }
          boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(licenseType);
          if (isLicenseAccepted) {
            continue;
          }
          License license=typeToLicense.get(licenseType);
          if (license == null) {
            license=new License();
            String licenseUrl=RemoteModulesHelper.getInstance().getLicenseUrl(licenseType);
            license.setName(licenseType);
            license.setType(licenseType);
            license.setUrl(licenseUrl);
            license.setParent(licenseRoot);
            licenseRoot.addChild(license);
            typeToLicense.put(licenseType,license);
            licenseTypeToStatus.put(licenseType,false);
          }
          Module module=new Module();
          module.setName(moduleToInstall.getName());
          module.setParent(license);
          license.addChild(module);
        }
      }
  finally {
        monitor.done();
      }
    }
  }
;
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
  try {
    dialog.run(true,true,runnableWithProgress);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  licenseTypeViewer.setInput(licenseRoot);
  if (licenseTypeViewer.getTree().getItems().length > 0) {
    TreeItem item=licenseTypeViewer.getTree().getItem(0);
    if (item != null) {
      licenseTypeViewer.setSelection(new StructuredSelection(item.getData()),true);
    }
  }
}