little refactor, raising exception from java native method implementation in callback