RFR: 8297065: DerOutputStream operations should not throw IOExceptions

Weijun Wang weijun at openjdk.org
Tue Nov 22 22:37:32 UTC 2022


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

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

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

Commit messages:
 - the fix

Changes: https://git.openjdk.org/jdk/pull/11302/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11302&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297065
  Stats: 1139 lines in 109 files changed: 58 ins; 426 del; 655 mod
  Patch: https://git.openjdk.org/jdk/pull/11302.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11302/head:pull/11302

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



More information about the security-dev mailing list