Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
2.5.0
-
None
Description
Starting with OPENNLP-1618, AbstractDL implements AutoClosable. However, the close method allows to throw any type inheriting from Exception. This, however, leads to a bunch of compiler warnings being issued:
AbstractDL.java:[37,17] auto-closeable resource opennlp.dl.AbstractDL has a member method close() that could throw InterruptedException
...
during compilation, for all classes that inherit from or use AbstractDL.
The fix is simple:
Override the throws Exception declaration with more specific exceptions, for instance: throws OrtException, IllegalStateException that can be thrown in this case. Thus, InterruptedException is not declared / possible and javac is happy again.
Let's cure this.