Open tseytlin opened 11 years ago
Sorry for the post. I resolved this issue. It had to do with me wanting to use the same file for multiple tables, like I did it in JDBM v1. Once each table got its own file, it worked.
I did encounter issues though with serializing Objects that contained arrays of String. When I switched arrays to Lists it worked.
I like problems which solve themselves :-)
I have a program that uses the original JDBM and I am trying to port it to JDBM3. My use case is to use String as a key and either HashSet of Strings or a custom Java object as a value.
When I substitute JDBM3 code I get an error related to object serealiation Exception in thread "Thread-0" java.lang.InternalError: Unknown serialization header: 97 at org.apache.jdbm.Serialization.deserialize(Serialization.java:962) at org.apache.jdbm.Serialization.deserializeArrayList(Serialization.java:1136) at org.apache.jdbm.Serialization.deserialize(Serialization.java:919) at org.apache.jdbm.Serialization.deserialize(Serialization.java:623) at org.apache.jdbm.DBStore.fetch2(DBStore.java:400) at org.apache.jdbm.DBStore.fetch(DBStore.java:366) at org.apache.jdbm.DBCacheRef.fetch(DBCacheRef.java:213) at org.apache.jdbm.BTreeLazyRecord.get(BTreeLazyRecord.java:28) at org.apache.jdbm.HTreeBucket.getValue(HTreeBucket.java:219) at org.apache.jdbm.HTreeDirectory.get(HTreeDirectory.java:160) at org.apache.jdbm.HTree.get(HTree.java:199) at org.apache.jdbm.HTree.containsKey(HTree.java:248) at edu.pitt.terminology.util.JDBMMap.containsKey(JDBMMap.java:83)
Which looks like it is trying to deserealize HashSet as an ArrayList.
Here is my initialization code:
Here is where I invoke a wrapper function Set termList = new HashSet(filterTerms(word,terms));
if(wordMap.containsKey(word)){
termList.addAll(getWordTerms(word));
}
wordsMap.put(word,termList);
It fails on containsKey() line, however I have a hunch that the issue is with serializing HashSet incorrectly.