Java bindings: simplify checkNotNull assertions.

* Provide better assertion messages for all checkNotNull assertions.
* Fix a bug in these assertions in InputParameter and OutputParameter.