jni better error handling when opening a file / atttribute