Fix #1741.
Issue #1741: Minor simpliciation now we no longer use java union catches.
Issue #1741: Add tests and fix tests now we no longer use javs union catches