When Java raises a CharacterCodingException, the catch block rethrows this…
When Java raises a CharacterCodingException, the catch block rethrows this exception as a java.lang.Error. Per the docs https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html an Error is a serious problem that applications should not attempt to catch such as ThreadDeath. In this case, it is reasonable for a consumer to try to catch this error as it likely indicates a problem with the underlying data. (#4630) As Error does not inherit from Exception, a generic `catch(Exception ex)` will not catch this error. A simple change from `Error` to `Exception` is not sufficient as an `Exception` is checked by the compiler, so in order to keep this issue unchecked, I am proposing raising a `RuntimeException` which is not checked, but is still a subclass of `Exception`. The only possible breaking change would be if a consumer was explicitly catching `Error` already for this library. https://github.com/google/flatbuffers/issues/4629
Showing
Please
register
or
sign in
to comment