Skip to content

Commit

Permalink
Merge pull request apache#2618 from jinmeiliao/java11
Browse files Browse the repository at this point in the history
GEODE-5880: fix IDEA compiling error when using jdk11
  • Loading branch information
dickcav authored Oct 16, 2018
2 parents c6e1d8c + e0b1437 commit 3d9b357
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
5 changes: 3 additions & 2 deletions geode-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

import java.nio.file.Paths
import java.nio.file.Path

import java.nio.file.Paths

evaluationDependsOn(":geode-core")

Expand Down Expand Up @@ -141,6 +141,7 @@ dependencies {
integrationTestCompile project(":geode-pulse")
integrationTestCompile project(':geode-assembly:geode-assembly-test')
integrationTestCompile 'org.apache.httpcomponents:httpclient:' + project.'httpclient.version'
integrationTestCompile 'javax.annotation:javax.annotation-api:' + project.'javax-annotation.version'


distributedTestCompile project(':geode-core')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public int size() {

@Override
public Object[] toArray() {
return toArray(null);
return toArray((Object[]) null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6077,7 +6077,7 @@ public int size() {

@Override
public Object[] toArray() {
return toArray(null);
return toArray((Object[]) null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.nio.channels.ServerSocketChannel;
import java.security.GeneralSecurityException;
Expand Down Expand Up @@ -66,6 +67,7 @@
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLProtocolException;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
Expand Down Expand Up @@ -988,9 +990,23 @@ public void handshakeIfSocketIsSSL(Socket socket, int timeout) throws IOExceptio
ex);
throw ex;
}
// else ignore
}
// Pre jkd11, startHandshake is throwing SocketTimeoutException.
// in jdk 11 it is throwing SSLProtocolException with a cause of SocketTimeoutException.
// this is to keep the exception consistent across jdk
catch (SSLProtocolException ex) {
if (ex.getCause() instanceof SocketTimeoutException) {
throw (SocketTimeoutException) ex.getCause();
} else {
throw ex;
}
} finally {
socket.setSoTimeout(oldTimeout);
try {
socket.setSoTimeout(oldTimeout);
}
// ignore
catch (SocketException e) {
}
}
}
}
Expand Down Expand Up @@ -1064,6 +1080,16 @@ private void configureClientSSLSocket(Socket socket, int timeout) throws IOExcep
logger.debug("SSL Connection from peer []",
((X509Certificate) peer[0]).getSubjectDN());
}
}
// Pre jkd11, startHandshake is throwing SocketTimeoutException.
// in jdk 11 it is throwing SSLProtocolException with a cause of SocketTimeoutException.
// this is to keep the exception consistent across jdk
catch (SSLProtocolException ex) {
if (ex.getCause() instanceof SocketTimeoutException) {
throw (SocketTimeoutException) ex.getCause();
} else {
throw ex;
}
} catch (SSLHandshakeException ex) {
logger
.fatal(String.format("SSL Error in connecting to peer %s[%s].",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public Result createRegion(
if (!specifiedGatewaySenders.isEmpty()) {
return ResultBuilder.createUserErrorResult(CliStrings.format(
CliStrings.CREATE_REGION__MSG__SPECIFY_VALID_GATEWAYSENDER_ID_UNKNOWN_0,
gatewaySenderIds));
(String[]) gatewaySenderIds));
}
}
}
Expand Down Expand Up @@ -429,7 +429,8 @@ public Result createRegion(
return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
} else {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.CREATE_REGION__MSG__GROUPS_0_ARE_INVALID, groups));
CliStrings.format(CliStrings.CREATE_REGION__MSG__GROUPS_0_ARE_INVALID,
(String[]) groups));
}
}

Expand Down

0 comments on commit 3d9b357

Please sign in to comment.