RFR: 8290775: Some doc errors in DerOutputStream.java

Xue-Lei Andrew Fan xuelei at openjdk.org
Thu Jul 21 21:56:04 UTC 2022


On Thu, 21 Jul 2022 08:53:31 GMT, jquanC <duke at openjdk.org> wrote:

> 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.

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

src/java.base/share/classes/sun/security/util/DerOutputStream.java line 178:

> 176:      * Marshals a DER integer on the output stream.
> 177:      *
> 178:      * @param buf buffered data, which must be DER-encoded

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.

src/java.base/share/classes/sun/security/util/DerOutputStream.java line 464:

> 462:      * @param stringTag one of the DER string tags that indicate which
> 463:      * encoding should be used to write the string out.
> 464:      * @param charset the specified character set encodes a string into a

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

-------------

Changes requested by xuelei (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9585



More information about the security-dev mailing list