Skip to content
Permalink
Browse files

Merge stable-2.x into master (#107)

* [maven-release-plugin] prepare release remoting-2.62

* [maven-release-plugin] prepare for next development iteration

* [FIXED JENKINS-37539] - Prevent NPE in Engine#connect() when host or port are null or empty (#101)

Bug diagnosis:
* https://scan8.coverity.com/reports.htm#v14462/p10499/fileInstanceId=12836372&defectInstanceId=4427367&mergedDefectId=152195
* https://scan8.coverity.com/reports.htm#v14462/p10499/fileInstanceId=12836372&defectInstanceId=4427365&mergedDefectId=152194

* [CID-152201] - Fix resource leak in remoting.jnlp.Main (#102)

* [CID-152200,CID-152202] - Resource leak in Cipher I/O streams on exceptional paths (#104)

* [CID-152200,CID-152202] - Resource leak in Cipher I/O streams on exceptional paths

* https://scan8.coverity.com/reports.htm#v14462/p10499/fileInstanceId=12836377&defectInstanceId=4427377&mergedDefectId=152202
* https://scan8.coverity.com/reports.htm#v14462/p10499/fileInstanceId=12836377&defectInstanceId=4427377&mergedDefectId=152200

* [CID-152202] - Fix typo noticed by @olivergondza

* Fix another merge conflict

* Remove EngineUtil#closeAndLogFailures()
  • Loading branch information
oleg-nenashev committed Sep 26, 2016
1 parent 89c0896 commit 190653b3a3e7a9b582cf923201c735d6d3043ea2
@@ -23,6 +23,7 @@
*/
package hudson.remoting;

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.remoting.Channel.Mode;
import java.io.File;
@@ -453,8 +454,10 @@ private void onConnectionRejected(String greeting) throws InterruptedException {

/**
* Connects to TCP slave host:port, with a few retries.
* @param endpoint Connection endpoint
* @throws IOException Connection failure or invalid parameter specification
*/
private Socket connect(JnlpAgentEndpoint endpoint) throws IOException, InterruptedException {
private Socket connect(@Nonnull JnlpAgentEndpoint endpoint) throws IOException, InterruptedException {

String msg = "Connecting to " + endpoint.getHost() + ':' + endpoint.getPort();
events.status(msg);
@@ -128,7 +128,7 @@ static String indent(String s) {
*
* Warning: this method won't match shortened representation of IPV6 address
*/
static boolean inNoProxyEnvVar(String host) {
static boolean inNoProxyEnvVar(@Nonnull String host) {
String noProxy = System.getenv("no_proxy");
if (noProxy != null) {
noProxy = noProxy.trim()
@@ -191,14 +191,18 @@ public Engine createEngine() {
if (file.isFile()
&& (length = file.length()) < 65536
&& length > "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----".length()) {
FileInputStream fis = null;
try {
// we do basic size validation, if there are x509 certificates that have a PEM encoding
// larger
// than 64kb we can revisit the upper bound.
cert = new byte[(int) length];
fis = new FileInputStream(file);
int read = fis.read(cert);
FileInputStream fis = new FileInputStream(file);
final int read;
try {
read = fis.read(cert);
} finally {
fis.close();
}
if (cert.length != read) {
LOGGER.log(Level.WARNING, "Only read {0} bytes from {1}, expected to read {2}",
new Object[]{read, file, cert.length});
@@ -208,8 +212,6 @@ public Engine createEngine() {
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Could not read certificate from " + file, e);
continue;
} finally {
IOUtils.closeQuietly(fis);
}
} else {
if (file.isFile()) {
@@ -24,9 +24,14 @@
package org.jenkinsci.remoting.engine;

import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Engine utility methods.
@@ -282,7 +282,8 @@ public void waitForReady() throws InterruptedException {

}

static InetSocketAddress getResolvedHttpProxyAddress(String host, int port) throws IOException {
@CheckForNull
static InetSocketAddress getResolvedHttpProxyAddress(@Nonnull String host, int port) throws IOException {
InetSocketAddress targetAddress = null;
Iterator<Proxy>
proxies =

1 comment on commit 190653b

@oleg-nenashev

This comment has been minimized.

Copy link
Member Author

@oleg-nenashev oleg-nenashev commented on 190653b Sep 28, 2016

Seems somethis has been messed up. It's not actually a merge commit

Please sign in to comment.