Skip to content
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

8290775: Some doc errors in DerOutputStream.java #9585

Closed
wants to merge 5 commits into from

Conversation

jquanC
Copy link
Contributor

@jquanC jquanC commented Jul 21, 2022

There are some doc errors in sun.security.util.DerOutputStream, like the followings,

/**
 * Private helper routine for writing DER encoded string values.
 * @param s the string to write
 * @param stringTag one of the DER string tags that indicate which
 * encoding should be used to write the string out.
 * @param enc the name of the encoder that should be used corresponding
 * to the above tag.
 */
private void writeString(String s, byte stringTag, Charset charset) throws IOException

The parameter is charset, but not enc.

/**
 * Marshals a DER integer on the output stream.
 *
 * @param i the integer in bytes, equivalent to BigInteger::toByteArray.
 */
public void putInteger(byte[] buf) throws IOException {

The parameter is buf, but not i.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9585/head:pull/9585
$ git checkout pull/9585

Update a local copy of the PR:
$ git checkout pull/9585
$ git pull https://git.openjdk.org/jdk pull/9585/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9585

View PR using the GUI difftool:
$ git pr show -t 9585

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9585.diff

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Jul 21, 2022
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 21, 2022

Hi @jquanC, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user jquanC" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Jul 21, 2022

⚠️ @jquanC a branch with the same name as the source branch for this pull request (master) is present in the target repository. If you eventually integrate this pull request then the branch master in your personal fork will diverge once you sync your personal fork with the upstream repository.

To avoid this situation, create a new branch for your changes and reset the master branch. You can do this by running the following commands in a local repository for your personal fork. Note: you do not have to name the new branch NEW-BRANCH-NAME.

$ git checkout -b NEW-BRANCH-NAME
$ git branch -f master 3582fd9e93d9733c6fdf1f3848e0a093d44f6865
$ git push -f origin master

Then proceed to create a new pull request with NEW-BRANCH-NAME as the source branch and close this one.

@openjdk
Copy link

openjdk bot commented Jul 21, 2022

@jquanC The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label Jul 21, 2022
@bridgekeeper bridgekeeper bot removed the oca Needs verification of OCA signatory status label Jul 21, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 21, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 21, 2022

Webrevs

Copy link
Member

@XueleiFan XueleiFan left a comment

Choose a reason for hiding this comment

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

Thanks for the update. However, I have concerns about the update of parameter descriptions.

@@ -175,7 +175,7 @@ public void putInteger(BigInteger i) throws IOException {
/**
* Marshals a DER integer on the output stream.
*
* @param i the integer in bytes, equivalent to BigInteger::toByteArray.
* @param buf buffered data, which must be DER-encoded
Copy link
Member

Choose a reason for hiding this comment

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

The information of the parameter, "the integer in bytes, equivalent to BigInteger::toByteArray", may be not necessary to be updated, which is right I think.

@@ -461,8 +461,8 @@ public void putGeneralString(String s) throws IOException {
* @param s the string to write
* @param stringTag one of the DER string tags that indicate which
* encoding should be used to write the string out.
* @param enc the name of the encoder that should be used corresponding
* to the above tag.
* @param charset the specified character set encodes a string into a
Copy link
Member

Choose a reason for hiding this comment

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

I think it may be not necessary to update the parameter description.

@jquanC
Copy link
Contributor Author

jquanC commented Jul 22, 2022 via email

@XueleiFan
Copy link
Member

XueleiFan commented Jul 22, 2022

On the second point, I have some doubts. 1) Here don't need to add @.*** charset" because it's clear to everyone? @.*** enc" does not seem to be used in the method. Shouldn't it be deleted?

Sorry for the confusing.

I think it is fine to update the "param enc" to "param charset", but it may be not necessary to update the parameter description. With "parameter description", I refer to this part, "the name of the encoder that should be used corresponding to the above tag".

The parameter description may be still confusing to someone, as the 'the name of the encoder' is not well-defined here. Maybe, it could be simplified as "the charset that ..."

Here is the proposed update:

-     * @param enc the name of the encoder that should be used corresponding
-    * to the above tag.
+    * @param charset the specified character set encodes a string into a
+    * sequence of bytes using

I may use an update like :

-     * @param enc the name of the encoder that should be used corresponding
-    * to the above tag.
+    * @param charset the charset that is should used corresponding to the
+    * above tag.

@wangweij
Copy link
Contributor

s/is should used/should be used/.

@jquanC
Copy link
Contributor Author

jquanC commented Jul 22, 2022

s/is should used/should be used/.

Thanks for your advice!
Yes, the passive voice should be used.
I may offer an update like:

@param charset the charset should be used corresponding to the above tag.

@@ -461,8 +461,8 @@ public void putGeneralString(String s) throws IOException {
* @param s the string to write
* @param stringTag one of the DER string tags that indicate which
* encoding should be used to write the string out.
* @param enc the name of the encoder that should be used corresponding
* to the above tag.
* @param charset the charset should be used corresponding to the
Copy link
Member

Choose a reason for hiding this comment

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

I may suggest to add 'that' back. Without it, the meaning of the sentence may be different.

... the charset should be used corresponding to the above tag.
vs
... the charset **that** should be used corresponding to the above tag.

Copy link
Contributor Author

@jquanC jquanC Jul 22, 2022

Choose a reason for hiding this comment

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

Thanks again for all the above suggestions sincerely!
To avoid adding your troubles, I should end up using the following expression:

the charset that should be used corresponding to the above tag.

I'm trying to understand the difference between the two.
The first sentence may be understood as "the process of using charset" according to the above tag.
The second sentence(use that) can better express "the choice of charset" needs to be based on the above tag.
Is this correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

A spec for an argument should be a noun. You can add attributes to describe it in more detail, which can be an adjective, or even a clause. This is what's shown in the 2nd line (I cannot call it a sentence because it's just a noun with an attributive clause). On the other hand, the 1st is a full sentence and it's not what we need here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A spec for an argument should be a noun. You can add attributes to describe it in more detail, which can be an adjective, or even a clause. This is what's shown in the 2nd line (I cannot call it a sentence because it's just a noun with an attributive clause). On the other hand, the 1st is a full sentence and it's not what we need here.

Thanks so much for your detailed explanation.
I get it now.

@wangweij
Copy link
Contributor

wangweij commented Jul 22, 2022

Two comments:

  1. You reverted the s/i/buf/ change in putInteger.
  2. The other constructor also uses an DER output steam. Since you already fixed one, please take care of this one as well.

@jquanC
Copy link
Contributor Author

jquanC commented Jul 23, 2022

Two comments:

  1. You reverted the s/i/buf/ change in putInteger.
  2. The other constructor also uses an DER output steam. Since you already fixed one, please take care of this one as well.

Got it.
For the first, "the integer in bytes, equivalent to BigInteger::toByteArray", I adopted another reviewer's advice and I reverted it. But I may have misunderstood what he meant. The correct update should look like this:

@param buf the integer in bytes, equivalent to BigInteger::toByteArray.

For the second, I will take care of that.
Thanks again! I will offer an update later.

…cation and improve an expression according to the specification
Copy link
Member

@XueleiFan XueleiFan left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@openjdk
Copy link

openjdk bot commented Jul 23, 2022

@jquanC This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8290775: Some doc errors in DerOutputStream.java

Reviewed-by: xuelei

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 257 new commits pushed to the master branch:

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@XueleiFan) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 23, 2022
@jquanC
Copy link
Contributor Author

jquanC commented Jul 23, 2022

Looks good to me. Thanks!

Cheers and appreciation! And I have learned more from your guidance.

@wangweij
Copy link
Contributor

@jquanC Please type/integrate if you want to get the fix included in OpenJDK.

@jquanC
Copy link
Contributor Author

jquanC commented Aug 16, 2022

/integrate

@jquanC
Copy link
Contributor Author

jquanC commented Aug 16, 2022

@jquanC Please type/integrate if you want to get the fix included in OpenJDK.

Thanks for your reminder!
I just marked it, please check if it is correct.

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 16, 2022
@openjdk
Copy link

openjdk bot commented Aug 16, 2022

@jquanC
Your change (at version 14b2802) is now ready to be sponsored by a Committer.

@wangweij
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 16, 2022

Going to push as commit 3e12241.
Since your change was applied there have been 257 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 16, 2022
@openjdk openjdk bot closed this Aug 16, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 16, 2022
@openjdk
Copy link

openjdk bot commented Aug 16, 2022

@wangweij @jquanC Pushed as commit 3e12241.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@jquanC
Copy link
Contributor Author

jquanC commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
3 participants