• Philip S Doctor's avatar
    When Java raises a CharacterCodingException, the catch block rethrows this… · b24c0b07
    Philip S Doctor authored
    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
    b24c0b07
Name
Last commit
Last update
.github Loading commit data...
.travis Loading commit data...
CMake Loading commit data...
android Loading commit data...
biicode Loading commit data...
docs Loading commit data...
go Loading commit data...
grpc Loading commit data...
include/flatbuffers Loading commit data...
java/com/google/flatbuffers Loading commit data...
js Loading commit data...
net/FlatBuffers Loading commit data...
php Loading commit data...
python Loading commit data...
reflection Loading commit data...
samples Loading commit data...
src Loading commit data...
tests Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
BUILD Loading commit data...
CMakeLists.txt Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE.txt Loading commit data...
WORKSPACE Loading commit data...
appveyor.yml Loading commit data...
biicode.conf Loading commit data...
composer.json Loading commit data...
conanfile.py Loading commit data...
package.json Loading commit data...
pom.xml Loading commit data...
readme.md Loading commit data...