Program: 52696
Project: 52696
Buggy source:
public void doSaveAs(MPart part,Shell shell,String extension,String encryptionMethod){
  FileDialog dialog=new FileDialog(shell,SWT.SAVE);
  String fileNameProposal=clientFile != null ? clientFile.getName() : part.getLabel();
  if (extension != null && !fileNameProposal.endsWith('.' + extension)) {
    int p=fileNameProposal.lastIndexOf('.');
    fileNameProposal=(p > 0 ? fileNameProposal.substring(0,p + 1) : fileNameProposal + '.') + extension;
  }
  dialog.setFileName(fileNameProposal);
  dialog.setFilterPath(clientFile != null ? clientFile.getAbsolutePath() : System.getProperty("String_Node_Str"));
  String path=dialog.open();
  if (path == null)   return;
  if (extension != null && !path.endsWith('.' + extension))   path+='.' + extension;
  File localFile=new File(path);
  char[] password=null;
  if (ClientFactory.isEncrypted(localFile)) {
    PasswordDialog pwdDialog=new PasswordDialog(shell);
    if (pwdDialog.open() != PasswordDialog.OK)     return;
    password=pwdDialog.getPassword().toCharArray();
  }
  try {
    clientFile=localFile;
    part.getPersistedState().put(UIConstants.File.PERSISTED_STATE_KEY,clientFile.getAbsolutePath());
    ClientFactory.save(client,clientFile,encryptionMethod,password);
    broker.post(UIConstants.Event.File.SAVED,clientFile.getAbsolutePath());
    dirty.setDirty(false);
    part.setLabel(clientFile.getName());
    part.setTooltip(clientFile.getAbsolutePath());
    storePreferences();
  }
 catch (  IOException e) {
    ErrorDialog.openError(shell,Messages.LabelError,e.getMessage(),new Status(Status.ERROR,PortfolioPlugin.PLUGIN_ID,e.getMessage(),e));
  }
}

Fixed version (ground truth):
public void doSaveAs(MPart part,Shell shell,String extension,String encryptionMethod){
  FileDialog dialog=new FileDialog(shell,SWT.SAVE);
  String fileNameProposal=clientFile != null ? clientFile.getName() : part.getLabel();
  if (extension != null && !fileNameProposal.endsWith('.' + extension)) {
    int p=fileNameProposal.lastIndexOf('.');
    fileNameProposal=(p > 0 ? fileNameProposal.substring(0,p + 1) : fileNameProposal + '.') + extension;
  }
  dialog.setFileName(fileNameProposal);
  dialog.setFilterPath(clientFile != null ? clientFile.getAbsolutePath() : System.getProperty("String_Node_Str"));
  String path=dialog.open();
  if (path == null)   return;
  if (extension != null && !path.endsWith('.' + extension))   path+='.' + extension;
  File localFile=new File(path);
  char[] password=null;
  if (ClientFactory.isEncrypted(localFile)) {
    PasswordDialog pwdDialog=new PasswordDialog(shell);
    if (pwdDialog.open() != PasswordDialog.OK)     return;
    password=pwdDialog.getPassword().toCharArray();
  }
  try {
    clientFile=localFile;
    part.getPersistedState().put(UIConstants.File.PERSISTED_STATE_KEY,clientFile.getAbsolutePath());
    ClientFactory.save(client,clientFile,encryptionMethod,password);
    broker.post(UIConstants.Event.File.SAVED,clientFile.getAbsolutePath());
    dirty.setDirty(false);
    part.setLabel(clientFile.getName());
    part.setTooltip(clientFile.getAbsolutePath());
    storePreferences();
  }
 catch (  IOException e) {
    PortfolioPlugin.log(e);
    ErrorDialog.openError(shell,Messages.LabelError,e.getMessage(),new Status(Status.ERROR,PortfolioPlugin.PLUGIN_ID,e.getMessage(),e));
  }
}