View | Details | Raw Unified | Return to bug 136091 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/JavaElement.java (-3 / +16 lines)
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.Method;
17
import java.net.JarURLConnection;
18
import java.net.JarURLConnection;
18
import java.net.MalformedURLException;
19
import java.net.MalformedURLException;
19
import java.net.ProtocolException;
20
import java.net.ProtocolException;
Lines 733-741 Link Here
733
		try {
734
		try {
734
			URL docUrl = new URL(docUrlValue);
735
			URL docUrl = new URL(docUrlValue);
735
			URLConnection connection = docUrl.openConnection();
736
			URLConnection connection = docUrl.openConnection();
736
			String timeoutVal = "10000"; //$NON-NLS-1$
737
			Class[] parameterTypes = new Class[]{int.class};
737
			System.setProperty("sun.net.client.defaultConnectTimeout", timeoutVal);  //$NON-NLS-1$
738
			Integer timeoutVal = new Integer(10000);
738
			System.setProperty("sun.net.client.defaultReadTimeout", timeoutVal); //$NON-NLS-1$
739
			try {
740
				// set the connect and read timeouts using reflection since these methods are not available in java 1.4
741
				Class URLClass = Class.forName("java.net.URLConnection"); //$NON-NLS-1$
742
				Method connectTimeoutMethod = URLClass.getDeclaredMethod("setConnectTimeout", parameterTypes); //$NON-NLS-1$
743
				Method readTimeoutMethod = URLClass.getDeclaredMethod("setReadTimeout", parameterTypes); //$NON-NLS-1$
744
				connectTimeoutMethod.invoke(connection, new Object[]{timeoutVal});
745
				readTimeoutMethod.invoke(connection, new Object[]{timeoutVal});
746
			} catch (Exception e) {
747
				// setConnectTimeout() or setReadTimeout() not found. Set system wide timeout property
748
				System.setProperty("sun.net.client.defaultConnectTimeout", timeoutVal.toString());  //$NON-NLS-1$
749
				System.setProperty("sun.net.client.defaultReadTimeout", timeoutVal.toString()); //$NON-NLS-1$
750
			}
751
			
739
			if (connection instanceof JarURLConnection) {
752
			if (connection instanceof JarURLConnection) {
740
				connection2 = (JarURLConnection) connection;
753
				connection2 = (JarURLConnection) connection;
741
				// https://bugs.eclipse.org/bugs/show_bug.cgi?id=156307
754
				// https://bugs.eclipse.org/bugs/show_bug.cgi?id=156307

Return to bug 136091