From aa5a15ade3b078f6c2cf78db5aa05e0dcb1ce792 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 11 Mar 2010 17:06:16 +0000 Subject: [PATCH] pass any warning messages to StdErr - also todo to allow caller to check for any output warnings. --- src/jalview/io/AppletFormatAdapter.java | 10 ++++++++-- src/jalview/io/FormatAdapter.java | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index d2dc8f3..8e05b44 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -365,7 +365,8 @@ public class AppletFormatAdapter /** * Construct an output class for an alignment in a particular filetype - * + * TODO: allow caller to detect errors and warnings encountered when generating output + * * @param format * string name of alignment format * @param alignment @@ -429,7 +430,12 @@ public class AppletFormatAdapter afile.setSeqs(alignment.getSequencesArray()); - return afile.print(); + String afileresp = afile.print(); + if (afile.hasWarningMessage()) + { + System.err.println("Warning raised when writing as "+format+" : "+afile.getWarningMessage()); + } + return afileresp; } catch (Exception e) { System.err.println("Failed to write alignment as a '" + format diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 25e2fea..2735fb3 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -63,6 +63,8 @@ public class FormatAdapter extends AppletFormatAdapter /** * Format a vector of sequences as a flat alignment file. + * TODO: allow caller to detect errors and warnings encountered when generating output + * * * @param format * Format string as givien in the AppletFormatAdaptor list @@ -130,8 +132,12 @@ public class FormatAdapter extends AppletFormatAdapter */ afile.setSeqs(seqs); - - return afile.print(); + String afileresp = afile.print(); + if (afile.hasWarningMessage()) + { + System.err.println("Warning raised when writing as "+format+" : "+afile.getWarningMessage()); + } + return afileresp; } catch (Exception e) { System.err.println("Failed to write alignment as a '" + format -- 1.7.10.2