X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FPlatform.java;h=fdddd321482de30719f1eba8be0ad79261b1e92a;hb=3e912e689b988d1c8fe85f87a9374d7f7a40dbae;hp=daaed77d8bb0dc85addfe865fc13986039757f1d;hpb=5420b4add405969ebdff3959c203803783e21239;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index daaed77..fdddd32 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.net.MalformedURLException; import java.net.URL; import java.util.Properties; @@ -38,6 +39,7 @@ import javax.swing.SwingUtilities; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; +import jalview.bin.Console; import jalview.javascript.json.JSON; /** @@ -309,7 +311,7 @@ public class Platform time = mark = t; if (msg != null) { - jalview.bin.Console.errPrintln("Platform: timer reset\t\t\t" + msg); + Console.errPrintln("Platform: timer reset\t\t\t" + msg); } break; case TIME_MARK: @@ -325,9 +327,8 @@ public class Platform } if (msg != null) { - jalview.bin.Console.errPrintln( - "Platform: timer mark\t" + ((t - time) / 1000f) + "\t" - + ((t - mark) / 1000f) + "\t" + msg); + Console.errPrintln("Platform: timer mark\t" + ((t - time) / 1000f) + + "\t" + ((t - mark) / 1000f) + "\t" + msg); } mark = t; } @@ -338,9 +339,8 @@ public class Platform case TIME_GET: if (msg != null) { - jalview.bin.Console - .errPrintln("Platform: timer dur\t" + ((t - time) / 1000f) - + "\t" + ((duration) / 1000f) + "\t" + msg); + Console.errPrintln("Platform: timer dur\t" + ((t - time) / 1000f) + + "\t" + ((duration) / 1000f) + "\t" + msg); } set = 0; break; @@ -496,7 +496,7 @@ public class Platform * info[key]; */ - jalview.bin.Console.outPrintln( + Console.outPrintln( "Platform id=" + id + " reading Info." + key + " = " + value); p.put(id + "_" + key, value); @@ -617,18 +617,31 @@ public class Platform * @author hansonr@stolaf.edu * */ - public static void addJ2SDirectDatabaseCall(String domain) + public static void addJ2SDirectDatabaseCall(String urlString) { if (isJS()) { - jalview.bin.Console.outPrintln( + String domainString = urlString; + try + { + URL url = new URL(urlString); + URL domain = new URL(url.getProtocol(), url.getHost(), + url.getPort(), ""); + domainString = domain.toString(); + } catch (MalformedURLException e) + { + Console.warn("Could not add '" + urlString + + "' in J2SDirectDatabase -- not a recognised URL"); + } + Console.outPrintln( "Platform adding known access-control-allow-origin * for domain " - + domain);/** - * @j2sNative - * - * J2S.addDirectDatabaseCall(domain); - */ + + domainString); + /** + * @j2sNative + * + * J2S.addDirectDatabaseCall(domain); + */ } }