Skip to content

Commit

Permalink
OPENNLP-1646: Remove compiler warnings in AbstractDL and inheriting c…
Browse files Browse the repository at this point in the history
…lasses (#688)
  • Loading branch information
mawiesne authored Nov 17, 2024
1 parent 3feb420 commit 4d9dab9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions opennlp-dl/src/main/java/opennlp/dl/AbstractDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.stream.Stream;

import ai.onnxruntime.OrtEnvironment;
import ai.onnxruntime.OrtException;
import ai.onnxruntime.OrtSession;

import opennlp.tools.tokenize.Tokenizer;
Expand Down Expand Up @@ -68,10 +69,11 @@ public Map<String, Integer> loadVocab(final File vocabFile) throws IOException {
/**
* Closes this resource, relinquishing any underlying resources.
*
* @throws Exception If it failed to close.
* @throws OrtException Thrown if it failed to close Ort resources.
* @throws IllegalStateException Thrown if the underlying resources were already closed.
*/
@Override
public void close() throws Exception {
public void close() throws OrtException, IllegalStateException {
if (session != null) {
session.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,8 @@ public void invalidModel() {

final File model = new File("invalid.onnx");
final File vocab = new File("vocab.txt");

try (final NameFinderDL nameFinderDL = new NameFinderDL(model, vocab, getIds2Labels(),
sentenceDetector)) {
}
//noinspection resource
new NameFinderDL(model, vocab, getIds2Labels(), sentenceDetector);
});

}
Expand Down

0 comments on commit 4d9dab9

Please sign in to comment.