X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;fp=src%2Fjalview%2Fbin%2FCache.java;h=3c919cb4d2f76b4083ef05177e1315b84320ea9e;hb=3da878124135ff033f42d19d8733891b09e953cd;hp=19aa800c54b96bd5c4ee8ee34268cf4f7ffc4e16;hpb=549cdd8bcac48cade7880c4a800d9c90b4d02632;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 19aa800..3c919cb 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -28,6 +28,7 @@ import jalview.schemes.UserColourScheme; import jalview.structure.StructureImportSettings; import jalview.urls.IdOrgSettings; import jalview.util.ColorUtils; +import jalview.util.Platform; import jalview.ws.sifts.SiftsSettings; import java.awt.Color; @@ -277,7 +278,8 @@ public class Cache /** Default file is ~/.jalview_properties */ static String propertiesFile; - private static boolean propsAreReadOnly = false; + private static boolean propsAreReadOnly = /** @j2sNative true || */ + false; public static void initLogger() { @@ -386,6 +388,8 @@ public class Cache } // LOAD THE AUTHORS FROM THE authors.props file + boolean ignore = Platform.isJS(); + if (!ignore) try { String authorDetails = "jar:" @@ -397,17 +401,25 @@ public class Cache InputStream in = localJarFileURL.openStream(); applicationProperties.load(in); in.close(); + } catch (Exception ex) { System.out.println("Error reading author details: " + ex); - applicationProperties.remove("AUTHORS"); - applicationProperties.remove("AUTHORFNAMES"); - applicationProperties.remove("YEAR"); + ignore = true; } + if (ignore) { + applicationProperties.remove("AUTHORS"); + applicationProperties.remove("AUTHORFNAMES"); + applicationProperties.remove("YEAR"); + } + // FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar // MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW + // BH 2019.01.25 switching to Platform.isJS() + ignore = Platform.isJS(); + if (!ignore) try { String buildDetails = "jar:".concat(Cache.class.getProtectionDomain() @@ -422,7 +434,11 @@ public class Cache } catch (Exception ex) { System.out.println("Error reading build details: " + ex); - applicationProperties.remove("VERSION"); + ignore = true; + } + + if (ignore) { + applicationProperties.remove("VERSION"); } String jnlpVersion = System.getProperty("jalview.version"); @@ -610,18 +626,13 @@ public class Cache } /** - * These methods are used when checking if the saved preference is different - * to the default setting + * Answers the value of the given property, or the supplied default value if + * the property is not set */ public static String getDefault(String property, String def) { - String string = getProperty(property); - if (string != null) - { - return string; - } - - return def; + String value = getProperty(property); + return value == null ? def : value; } /** @@ -1063,4 +1074,19 @@ public class Cache } } } + + /** + * Add a known domain that implements access-control-allow-origin:* bh 2018 + * + * @param defaultUniprotDomain + */ + public static void addJ2SDirectDatabaseCall(String domain) + { + + /** + * @j2sNative + * + * J2S.addDirectDatabaseCall(domain); + */ + } }