import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;
+import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.resources.ResourcesPlugin;
Bundle bundle = FrameworkUtil.getBundle(PreferencesManager.class);
if (bundle != null) {
proxyTracker = new ServiceTracker<IProxyService, IProxyService>(
- bundle.getBundleContext(),
- IProxyService.class.getName(), null);
+ bundle.getBundleContext(), IProxyService.class.getName(), null);
}
if (proxyTracker == null) {
return null;
String name = loadSiteConfigName().get(idx);
String path = loadGitListLocation().get(idx);
+ /*
+ * Disable SSL cert validation because of following exception:
+ * com.sun.jersey.api.client.ClientHandlerException:
+ * javax.net.ssl.SSLHandshakeException:
+ * sun.security.validator.ValidatorException:
+ * PKIX path building failed:
+ * sun.security.provider.certpath.SunCertPathBuilderException:
+ * unable to find valid certification path to requested target
+ * This solution is temporary and can be changed.
+ */
+ // Create a trust manager that does not validate certificate chains
+ TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ }
+
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ }
+ } };
+
+ // Install the all-trusting trust manager
+ try {
+ SSLContext sc = SSLContext.getInstance("TLS");
+ sc.init(null, trustAllCerts, new SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+ } catch (Exception e) {
+ ;
+ }
+
Writer out = null;
try {
URL u = new URL(path);