Lines 14-19
Link Here
|
14 |
import java.io.FileNotFoundException; |
14 |
import java.io.FileNotFoundException; |
15 |
import java.io.IOException; |
15 |
import java.io.IOException; |
16 |
import java.io.InputStream; |
16 |
import java.io.InputStream; |
|
|
17 |
import java.lang.reflect.InvocationTargetException; |
18 |
import java.lang.reflect.Method; |
17 |
import java.net.JarURLConnection; |
19 |
import java.net.JarURLConnection; |
18 |
import java.net.MalformedURLException; |
20 |
import java.net.MalformedURLException; |
19 |
import java.net.ProtocolException; |
21 |
import java.net.ProtocolException; |
Lines 733-741
Link Here
|
733 |
try { |
735 |
try { |
734 |
URL docUrl = new URL(docUrlValue); |
736 |
URL docUrl = new URL(docUrlValue); |
735 |
URLConnection connection = docUrl.openConnection(); |
737 |
URLConnection connection = docUrl.openConnection(); |
736 |
String timeoutVal = "10000"; //$NON-NLS-1$ |
738 |
Class[] parameterTypes = new Class[]{int.class}; |
737 |
System.setProperty("sun.net.client.defaultConnectTimeout", timeoutVal); //$NON-NLS-1$ |
739 |
Integer timeoutVal = new Integer(10000); |
738 |
System.setProperty("sun.net.client.defaultReadTimeout", timeoutVal); //$NON-NLS-1$ |
740 |
// set the connect and read timeouts using reflection since these methods are not available in java 1.4 |
|
|
741 |
Class URLClass = connection.getClass(); |
742 |
try { |
743 |
Method connectTimeoutMethod = URLClass.getDeclaredMethod("setConnectTimeout", parameterTypes); //$NON-NLS-1$ |
744 |
Method readTimeoutMethod = URLClass.getDeclaredMethod("setReadTimeout", parameterTypes); //$NON-NLS-1$ |
745 |
connectTimeoutMethod.invoke(connection, new Object[]{timeoutVal}); |
746 |
readTimeoutMethod.invoke(connection, new Object[]{timeoutVal}); |
747 |
} catch (SecurityException e) { |
748 |
// ignore |
749 |
} catch (IllegalArgumentException e) { |
750 |
// ignore |
751 |
} catch (NoSuchMethodException e) { |
752 |
// ignore |
753 |
} catch (IllegalAccessException e) { |
754 |
// ignore |
755 |
} catch (InvocationTargetException e) { |
756 |
// ignore |
757 |
} |
758 |
|
739 |
if (connection instanceof JarURLConnection) { |
759 |
if (connection instanceof JarURLConnection) { |
740 |
connection2 = (JarURLConnection) connection; |
760 |
connection2 = (JarURLConnection) connection; |
741 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=156307 |
761 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=156307 |