Program: 122852
Project: 122852
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);
  JobExportType jobExportType=getCurrentExportType1();
switch (jobExportType) {
case WSWAR:
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  break;
case JBOSSESB:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
case OSGI:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
case PETALSESB:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
default :
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
}
if (jobExportType.equals(JobExportType.PETALSESB)) {
IPath destPath=new Path(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(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(getOutputSuffix())) selectedFileName+=getOutputSuffix();
if (selectedFileName != null && !selectedFileName.endsWith(getSelectedJobVersion() + getOutputSuffix())) {
String b=selectedFileName.substring(0,(selectedFileName.length() - 4));
File file=new File(b);
String str=file.getName();
String s=getDefaultFileName().get(0);
if (str.equals(s)) {
if (getDefaultFileName().get(1) != null && !"String_Node_Str".equals(getDefaultFileName().get(1))) {
selectedFileName=b + ((JobExportType.OSGI.equals(jobExportType)) ? "String_Node_Str" : "String_Node_Str") + getDefaultFileName().get(1)+ getOutputSuffix();
}
 else {
selectedFileName=b + getOutputSuffix();
}
}
 else {
selectedFileName=b + getOutputSuffix();
}
}
if (selectedFileName != null) {
setErrorMessage(null);
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);
  JobExportType jobExportType=getCurrentExportType1();
switch (jobExportType) {
case WSWAR:
    dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
  break;
case JBOSSESB:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
case OSGI:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
case PETALSESB:
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
break;
default :
dialog.setFilterExtensions(new String[]{"String_Node_Str","String_Node_Str"});
}
if (jobExportType.equals(JobExportType.PETALSESB)) {
IPath destPath=new Path(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(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(getOutputSuffix())) {
selectedFileName+=getOutputSuffix();
}
if (selectedFileName != null && !selectedFileName.endsWith(getSelectedJobVersion() + getOutputSuffix())) {
String b=selectedFileName.substring(0,(selectedFileName.length() - 4));
File file=new File(b);
String str=file.getName();
String s=getDefaultFileName().get(0);
if (str.equals(s)) {
if (getDefaultFileName().get(1) != null && !"String_Node_Str".equals(getDefaultFileName().get(1))) {
selectedFileName=b + ((JobExportType.OSGI.equals(jobExportType)) ? "String_Node_Str" : "String_Node_Str") + getDefaultFileName().get(1)+ getOutputSuffix();
}
 else {
selectedFileName=b + getOutputSuffix();
}
}
 else {
selectedFileName=b + getOutputSuffix();
}
}
if (selectedFileName != null) {
setErrorMessage(null);
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);
}
}
}