package jalview.io;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Locale;
private static final String XMLHEADER = "<?XML VERSION=\"1.0\" ENCODING=\"UTF-8\" STANDALONE=\"YES\"?>";
public FileFormatI identify(Object file, DataSourceType protocol)
- throws FileFormatException
+ throws FileFormatException, FileNotFoundException
{
// BH 2018
return (file instanceof File ? identify((File) file, protocol)
* @throws FileFormatException
*/
public FileFormatI identify(String file, DataSourceType sourceType)
- throws FileFormatException
+ throws FileFormatException, FileNotFoundException
{
String emessage = "UNIDENTIFIED FILE PARSING ERROR";
FileParse parser = null;
+ FileNotFoundException fnf = null;
try
{
parser = new FileParse(file, sourceType);
{
return identify(parser);
}
+ } catch (FileNotFoundException e)
+ {
+ fnf = e;
+ emessage = "Could not find '" + file + "'";
+ Console.error("Could not find '" + file + "'", e);
+ } catch (IOException e)
+ {
+ Console.error("Error whilst trying to read " + file, e);
} catch (Exception e)
{
Console.error("Error whilst identifying " + file, e);
{
throw new FileFormatException(parser.errormessage);
}
+ if (fnf != null)
+ {
+ throw (fnf);
+ }
throw new FileFormatException(emessage);
}
try
{
type = ider.identify(args[i], DataSourceType.FILE);
+ } catch (FileNotFoundException e)
+ {
+ Console.error(String.format("Error '%s' fetching file %s", args[i],
+ e.getMessage()));
} catch (FileFormatException e)
{
Console.error(