Program: 123303
Project: 123303
Buggy source:
private void createOptionsforPetalsESB(Composite left,Font font){
  GridLayout layout;
  singletonButton=new Button(left,SWT.CHECK | SWT.LEFT);
  singletonButton.setText(Messages.getString("String_Node_Str"));
  singletonButton.setFont(font);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  singletonButton.setLayoutData(gd);
  singletonButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isSingleton());
  singletonButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=singletonButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setSingleton(selection);
    }
  }
);
  userRoutineButton=new Button(left,SWT.CHECK | SWT.LEFT);
  userRoutineButton.setText("String_Node_Str");
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  userRoutineButton.setLayoutData(gd);
  userRoutineButton.setSelection(true);
  userRoutineButton.setFont(font);
  generateEndpointButton=new Button(left,SWT.CHECK | SWT.LEFT);
  generateEndpointButton.setText(Messages.getString("String_Node_Str"));
  generateEndpointButton.setFont(font);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  generateEndpointButton.setLayoutData(gd);
  generateEndpointButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isGenerateEndpoint());
  generateEndpointButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=generateEndpointButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setGenerateEndpoint(selection);
    }
  }
);
  sourceButton=new Button(left,SWT.CHECK | SWT.LEFT);
  sourceButton.setText("String_Node_Str");
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  sourceButton.setLayoutData(gd);
  sourceButton.setSelection(true);
  sourceButton.setFont(font);
  validateByWsdlButton=new Button(left,SWT.CHECK | SWT.LEFT);
  validateByWsdlButton.setText("String_Node_Str");
  validateByWsdlButton.setFont(font);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  validateByWsdlButton.setLayoutData(gd);
  validateByWsdlButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isValidateByWsdl());
  validateByWsdlButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=validateByWsdlButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setValidateByWsdl(selection);
      validateOptionsGroup();
    }
  }
);
  exportDependencies=new Button(left,SWT.CHECK);
  exportDependencies.setText("String_Node_Str");
  exportDependencies.setFont(font);
  exportDependencies.setVisible(false);
  left=new Composite(optionsGroupComposite,SWT.NONE);
  left.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  layout=new GridLayout(2,false);
  layout.marginHeight=0;
  layout.marginBottom=7;
  layout.horizontalSpacing=10;
  left.setLayout(layout);
  new Label(left,SWT.NONE).setText(Messages.getString("String_Node_Str"));
  contextCombo=new Combo(left,SWT.DROP_DOWN | SWT.READ_ONLY);
  gd=new GridData();
  gd.widthHint=180;
  contextCombo.setLayoutData(gd);
  if (getProcessItem() != null) {
    List<String> contextNames=getJobContexts(getProcessItem());
    contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
  }
  left=new Composite(optionsGroupComposite,SWT.NONE);
  left.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  layout=new GridLayout(2,false);
  layout.marginHeight=0;
  layout.marginBottom=7;
  layout.horizontalSpacing=10;
  left.setLayout(layout);
  final Link exposedContextsLink=new Link(left,SWT.NONE);
  exposedContextsLink.setText(Messages.getString("String_Node_Str"));
  exposedContextsLink.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ContextExportDialog dlg=new ContextExportDialog(getShell(),currentCtxTypes);
      if (dlg.open() == Window.OK) {
        currentCtxTypes=dlg.getContexts();
        String contextName=contextCombo.getItem(contextCombo.getSelectionIndex());
        ctxToTypeDefs.put(contextName,currentCtxTypes);
        contextCombo.notifyListeners(SWT.Selection,new Event());
        validateOptionsGroup();
      }
    }
  }
);
  contextCombo.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
      widgetSelected(e);
    }
    public void widgetSelected(    SelectionEvent e){
      int index=contextCombo.getSelectionIndex();
      if (index < 0)       return;
      String value=contextCombo.getItem(index);
      currentCtxTypes=ctxToTypeDefs.get(value);
      if (currentCtxTypes == null) {
        try {
          currentCtxTypes=TalendUtils.getWsdlSchemaForContexts(getProcessItem(),value);
        }
 catch (        PetalsExportException e1) {
          currentCtxTypes=new ArrayList<ContextTypeDefinition>(0);
          MessageDialog.openError(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        }
 finally {
          ctxToTypeDefs.put(value,currentCtxTypes);
        }
      }
      PetalsTemporaryOptionsKeeper.INSTANCE.setContexts(currentCtxTypes);
      int exportedCtxCount=0;
      for (      ContextTypeDefinition ctx : currentCtxTypes) {
        if (ctx.getExportType() != ContextExportType.NOT_EXPORTED)         exportedCtxCount++;
      }
      exposedContextsLink.setText(Messages.getString("String_Node_Str") + exportedCtxCount + "String_Node_Str");
      exposedContextsLink.setEnabled(currentCtxTypes.size() != 0);
    }
  }
);
  if (contextCombo.getItemCount() > 0) {
    contextCombo.select(0);
    contextCombo.notifyListeners(SWT.Selection,new Event());
  }
}

