lukecwik commented on code in PR #24619:
URL: https://github.com/apache/beam/pull/24619#discussion_r1061891298
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/SdkHarnessEnvironmentTest.java:
##########
@@ -74,12 +78,24 @@ public void testJammAgentAvailable() throws Exception {
private static class TLSDoFn extends DoFn<String, String> {
@ProcessElement
public void processElement(ProcessContext c) {
- assertThat(
- Security.getProperty("jdk.tls.disabledAlgorithms").split(",[ ]*"),
- not(hasItemInArray("TLSv1")));
- assertThat(
- Security.getProperty("jdk.tls.disabledAlgorithms").split(",[ ]*"),
- not(hasItemInArray("TLSv1.1")));
+ String[] disabledAlgorithms =
+
Security.getProperty("jdk.tls.disabledAlgorithms").trim().split("\\s*,\\s*");
+ assertThat(disabledAlgorithms, not(hasItemInArray("TLSv1")));
+ assertThat(disabledAlgorithms, not(hasItemInArray("TLSv1.1")));
Review Comment:
check that they are in the legacy algorithms list so that we prefer newer
versions of TLS
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/SdkHarnessEnvironmentTest.java:
##########
@@ -74,12 +78,24 @@ public void testJammAgentAvailable() throws Exception {
private static class TLSDoFn extends DoFn<String, String> {
@ProcessElement
public void processElement(ProcessContext c) {
- assertThat(
- Security.getProperty("jdk.tls.disabledAlgorithms").split(",[ ]*"),
- not(hasItemInArray("TLSv1")));
- assertThat(
- Security.getProperty("jdk.tls.disabledAlgorithms").split(",[ ]*"),
- not(hasItemInArray("TLSv1.1")));
+ String[] disabledAlgorithms =
+
Security.getProperty("jdk.tls.disabledAlgorithms").trim().split("\\s*,\\s*");
+ assertThat(disabledAlgorithms, not(hasItemInArray("TLSv1")));
+ assertThat(disabledAlgorithms, not(hasItemInArray("TLSv1.1")));
+
+ SSLContext context = null;
+ String[] defaultProtocols = null;
+ try {
+ context = SSLContext.getInstance("TLS");
+ context.init(null, null, null);
+ defaultProtocols = context.getDefaultSSLParameters().getProtocols();
+ } catch (NoSuchAlgorithmException | KeyManagementException e) {
+ return;
+ }
Review Comment:
```suggestion
context = SSLContext.getInstance("TLS");
context.init(null, null, null);
defaultProtocols = context.getDefaultSSLParameters().getProtocols();
return;
```
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/SdkHarnessEnvironmentTest.java:
##########
@@ -74,12 +78,24 @@ public void testJammAgentAvailable() throws Exception {
private static class TLSDoFn extends DoFn<String, String> {
@ProcessElement
public void processElement(ProcessContext c) {
Review Comment:
```suggestion
public void processElement(ProcessContext c) throws Exception {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]