Resources are not being closed by Annotator object

When we pass a String to Annotator annotator = new Annotator(filepath) it leaves the resource open even if we call annotator.dispose(); annotator.close();. If you put a breakpoint after you dispose or close it, you’ll see that you cannot delete or rename the file because it is being used by JVM. And this leads to one question. Does annotator.close() call annotator.dispose() or should I use both? I would like to use it with try-with-resources to auto-close it for me.

For now, I fixed this issue by passing an InputStream to the Annotator, but I would like to alert you about this issue.

1 Like

@john.mcqueide

We are investigating this issue. Your investigation ticket ID is ANNOTATIONJAVA-1354. We’ll notify you in case of any update.

1 Like

@john.mcqueide

The issue or ticket mentioned has been addressed and resolved in versions 23.6. Furthermore, we would like to highlight that you can utilize the try-with-resources mechanism for automatic file closure.