Initialize JWNL usign DatabaseBackedDictionary then
when any method that access the dictionary is called,
JWNL would throws a SQLException with message "Using
Empty ResultSet".
here is the exception stack trace:
0 [main] INFO net.didion.jwnl.dictionary.Dictionary -
Installing dictionary
net.didion.jwnl.dictionary.DatabaseBackedDictionary@e3b895
2
1
net.didion.jwnl.JWNLException: Error while accessing
database
at
net.didion.jwnl.dictionary.DatabaseBackedDictionary.getSynsetAt(DatabaseBackedDictionary.java:132)
at
net.didion.jwnl.data.IndexWord.loadSynset(IndexWord.java:107)
at
net.didion.jwnl.data.IndexWord.getSense(IndexWord.java:101)
at meme.garden.wordnet.WordNetLookup.main(Unknown
Source) Caused by: java.sql.SQLException: Illegal
operation on empty result set.
at
com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:5327)
at
com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:5019)
at
com.mysql.jdbc.ResultSet.getNativeBoolean(ResultSet.java:4124)
at
com.mysql.jdbc.ResultSet.getBoolean(ResultSet.java:693)
at
net.didion.jwnl.princeton.data.AbstractPrincetonDatabaseDictionaryElementFactory.createSynset(AbstractPrincetonDatabaseDictionaryElementFactory.java:42)
at
net.didion.jwnl.dictionary.DatabaseBackedDictionary.getSynsetAt(DatabaseBackedDictionary.java:126)
... 3 more
when looked through the source and the error is caused
here:
public Synset createSynset(POS pos, long offset,
ResultSet synset,
ResultSet words, ResultSet pointers, ResultSet
verbFrames) throws SQLException {
synset.next();
boolean isAdjectiveCluster = synset.getBoolean(1);
String gloss = synset.getString(2);
// ...
where, as you can see, there is no check that the
ResultSet is not empty: if (synset.next())
I fixed this in my fork at http://extjwnl.sourceforge.net/
Aliaksandr