Fixed version (ground truth):
private void createOptionsforPetalsESB(Composite left,Font font){
  GridLayout layout;
  singletonButton=new Button(left,SWT.CHECK | SWT.LEFT);
  singletonButton.setText(Messages.getString("String_Node_Str"));
  singletonButton.setFont(font);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  singletonButton.setLayoutData(gd);
  singletonButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isSingleton());
  singletonButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=singletonButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setSingleton(selection);
    }
  }
);
  userRoutineButton=new Button(left,SWT.CHECK | SWT.LEFT);
  userRoutineButton.setText("String_Node_Str");
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  userRoutineButton.setLayoutData(gd);
  userRoutineButton.setSelection(true);
  userRoutineButton.setFont(font);
  generateEndpointButton=new Button(left,SWT.CHECK | SWT.LEFT);
  generateEndpointButton.setText(Messages.getString("String_Node_Str"));
  generateEndpointButton.setFont(font);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  generateEndpointButton.setLayoutData(gd);
  generateEndpointButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isGenerateEndpoint());
  generateEndpointButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=generateEndpointButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setGenerateEndpoint(selection);
    }
  }
);
  sourceButton=new Button(left,SWT.CHECK | SWT.LEFT);
  sourceButton.setText("String_Node_Str");
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  sourceButton.setLayoutData(gd);
  sourceButton.setSelection(true);
  sourceButton.setFont(font);
  validateByWsdlButton=new Button(left,SWT.CHECK | SWT.LEFT);
  validateByWsdlButton.setText("String_Node_Str");
  validateByWsdlButton.setFont(font);
  gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=1;
  validateByWsdlButton.setLayoutData(gd);
  validateByWsdlButton.setSelection(PetalsTemporaryOptionsKeeper.INSTANCE.isValidateByWsdl());
  validateByWsdlButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean selection=validateByWsdlButton.getSelection();
      PetalsTemporaryOptionsKeeper.INSTANCE.setValidateByWsdl(selection);
      validateOptionsGroup();
    }
  }
);
  exportDependencies=new Button(left,SWT.CHECK);
  exportDependencies.setText("String_Node_Str");
  exportDependencies.setFont(font);
  exportDependencies.setVisible(false);
  left=new Composite(optionsGroupComposite,SWT.NONE);
  left.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  layout=new GridLayout(2,false);
  layout.marginHeight=0;
  layout.marginBottom=7;
  layout.horizontalSpacing=10;
  left.setLayout(layout);
  new Label(left,SWT.NONE).setText(Messages.getString("String_Node_Str"));
  contextCombo=new Combo(left,SWT.DROP_DOWN | SWT.READ_ONLY);
  gd=new GridData();
  gd.widthHint=180;
  contextCombo.setLayoutData(gd);
  if (getProcessItem() != null) {
    List<String> contextNames=getJobContexts(getProcessItem());
    contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
  }
  left=new Composite(optionsGroupComposite,SWT.NONE);
  left.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  layout=new GridLayout(2,false);
  layout.marginHeight=0;
  layout.marginBottom=7;
  layout.horizontalSpacing=10;
  left.setLayout(layout);
  final Link exposedContextsLink=new Link(left,SWT.NONE);
  exposedContextsLink.setText(Messages.getString("String_Node_Str"));
  exposedContextsLink.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ContextExportDialog dlg=new ContextExportDialog(getShell(),currentCtxTypes);
      if (dlg.open() == Window.OK) {
        currentCtxTypes=dlg.getContexts();
        String contextName=contextCombo.getItem(contextCombo.getSelectionIndex());
        ctxToTypeDefs.put(contextName,currentCtxTypes);
        contextCombo.notifyListeners(SWT.Selection,new Event());
        validateOptionsGroup();
      }
    }
  }
);
  contextCombo.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
      widgetSelected(e);
    }
    public void widgetSelected(    SelectionEvent e){
      int index=contextCombo.getSelectionIndex();
      if (index < 0) {
        return;
      }
      String value=contextCombo.getItem(index);
      currentCtxTypes=ctxToTypeDefs.get(value);
      if (currentCtxTypes == null) {
        try {
          currentCtxTypes=TalendUtils.getWsdlSchemaForContexts(getProcessItem(),value);
        }
 catch (        PetalsExportException e1) {
          currentCtxTypes=new ArrayList<ContextTypeDefinition>(0);
          MessageDialog.openError(getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        }
 finally {
          ctxToTypeDefs.put(value,currentCtxTypes);
        }
      }
      PetalsTemporaryOptionsKeeper.INSTANCE.setContexts(currentCtxTypes);
      int exportedCtxCount=0;
      for (      ContextTypeDefinition ctx : currentCtxTypes) {
        if (ctx.getExportType() != ContextExportType.NOT_EXPORTED) {
          exportedCtxCount++;
        }
      }
      exposedContextsLink.setText(Messages.getString("String_Node_Str") + exportedCtxCount + "String_Node_Str");
      exposedContextsLink.setEnabled(currentCtxTypes.size() != 0);
    }
  }
);
  if (contextCombo.getItemCount() > 0) {
    contextCombo.select(0);
    contextCombo.notifyListeners(SWT.Selection,new Event());
  }
}