Integrated: 8297065: DerOutputStream operations should not throw IOExceptions

Weijun Wang weijun at openjdk.org
Tue Nov 29 13:00:40 UTC 2022


On Tue, 22 Nov 2022 22:29:24 GMT, Weijun Wang <weijun at openjdk.org> wrote:

> This is mostly cleanup. Everything around `DerOutputStream` no longer throws an `IOException`. This includes:
> 
> - Remove unnecessary `throws IOException` in code and spec
> - Remove `catch (IOException ioe)` blocks. If new exception is thrown, remove further `throws` in code and spec
> - More classes implementing `DerEncoder` if they have a `encode(DerOutputStream)` method
> - Modify `write(bytes)` to `writeBytes(bytes)` to avoid IOE
> - Some unused methods removed
> - `DerOutputStream` is final
> 
> The only actual changes (still trivial) are:
> - Since `PKCS7::encodeSignedData(OutputStream out)` is removed, its usages in `PKCS7::constructToken` and `TsaSigner::createResponse` (in test) are modified to use another method with a `DerOutputStream` argument.
> - In PKCS8Key, since `getEncodedInternal` never returns non-null, remove null check on result
> - Since `DerOutputStream` is final, no need to clone bytes in `encode` of `X509CertImpl` and `X509CRLImpl`.

This pull request has now been integrated.

Changeset: 2deb318c
Author:    Weijun Wang <weijun at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2deb318c9f047ec5a4b160d66a4b52f93688ec42
Stats:     1158 lines in 109 files changed: 58 ins; 445 del; 655 mod

8297065: DerOutputStream operations should not throw IOExceptions

Reviewed-by: mullan, valeriep

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

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



More information about the security-dev mailing list