Skip to content

Commit

Permalink
[JENKINS-31256] - minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Jun 9, 2016
1 parent 7e92679 commit 806f670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/hudson/remoting/Engine.java
Expand Up @@ -214,7 +214,7 @@ public void run() {
Throwable firstError=null;
String host=null;
String port=null;
SSLSocketFactory sslSocketFactory = getSSLSocketFactory();
final SSLSocketFactory sslSocketFactory = getSSLSocketFactory();

for (URL url : candidateUrls) {
String s = url.toExternalForm();
Expand Down Expand Up @@ -554,6 +554,7 @@ public FileInputStream run() throws Exception {
});
}

@CheckForNull
private SSLSocketFactory getSSLSocketFactory()
throws PrivilegedActionException, KeyStoreException, NoSuchProviderException, CertificateException,
NoSuchAlgorithmException, IOException, KeyManagementException {
Expand All @@ -578,6 +579,7 @@ private SSLSocketFactory getSSLSocketFactory()
}
return sslSocketFactory;
}

//a read() call on the SocketInputStream associated with underlying Socket will block for only this amount of time
static final int SOCKET_TIMEOUT = Integer.getInteger(Engine.class.getName()+".socketTimeout",30*60*1000);
/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/hudson/remoting/Util.java
Expand Up @@ -17,6 +17,7 @@
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
import java.util.Iterator;
import javax.annotation.CheckForNull;

/**
* Misc. I/O utilities
Expand Down Expand Up @@ -163,7 +164,8 @@ static boolean inNoProxyEnvVar(String host) {
* If http_proxy environment variable exists, the connection uses the proxy.
* Credentials can be passed e.g. to support running Jenkins behind a (reverse) proxy requiring authorization
*/
static URLConnection openURLConnection(URL url, String credentials, String proxyCredentials, SSLSocketFactory sslSocketFactory) throws IOException {
static URLConnection openURLConnection(URL url, String credentials, String proxyCredentials,
@CheckForNull SSLSocketFactory sslSocketFactory) throws IOException {
String httpProxy = null;
// If http.proxyHost property exists, openConnection() uses it.
if (System.getProperty("http.proxyHost") == null) {
Expand Down

0 comments on commit 806f670

Please sign in to comment.