Normand Briere
2019-09-18 f9325048496d7cdbcad233f8a6b84c88e79adcc2
Grafreed.java
....@@ -13,6 +13,17 @@
1313
1414 import javax.sound.sampled.*;
1515
16
+import javax.net.ssl.HostnameVerifier;
17
+import javax.net.ssl.HttpsURLConnection;
18
+import javax.net.ssl.SSLContext;
19
+import javax.net.ssl.SSLSession;
20
+import javax.net.ssl.TrustManager;
21
+import javax.net.ssl.X509TrustManager;
22
+
23
+import java.security.cert.X509Certificate;
24
+import java.net.Authenticator;
25
+import java.net.PasswordAuthentication;
26
+
1627 //import com.jamonapi.*;
1728 public class Grafreed extends Applet implements ActionListener
1829 {
....@@ -677,10 +688,14 @@
677688
678689 public static void main(String argv[])
679690 {
680
- String osArch = System.getProperty("os.arch");
691
+ String osArch = System.getProperty("os.arch");
681692 if (Globals.DEBUG)
682693 System.out.println("os.arch = " + osArch);
683694
695
+ String osName = System.getProperty("os.name");
696
+
697
+ isWindows = !osName.equals("Mac OS X");
698
+
684699 if (argv.length == 0)
685700 {
686701 String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
....@@ -706,7 +721,6 @@
706721 // -Djava.library.path=/Users/nbriere/Projects/shared/lib
707722 if (jarfile.charAt(2) == ':')
708723 {
709
- isWindows = true;
710724 command = "\"" + javaPath + "\" -Xmx1024m -Djava.library.path=" + jarpath;
711725 // On Windows systems, the path is /C:/
712726 jarfile = jarfile.substring(1, jarfile.length());
....@@ -1014,6 +1028,50 @@
10141028 }
10151029 }
10161030 /**/
1031
+
1032
+ // Create a trust manager that does not validate certificate chains
1033
+ final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
1034
+ @Override
1035
+ public void checkClientTrusted(final X509Certificate[] chain, final String authType) {
1036
+ }
1037
+
1038
+ @Override
1039
+ public void checkServerTrusted(final X509Certificate[] chain, final String authType) {
1040
+ }
1041
+
1042
+ @Override
1043
+ public X509Certificate[] getAcceptedIssuers() {
1044
+ return null;
1045
+ }
1046
+ } };
1047
+
1048
+ try
1049
+ {
1050
+ // Install the all-trusting trust manager
1051
+ final SSLContext sslContext = SSLContext.getInstance("SSL");
1052
+ sslContext.init(null, trustAllCerts, null);
1053
+ // Create an ssl socket factory with our all-trusting manager
1054
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
1055
+ HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
1056
+ public boolean verify(String urlHostName, SSLSession session) {
1057
+ return true;
1058
+ }
1059
+ });
1060
+ // be authentic
1061
+ Authenticator.setDefault(new Authenticator() {
1062
+ @Override
1063
+ protected PasswordAuthentication getPasswordAuthentication() {
1064
+ return new PasswordAuthentication("args[0]", "args[1]".toCharArray());
1065
+ }
1066
+ });
1067
+ }
1068
+ catch (Exception e)
1069
+ {
1070
+ e.printStackTrace();
1071
+ }
1072
+
1073
+
1074
+ /////////////
10171075
10181076 // javax.swing.ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
10191077
....@@ -1033,7 +1091,6 @@
10331091 grafreed.universe.root = true;
10341092 grafreed.universe.openEditWindow(null, true); //, true);
10351093 grafreed.universe.editWindow.New();
1036
- grafreed.universe.editWindow.DuplicateVersion();
10371094
10381095 //mon.stop();
10391096 //System.out.println(mon);