~rsalveti/libjpeg-turbo/libjpeg-turbo-trunk

Viewing all changes in revision 1098.

  • Committer: dcommander
  • Date: 2015-07-14 20:42:52 UTC
  • Revision ID: svn-v4:632fc199-4ca6-4c93-a231-07263d6284db:trunk:1595
Throw idiomatic unchecked exceptions from the Java classes and JNI wrapper if there is an unrecoverable error caused by incorrect API usage (such as illegal arguments, etc.), and throw Errors if there is an unrecoverable error at the C level (such as a failed malloc() call.)

Change the behavior of the bailif0() macro in the JNI wrapper so that it doesn't throw an exception for an unexpected NULL condition.  In fact, in all cases, the underlying JNI API function (such as GetFieldID(), etc.) will throw an Error on its own whenever it returns NULL, so our custom exceptions were never being thrown in that case anyhow.  All we need to do is just detect the error and bail out of the C code.

This also corrects a couple of formatting issues (semicolons aren't needed at the end of class definitions, and @Override should be specified for the methods we're overriding from super-classes, so the compiler can sanity-check that we're actually overriding a method and not declaring a new one.)

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: