New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8282723: Add constructors taking a cause to JSSE exceptions #7722
Conversation
/csr |
|
@XueleiFan an approved CSR request is already required for this pull request. |
@XueleiFan The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
LGTM. Someone from security-dev should probably review this too. |
@@ -48,8 +46,7 @@ | |||
* | |||
* @param reason describes the problem. | |||
*/ | |||
public SSLException(String reason) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for changing the style. I've always hated the extra vertical space. :)
Please consider adding simple tests to cover new APIs, similar to https://github.com/openjdk/jdk/pull/7705/files#diff-28e1041be519b6266b3b92aea29c5d8917c279880da7e5e9823a518196e96ea5 |
Update following for SSLPeerUnverifiedException - |
throw (SSLHandshakeException)(new SSLHandshakeException( | ||
"Could not generate secret").initCause(gse)); | ||
throw new SSLHandshakeException( | ||
"Could not generate secret", gse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't quite tell given the coloring, but did this get changed into a tab?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added 4 more whitespaces in line 158.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that. Good to be consistent.
throw (SSLHandshakeException) new SSLHandshakeException( | ||
"Could not generate ECPublicKey").initCause(e); | ||
throw new SSLHandshakeException( | ||
"Could not generate ECPublicKey", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think combining these lines would be < 80 chars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception name is too long to have in one line. There are 83 characters in total if combining line 203 and 204. 3 characters exceeding 80 chars per line limit is not easy to tell with eyes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 80 character recommendation isn't a hard limit, I favor readability in the 80-100 char range.
@@ -263,8 +263,7 @@ void setDeliverStream(OutputStream outputStream) { | |||
} catch (BadPaddingException bpe) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the copyright need to get updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I missed this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't see any unit tests for the new methods. Can approve after they are included.
|
Hm, I will check more usage out of the JSSE implementation code. Thank you! |
Thank you for the reference. I will add some test cases. |
ping ... |
@@ -484,7 +484,7 @@ SSLContext getSSLContext(String keyFilename, String trustFilename) | |||
*/ | |||
if ((local != null) && (remote != null)) { | |||
// If both failed, return the curthread's exception. | |||
local.initCause(remote); | |||
local.addSuppressed(remote); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2016->2022.
@@ -480,7 +480,7 @@ SSLContext getSSLContext(String keyFilename, String trustFilename) | |||
*/ | |||
if ((local != null) && (remote != null)) { | |||
// If both failed, return the curthread's exception. | |||
local.initCause(remote); | |||
local.addSuppressed(remote); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2016->2022.
@@ -0,0 +1,50 @@ | |||
/* | |||
* Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure about the third-party copyrights on these files. They are probably ok, but you should get approval by someone more familiar.
Secondly, in the Oracle environment, we generally use a trailing , comma after the date. e.g.
Copyright (C) 2022,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of the copyright is fine. No need to enforce Oracle date formatting.
import javax.net.ssl.SSLHandshakeException; | ||
import java.util.Objects; | ||
|
||
public class CheckSSLHandshakeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal preference would have been to combine all of these into a single testfile to minimize clutter in the logs and directories, but no strong objection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. I would like to have them in separated test cases so that it is easier to monitor the regressions in the future.
@@ -349,13 +349,13 @@ private void runTest(boolean direct) throws Exception { | |||
} finally { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright update
@@ -544,7 +544,7 @@ private void bootup() throws Exception { | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see latest comments and let's verify the copyright is correct, but otherwise looks good.
@XueleiFan This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 122 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
@@ -0,0 +1,50 @@ | |||
/* | |||
* Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of the copyright is fine. No need to enforce Oracle date formatting.
Thanks, @irisclark! |
/integrate |
Going to push as commit 4df6742.
Your commit was automatically rebased without conflicts. |
@XueleiFan Pushed as commit 4df6742. |
Please review this small API enhancement to add the usual constructors taking a cause to javax.net.ssl exceptions. The use of initCause in the JSSE implementation code is updated to use the new constructors accordingly.
Please review the CSR: https://bugs.openjdk.java.net/browse/JDK-8282724
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7722/head:pull/7722
$ git checkout pull/7722
Update a local copy of the PR:
$ git checkout pull/7722
$ git pull https://git.openjdk.java.net/jdk pull/7722/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7722
View PR using the GUI difftool:
$ git pr show -t 7722
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7722.diff