import java.beans.PropertyChangeEvent;
import java.io.File;
import java.io.FileWriter;
+import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import jalview.schemes.TCoffeeColourScheme;
import jalview.util.HttpUtils;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
statusBar.setText(MessageManager.formatMessage(
"label.successfully_saved_to_file_in_format", new Object[]
- { fileName, format }));
+ { file, format }));
}
else
else
{
// create backupfiles object and get new temp filename destination
+ Cache.log.debug("ALIGNFRAME making backupfiles object for " + file);
BackupFiles backupfiles = new BackupFiles(file);
try
{
- PrintWriter out = new PrintWriter(
- new FileWriter(backupfiles.getTempFilePath()));
+ String tempFilePath = backupfiles.getTempFilePath();
+ Cache.log.debug(
+ "ALIGNFRAME setting PrintWriter to " + tempFilePath);
+ PrintWriter out = new PrintWriter(new FileWriter(tempFilePath));
+
+ Cache.log.debug(
+ "ALIGNFRAME about to write to temp file " + tempFilePath);
out.print(output);
+ Cache.log.debug("ALIGNFRAME about to close file");
out.close();
+ Cache.log.debug("ALIGNFRAME closed file");
this.setTitle(file);
statusBar.setText(MessageManager.formatMessage(
"label.successfully_saved_to_file_in_format", new Object[]
- { fileName, format.getName() }));
+ { file, format.getName() }));
+ } catch (IOException e)
+ {
+ success = false;
+ Cache.log.error(
+ "ALIGNFRAME Something happened writing the temp file");
+ Cache.log.error(e.getMessage());
+ Cache.log.debug(Cache.getStackTraceString(e));
+
} catch (Exception ex)
{
success = false;
- ex.printStackTrace();
+ Cache.log.error(
+ "ALIGNFRAME Something else happened writing the temp file");
+ Cache.log.error(ex.getMessage());
+ Cache.log.debug(Cache.getStackTraceString(ex));
}
backupfiles.setWriteSuccess(success);
+ Cache.log.debug("ALIGNFRAME writing temp file was "
+ + (success ? "" : "NOT ") + "successful");
// do the backup file roll and rename the temp file to actual file
+ Cache.log.debug("ALIGNFRAME about to rollBackupsAndRenameTempFile");
success = backupfiles.rollBackupsAndRenameTempFile();
+ Cache.log.debug("ALIGNFRAME performed rollBackupsAndRenameTempFile "
+ + (success ? "" : "un") + "successfully");
}
}
if (!success)
{
- JvOptionPane.showInternalMessageDialog(this, MessageManager
- .formatMessage("label.couldnt_save_file", new Object[]
- { fileName }),
- MessageManager.getString("label.error_saving_file"),
- JvOptionPane.WARNING_MESSAGE);
+ if (!Platform.isHeadless())
+ {
+ JvOptionPane.showInternalMessageDialog(this, MessageManager
+ .formatMessage("label.couldnt_save_file", new Object[]
+ { file }),
+ MessageManager.getString("label.error_saving_file"),
+ JvOptionPane.WARNING_MESSAGE);
+ }
}
return success;