Program: 141755
Project: 141755
Buggy source:
/** 
 * Open an appropriate destination browser so that the user can specify a source to import from.
 */
@Override protected void handleDestinationBrowseButtonPressed(){
  FileDialog dialog=new FileDialog(getContainer().getShell(),SWT.SAVE);
  if (getCurrentExportType().equals(EXPORTTYPE_WSWAR)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_JBOSSESB)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_OSGI)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_KAR)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_PETALSESB)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
  if (getCurrentExportType().equals(EXPORTTYPE_PETALSESB)) {
    IPath destPath=new Path(this.saDestinationFilePath);
    String fileName, directory;
    if (destPath.toFile().isDirectory()) {
      fileName=getPetalsDefaultSaName();
      directory=destPath.toOSString();
    }
 else {
      fileName=destPath.lastSegment();
      directory=destPath.removeLastSegments(1).toOSString();
    }
    dialog.setFileName(fileName);
    dialog.setFilterPath(directory);
  }
 else {
    dialog.setText("String_Node_Str");
    dialog.setFileName((String)this.getDefaultFileName().get(0));
    String currentSourceString=getDestinationValue();
    int lastSeparatorIndex=currentSourceString.lastIndexOf(File.separator);
    if (lastSeparatorIndex != -1) {
      dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
    }
  }
  String selectedFileName=dialog.open();
  if (selectedFileName == null) {
    return;
  }
  if (!selectedFileName.endsWith(this.getOutputSuffix())) {
    selectedFileName+=this.getOutputSuffix();
  }
  if (selectedFileName != null && !selectedFileName.endsWith(this.getSelectedJobVersion() + this.getOutputSuffix())) {
    String b=selectedFileName.substring(0,(selectedFileName.length() - 4));
    File file=new File(b);
    String str=file.getName();
    String s=(String)this.getDefaultFileName().get(0);
    if (str.equals(s)) {
      selectedFileName=b + "String_Node_Str" + this.getDefaultFileName().get(1)+ this.getOutputSuffix();
    }
 else {
      selectedFileName=b + this.getOutputSuffix();
    }
  }
  if (selectedFileName != null) {
    setErrorMessage(null);
    this.saDestinationFilePath=selectedFileName;
    setDestinationValue(selectedFileName);
    if (getDialogSettings() != null) {
      IDialogSettings section=getDialogSettings().getSection(DESTINATION_FILE);
      if (section == null) {
        section=getDialogSettings().addNewSection(DESTINATION_FILE);
      }
      section.put(DESTINATION_FILE,selectedFileName);
    }
  }
}

Fixed version (ground truth):
/** 
 * Open an appropriate destination browser so that the user can specify a source to import from.
 */
@Override protected void handleDestinationBrowseButtonPressed(){
  FileDialog dialog=new FileDialog(getContainer().getShell(),SWT.SAVE);
  if (getCurrentExportType().equals(EXPORTTYPE_WSWAR)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_JBOSSESB)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_OSGI)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_KAR)) {
    if (isAddMavenScript()) {
      dialog.setFilterExtensions(new String[]{"String_Node_Str" + FileConstants.ZIP_FILE_SUFFIX,"String_Node_Str"});
    }
 else {
      dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
    }
  }
 else   if (getCurrentExportType().equals(EXPORTTYPE_PETALSESB)) {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
 else {
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  }
  if (getCurrentExportType().equals(EXPORTTYPE_PETALSESB)) {
    IPath destPath=new Path(this.saDestinationFilePath);
    String fileName, directory;
    if (destPath.toFile().isDirectory()) {
      fileName=getPetalsDefaultSaName();
      directory=destPath.toOSString();
    }
 else {
      fileName=destPath.lastSegment();
      directory=destPath.removeLastSegments(1).toOSString();
    }
    dialog.setFileName(fileName);
    dialog.setFilterPath(directory);
  }
 else {
    dialog.setText("String_Node_Str");
    dialog.setFileName((String)this.getDefaultFileName().get(0));
    String currentSourceString=getDestinationValue();
    int lastSeparatorIndex=currentSourceString.lastIndexOf(File.separator);
    if (lastSeparatorIndex != -1) {
      dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
    }
  }
  String selectedFileName=dialog.open();
  if (selectedFileName == null) {
    return;
  }
  String idealSuffix;
  if (isAddMavenScript()) {
    idealSuffix=FileConstants.ZIP_FILE_SUFFIX;
  }
 else {
    idealSuffix=getOutputSuffix();
  }
  if (!selectedFileName.endsWith(idealSuffix)) {
    selectedFileName+=idealSuffix;
  }
  if (selectedFileName != null && !selectedFileName.endsWith(this.getSelectedJobVersion() + idealSuffix)) {
    String b=selectedFileName.substring(0,(selectedFileName.length() - 4));
    File file=new File(b);
    String str=file.getName();
    String s=(String)this.getDefaultFileName().get(0);
    if (str.equals(s)) {
      selectedFileName=b + "String_Node_Str" + this.getDefaultFileName().get(1)+ idealSuffix;
    }
 else {
      selectedFileName=b + idealSuffix;
    }
  }
  if (selectedFileName != null) {
    setErrorMessage(null);
    this.saDestinationFilePath=selectedFileName;
    setDestinationValue(selectedFileName);
    if (getDialogSettings() != null) {
      IDialogSettings section=getDialogSettings().getSection(DESTINATION_FILE);
      if (section == null) {
        section=getDialogSettings().addNewSection(DESTINATION_FILE);
      }
      section.put(DESTINATION_FILE,selectedFileName);
    }
  }
}