Skip to content

Commit

Permalink
8269933: test/jdk/javax/net/ssl/compatibility/JdkInfo incorrect verif…
Browse files Browse the repository at this point in the history
…ication of protocol and cipher support

Reviewed-by: xuelei, rhalade
  • Loading branch information
fguallini authored and rhalade committed Jul 21, 2021
1 parent 1eeb179 commit 6346793
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions test/jdk/javax/net/ssl/compatibility/JdkInfo.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -22,7 +22,9 @@
*/

import java.nio.file.Path;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/*
Expand All @@ -37,10 +39,10 @@ public class JdkInfo {
public final Path javaPath;

public final String version;
public final String supportedProtocols;
public final String enabledProtocols;
public final String supportedCipherSuites;
public final String enabledCipherSuites;
public final List<String> supportedProtocols;
public final List<String> enabledProtocols;
public final List<String> supportedCipherSuites;
public final List<String> enabledCipherSuites;
public final boolean supportsSNI;
public final boolean supportsALPN;

Expand All @@ -54,13 +56,26 @@ public JdkInfo(Path javaPath) {
}

String[] attributes = Utilities.split(output, Utilities.PARAM_DELIMITER);
version = attributes[0].replaceAll(".*=", "");
supportedProtocols = attributes[1].replaceAll(".*=", "");
enabledProtocols = attributes[2].replaceAll(".*=", "");
supportedCipherSuites = attributes[3].replaceAll(".*=", "");
enabledCipherSuites = attributes[4].replaceAll(".*=", "");
supportsSNI = Boolean.valueOf(attributes[5].replaceAll(".*=", ""));
supportsALPN = Boolean.valueOf(attributes[6].replaceAll(".*=", ""));
version = parseAttribute(attributes[0]);
supportedProtocols = parseListAttribute(attributes[1]);
enabledProtocols = parseListAttribute(attributes[2]);
supportedCipherSuites = parseListAttribute(attributes[3]);
enabledCipherSuites = parseListAttribute(attributes[4]);
supportsSNI = parseBooleanAttribute(attributes[5]);
supportsALPN = parseBooleanAttribute(attributes[6]);
}

private List<String> parseListAttribute(String attribute) {
attribute = parseAttribute(attribute);
return Arrays.asList(attribute.split(","));
}

private boolean parseBooleanAttribute(String attribute) {
attribute = parseAttribute(attribute);
return Boolean.parseBoolean(attribute);
}
private String parseAttribute(String attribute) {
return attribute.replaceAll(".*=", "");
}

// Determines the specific attributes for the specified JDK.
Expand Down

5 comments on commit 6346793

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 6346793 Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 6346793 Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-6346793c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 6346793c from the openjdk/jdk repository.

The commit being backported was authored by Fernando Guallini on 21 Jul 2021 and was reviewed by Xue-Lei Andrew Fan and Rajan Halade.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-6346793c:GoeLin-backport-6346793c
$ git checkout GoeLin-backport-6346793c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev GoeLin-backport-6346793c

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 6346793 Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 6346793 Mar 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-6346793c in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 6346793c from the openjdk/jdk repository.

The commit being backported was authored by Fernando Guallini on 21 Jul 2021 and was reviewed by Xue-Lei Andrew Fan and Rajan Halade.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev GoeLin-backport-6346793c:GoeLin-backport-6346793c
$ git checkout GoeLin-backport-6346793c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev GoeLin-backport-6346793c

Please sign in to comment.