-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with closing RAMDictionary. #3
Comments
I would refactor your code as follows: String wordNetFolder = System.getProperty("user.dir") + "/src/main/resources/wordnet/dict/";
File exFile = new File(wordNetFolder + "JWI_Export_.wn");
IRAMDictionary dictionary;
dictionary = new RAMDictionary(dictionaryFolder);
dictionary.setLoadPolicy(ILoadPolicy.IMMEDIATE_LOAD);
try {
dictionary.open();
dictionary.export(new FileOutputStream(exFile));
} catch (IOException e1) {
e1.printStackTrace();
} finally {
if (dictionary != null) {
dictionary.close();
}
} |
Thanks for you quick reply. I have done exactly what you suggested, but I also added a print to check if the dictionary is actually not null, after if (dictionary != null) . It seems that the dictionary is not null but it is still open after I call the function to close it. |
Sorry to bother again in such a short notice, but I have been doing some digging inside your classes and apparently in https://github.com/rm-hull/jwi/blob/master/src/edu/mit/jwi/RAMDictionary.java#L448 the |
Here is my code:
When I do
assert(dictionary.isOpen() == false);
I get java.lang.AssertionError because the dictionary seems to still be open.
Why is this happening?
I am using the 2.4.0 version.
The text was updated successfully, but these errors were encountered: