X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=153eaffd12cd301667e50ee2c13daf97d965bb07;hb=f7791271668cdcf6e87b638f0e6475ccdea6a3f9;hp=594046fc07976370f0650f290cc3f4e01f1ba965;hpb=9092d9f4c2231645b58968e964c858e010be14e2;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 594046f..153eaff 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -60,6 +60,7 @@ import jalview.schemes.ColourSchemes; import jalview.schemes.UserColourScheme; import jalview.structure.StructureImportSettings; import jalview.urls.IdOrgSettings; +import jalview.util.ChannelProperties; import jalview.util.ColorUtils; import jalview.util.MessageManager; import jalview.util.Platform; @@ -356,7 +357,8 @@ public class Cache // lcastor.addAppender(ap); // jalview.bin.Cache.log.addAppender(ap); // Tell the user that debug is enabled - jalview.bin.Cache.log.debug("Jalview Debugging Output Follows."); + jalview.bin.Cache.log.debug(ChannelProperties.getProperty("app_name") + + " Debugging Output Follows."); } catch (Exception ex) { System.err.println("Problems initializing the log4j system\n"); @@ -661,8 +663,8 @@ public class Cache new BuildDetails(codeVersion, null, codeInstallation); if (printVersion && reportVersion) { - System.out.println( - "Jalview Version: " + codeVersion + codeInstallation); + System.out.println(ChannelProperties.getProperty("app_name") + + " Version: " + codeVersion + codeInstallation); } } @@ -829,7 +831,8 @@ public class Cache lvclient.addAppender(log.getAppender("JalviewLogger")); // Tell the user that debug is enabled - lvclient.debug("Jalview Vamsas Client Debugging Output Follows."); + lvclient.debug(ChannelProperties.getProperty("app_name") + + " Vamsas Client Debugging Output Follows."); } } catch (Exception e) { @@ -868,7 +871,8 @@ public class Cache lgclient.addAppender(log.getAppender("JalviewLogger")); // Tell the user that debug is enabled - lgclient.debug("Jalview Groovy Client Debugging Output Follows."); + lgclient.debug(ChannelProperties.getProperty("app_name") + + " Groovy Client Debugging Output Follows."); } } catch (Error e) { @@ -930,7 +934,7 @@ public class Cache .getConstructor(new Class[] { String.class, String.class, String.class }) .newInstance(new Object[] - { "Jalview Desktop", + { ChannelProperties.getProperty("app_name") + " Desktop", (vrs = jalview.bin.Cache.getProperty("VERSION") + "_" + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")), @@ -1206,10 +1210,12 @@ public class Cache public static String getVersionDetailsForConsole() { StringBuilder sb = new StringBuilder(); - sb.append("Jalview Version: "); + sb.append(ChannelProperties.getProperty("app_name")) + .append(" Version: "); sb.append(jalview.bin.Cache.getDefault("VERSION", "TEST")); sb.append("\n"); - sb.append("Jalview Installation: "); + sb.append(ChannelProperties.getProperty("app_name")) + .append(" Installation: "); sb.append(jalview.bin.Cache.getDefault("INSTALLATION", "unknown")); sb.append("\n"); sb.append("Build Date: "); @@ -1405,79 +1411,92 @@ public class Cache Arrays.fill(displayHttpPw, '*'); Cache.debug("CACHE Proxy: setting new Authenticator with httpUser='" + httpUser + "' httpPassword='" + displayHttpPw + "'"); - Authenticator.setDefault(new Authenticator() + if (!Platform.isJS()) + /* * + * java.net.Authenticator not implemented in SwingJS yet + * + * @j2sIgnore + * + */ { - @Override - protected PasswordAuthentication getPasswordAuthentication() + Authenticator.setDefault(new Authenticator() { - if (getRequestorType() == RequestorType.PROXY) + @Override + protected PasswordAuthentication getPasswordAuthentication() { - String protocol = getRequestingProtocol(); - boolean needProxyPasswordSet = false; - if (customProxySet && - // we have a username but no password for the scheme being - // requested - (protocol.equalsIgnoreCase("http") - && (httpUser != null && httpUser.length() > 0 - && (httpPassword == null - || httpPassword.length == 0))) - || (protocol.equalsIgnoreCase("https") - && (httpsUser != null - && httpsUser.length() > 0 - && (httpsPassword == null - || httpsPassword.length == 0)))) - { - // open Preferences -> Connections - String message = MessageManager - .getString("label.proxy_password_required"); - Preferences.openPreferences(Preferences.CONNECTIONS_TAB, - message); - Preferences.getInstance().proxyAuthPasswordCheckHighlight(true); - } - else + if (getRequestorType() == RequestorType.PROXY) { - try + String protocol = getRequestingProtocol(); + boolean needProxyPasswordSet = false; + if (customProxySet && + // we have a username but no password for the scheme being + // requested + (protocol.equalsIgnoreCase("http") + && (httpUser != null && httpUser.length() > 0 + && (httpPassword == null + || httpPassword.length == 0))) + || (protocol.equalsIgnoreCase("https") + && (httpsUser != null + && httpsUser.length() > 0 + && (httpsPassword == null + || httpsPassword.length == 0)))) { - if (protocol.equalsIgnoreCase("http") - && getRequestingHost().equalsIgnoreCase(httpHost) - && getRequestingPort() == Integer - .valueOf(httpPort)) + // open Preferences -> Connections + String message = MessageManager + .getString("label.proxy_password_required"); + Preferences.openPreferences(Preferences.CONNECTIONS_TAB, + message); + Preferences.getInstance() + .proxyAuthPasswordCheckHighlight(true, true); + } + else + { + try { - Cache.debug( - "AUTHENTICATOR returning PasswordAuthentication(\"" - + httpUser + "\", '" - + new String(displayHttpPw) + "')"); - return new PasswordAuthentication(httpUser, - httpPassword); - } - if (protocol.equalsIgnoreCase("https") - && getRequestingHost().equalsIgnoreCase(httpsHost) - && getRequestingPort() == Integer - .valueOf(httpsPort)) + if (protocol.equalsIgnoreCase("http") + && getRequestingHost() + .equalsIgnoreCase(httpHost) + && getRequestingPort() == Integer + .valueOf(httpPort)) + { + Cache.debug( + "AUTHENTICATOR returning PasswordAuthentication(\"" + + httpUser + "\", '" + + new String(displayHttpPw) + "')"); + return new PasswordAuthentication(httpUser, + httpPassword); + } + if (protocol.equalsIgnoreCase("https") + && getRequestingHost() + .equalsIgnoreCase(httpsHost) + && getRequestingPort() == Integer + .valueOf(httpsPort)) + { + char[] displayHttpsPw = new char[httpPassword.length]; + Arrays.fill(displayHttpsPw, '*'); + Cache.debug( + "AUTHENTICATOR returning PasswordAuthentication(\"" + + httpsUser + "\", '" + displayHttpsPw + + "'"); + return new PasswordAuthentication(httpsUser, + httpsPassword); + } + } catch (NumberFormatException e) { - char[] displayHttpsPw = new char[httpPassword.length]; - Arrays.fill(displayHttpsPw, '*'); - Cache.debug( - "AUTHENTICATOR returning PasswordAuthentication(\"" - + httpsUser + "\", '" + displayHttpsPw - + "'"); - return new PasswordAuthentication(httpsUser, - httpsPassword); + Cache.error("Problem with proxy port values [http:" + + httpPort + ", https:" + httpsPort + "]"); } - } catch (NumberFormatException e) - { - Cache.error("Problem with proxy port values [http:" - + httpPort + ", https:" + httpsPort + "]"); + Cache.debug( + "AUTHENTICATOR after trying to get PasswordAuthentication"); } - Cache.debug( - "AUTHENTICATOR after trying to get PasswordAuthentication"); } + // non proxy request + Cache.debug("AUTHENTICATOR returning null"); + return null; } - // non proxy request - Cache.debug("AUTHENTICATOR returning null"); - return null; - } - }); + }); + } // end of j2sIgnore for java.net.Authenticator + // required to re-enable basic authentication (should be okay for a // local proxy) Cache.debug( @@ -1496,8 +1515,17 @@ public class Cache /* as noted above, due to bug in java this doesn't work if the sun.net.www.protocol.http.AuthCache * has working credentials. No workaround for Java 11. */ - Cache.debug("AUTHENTICATOR setting default Authenticator to null"); - Authenticator.setDefault(null); + if (!Platform.isJS()) + /* * + * java.net.Authenticator not implemented in SwingJS yet + * + * @j2sIgnore + * + */ + { + Cache.debug("AUTHENTICATOR setting default Authenticator to null"); + Authenticator.setDefault(null); + } } // nonProxyHosts not currently configurable in Preferences