The major change is to remove the `get` and `set` methods in various 
`CertAttrSet` child classes and change them to `setXyz` and `getXyz` methods. 
The `Xyz` words might come from the field name or the attribute name. For 
example, `X509CertInfo` now has `setExtensions` and `setValidity` instead of 
`set("extensions", exts)` and `set("validity", validity)`. This also has the 
benefit to remove a lot of try-catch blocks on `IOException`s on "unknown 
attributes" because everything is known now. At the same time, all the 
identifier name and attribute names are removed from `CertAttrSet` child 
classes. The only left is `NAME` in extensions since it's still used as keys in 
`CertificateExtensions`.

Besides assigning a new value to an internal field, the original `set` methods 
might also re-encode by calling `encodeThis`, invalidate the cached encoding 
(in `X509CertInfo`), or check for read-only flag (in `X509CertImp`). Newly 
added `setXyz` methods are doing the same. This is one place that future new 
setter methods should remember.

Most `get` implementations simply return an internal field. One exception in 
`X509CertImpl` is that when getting something inside the `X509CertInfo`, it 
wraps exceptions into a new `CertificateParsingException`. This is actually 
related to the way `CertificateExtensions::get` is implemented where an 
exception is thrown when an extension does not exist. 
`CertificateExtensions::getExtension` has been rewritten to follow the 
`CRLExtensions::getExtension` style where `null` is returned in this case.

The only method left in `CertAttrSet` is `encode`, and it no longer throws a 
`CertificateException`.

Several classes do have their attributes, and still has get/set methods. This 
includes `CertificateExtensions`, `CRLExtensions`, `ReasonFlags`, 
`KeyUsageExtension`, and `NetscapeCertTypeExtensions`. Some methods are renamed 
to be clearer. For example, in `CertificateExtensions`, we have `getExtension` 
instead of `get`.

There are no more `AttributeNameEnumeration.java` and `X509AttributeName.java`.

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

Commit messages:
 - the fix

Changes: https://git.openjdk.org/jdk/pull/10959/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10959&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296143
  Stats: 2836 lines in 66 files changed: 57 ins; 2284 del; 495 mod
  Patch: https://git.openjdk.org/jdk/pull/10959.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10959/head:pull/10959

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

Reply via email to