From cc6197585bf74c9562c0b869a4d28646af5b13bc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 17 Apr 2019 16:34:58 +0100 Subject: [PATCH] JAL-3026 fix bug loading Jalview Project (in Java) --- src/jalview/io/AnnotationFile.java | 2 +- src/jalview/io/FileLoader.java | 2 +- src/jalview/project/Jalview2XML.java | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index aa29ced..02667c5 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -684,7 +684,7 @@ public class AnnotationFile { if (sourceType == DataSourceType.FILE) { - in = FileLoader.getBuffereReader(file); + in = FileLoader.getBufferedReader(file); } else if (sourceType == DataSourceType.URL) { diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 2169715..38cf3e6 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -647,7 +647,7 @@ public class FileLoader implements Runnable * @throws FileNotFoundException */ @SuppressWarnings("unused") - public static BufferedReader getBuffereReader(Object file) throws FileNotFoundException { + public static BufferedReader getBufferedReader(Object file) throws FileNotFoundException { if (file instanceof String) { return new BufferedReader(new FileReader((String) file)); diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 41dd2f9..4d772a1 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -462,7 +462,7 @@ public class Jalview2XML public boolean isResolvable() { return super.isResolvable() && mp.getTo() != null; - }; + } @Override boolean resolve() @@ -694,7 +694,6 @@ public class Jalview2XML } catch (Exception foo) { } - ; jout.close(); } catch (Exception ex) { @@ -780,7 +779,6 @@ public class Jalview2XML } catch (Exception foo) { } - ; jout.close(); boolean success = true; @@ -2763,7 +2761,7 @@ public class Jalview2XML public void run() { setLoadingFinishedForNewStructureViewers(); - }; + } }); } catch (Exception x) { @@ -2779,7 +2777,8 @@ public class Jalview2XML // BH 2018 allow for bytes already attached to File object try { String file = (ofile instanceof File ? ((File) ofile).getCanonicalPath() : ofile.toString()); - byte[] bytes = Platform.getFileBytes((File) ofile); + byte[] bytes = Platform.isJS() ? Platform.getFileBytes((File) ofile) + : null; URL url = null; errorMessage = null; uniqueSetSuffix = null; -- 1.7.10.2