decodeCertificate throws IllegalArgumentException on an unparseable certificate #16
Labels
Milestone
Comments
Fixed in the context of pull request #22. It's worth noting that I didn't take the "no runtime exception" route because it would have had dramatic consequences on the API. Instead, I took care to declare specific subclasses of RuntimeException that are well documented and declared on the throws clause to help emphasize what exceptions can be emitted from various method calls. Then implementers have the choice of handling them or not based on their specific needs. The PR has further justification for handling all API-specific errors as runtime exceptions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The org.cryptacular.util.CertUtil.decodeCertificate(byte[]) method catches the Java runtime's CertificateException when there's a problem parsing a certificate, and turns it into an IllegalArgumentException. That obviously isn't declared on the method since it's a runtime exception, so we weren't catching that in our X509Support class in OpenSAML.
I'd say as a general matter the parsing oriented methods ought to avoid throwing runtime errors since those are certainly likely to show up at runtime through no fault of the code.
The text was updated successfully, but these errors were encountered: