89 if (theFactory != null) {
90 return theFactory;
91 }
92
93 if (propertyChecked == false) {
94 propertyChecked = true;
95 String clsName = getSecurityProperty("ssl.SocketFactory.provider");
96 if (clsName != null) {
97 log("setting up default SSLSocketFactory");
98 try {
99 Class<?> cls = null;
100 try {
101 cls = Class.forName(clsName);
102 } catch (ClassNotFoundException e) {
103 ClassLoader cl = ClassLoader.getSystemClassLoader();
104 if (cl != null) {
105 cls = cl.loadClass(clsName);
106 }
107 }
108 log("class " + clsName + " is loaded");
109 SSLSocketFactory fac = (SSLSocketFactory)cls.newInstance();
110 log("instantiated an instance of class " + clsName);
111 theFactory = fac;
112 return fac;
113 } catch (Exception e) {
114 log("SSLSocketFactory instantiation failed: " + e.toString());
115 theFactory = new DefaultSSLSocketFactory(e);
116 return theFactory;
117 }
118 }
119 }
120
121 try {
122 return SSLContext.getDefault().getSocketFactory();
123 } catch (NoSuchAlgorithmException e) {
124 return new DefaultSSLSocketFactory(e);
125 }
126 }
127
128 static String getSecurityProperty(final String name) {
|
89 if (theFactory != null) {
90 return theFactory;
91 }
92
93 if (propertyChecked == false) {
94 propertyChecked = true;
95 String clsName = getSecurityProperty("ssl.SocketFactory.provider");
96 if (clsName != null) {
97 log("setting up default SSLSocketFactory");
98 try {
99 Class<?> cls = null;
100 try {
101 cls = Class.forName(clsName);
102 } catch (ClassNotFoundException e) {
103 ClassLoader cl = ClassLoader.getSystemClassLoader();
104 if (cl != null) {
105 cls = cl.loadClass(clsName);
106 }
107 }
108 log("class " + clsName + " is loaded");
109 @SuppressWarnings("deprecation")
110 SSLSocketFactory fac = (SSLSocketFactory)cls.newInstance();
111 log("instantiated an instance of class " + clsName);
112 theFactory = fac;
113 return fac;
114 } catch (Exception e) {
115 log("SSLSocketFactory instantiation failed: " + e.toString());
116 theFactory = new DefaultSSLSocketFactory(e);
117 return theFactory;
118 }
119 }
120 }
121
122 try {
123 return SSLContext.getDefault().getSocketFactory();
124 } catch (NoSuchAlgorithmException e) {
125 return new DefaultSSLSocketFactory(e);
126 }
127 }
128
129 static String getSecurityProperty(final String name) {
|