X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFileParse.java;h=f4f765c63f3ab1866da1d00981827e078b8cae54;hb=a57e62adb20b8c9be0172f2d5d1e767c3aa528ca;hp=40bc00579d4a30a35ad49908b86fb2a45c6f2a4e;hpb=811f815af8e9b14e2e8f3d45ef45ab20ceae4449;p=jalview.git diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 40bc005..f4f765c 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -37,6 +37,7 @@ public class FileParse protected BufferedReader dataIn=null; protected String errormessage="UNITIALISED SOURCE"; protected boolean error=true; + protected String warningMessage=null; /** * size of readahead buffer used for when initial stream position is marked. */ @@ -51,6 +52,7 @@ public class FileParse * @return this.error (true if the source was invalid) */ private boolean checkFileSource(String fileStr) throws IOException { + error=false; this.inFile = new File(fileStr); // check to see if it's a Jar file in disguise. if (!inFile.exists()) { @@ -111,11 +113,16 @@ public class FileParse { if (checkFileSource(fileStr)) { String suffixLess = extractSuffix(fileStr); - if (suffixLess!=null && checkFileSource(suffixLess)) + if (suffixLess!=null) { - throw new IOException("Problem opening "+inFile+" (also tried "+fileStr+") : "+errormessage); + if (checkFileSource(suffixLess)) + { + throw new IOException("Problem opening "+inFile+" (also tried "+suffixLess+") : "+errormessage); + } + } else + { + throw new IOException("Problem opening "+inFile+" : "+errormessage); } - throw new IOException("Problem opening "+inFile+" : "+errormessage); } } else if (type.equals(AppletFormatAdapter.URL)) @@ -200,4 +207,18 @@ public class FileParse throw new IOException("Implementation Error: Reset called for invalid source."); } } + /** + * + * @return true if there is a warning for the user + */ + public boolean hasWarningMessage() { + return (warningMessage!=null && warningMessage.length()>0); + } + /** + * + * @return empty string or warning message about file that was just parsed. + */ + public String getWarningMessage() { + return warningMessage; + } }