3 ms·
Whenever I need to convert a string to a UTF-8 byte array, or do a SHA-256 hash, I need to catch UnsupportedEncodingException or NoSuchAlgorithmException respec
by theandrewbailey 6y ago
Whenever I need to convert a string to a UTF-8 byte array, or do a SHA-256 hash, I need to catch UnsupportedEncodingException or NoSuchAlgorithmException respectively. These are ubiquitous standards built into every JVM. It's impossible to recover from these exceptions, but it's impossible to not have these standards. It's one of examples of astronaut architecture[1] that I've needed to get around.
I have a throwable type JVMNotSupportedError[0] specifically to wrap these possible but will never be thrown exceptions. Its sole reason for existence, theoretically, is to yell at the user to get a better JVM.
[0] https://github.com/theandrewbailey/toilet/blob/master/libWebsiteTools/src/libWebsiteTools/JVMNotSupportedError.java https://github.com/theandrewbailey/toilet/blob/master/libWeb...
[1] https://www.joelonsoftware.com/2001/04/21/dont-let-architecture-astronauts-scare-you/ https://www.joelonsoftware.com/2001/04/21/dont-let-architect...