I am trying to use the Java-WordNet interface on an Android project. I am able to make the basic code to open the dictionary etc. (as given in the docs work) which is also what I need in my own project. However, I notice that sometimes the dict.open()
method will fail at run-time with an error whose stacktrace is given below:
10-15 19:10:34.556: E/com.sriram.dict.EHDictionary@40516b00(16596): Run time exception caught.
10-15 19:10:34.576: W/System.err(16596): edu.mit.jwi.data.parse.ILineParser$MisformattedLineException: ��������Mac OS X �������� ������2����ᄚ����������¬������������������������������������������������������������������������ATTR;レ����¬������リ������U������������������������������������リ������U����com.apple.quarantine��0001;525b8927;Google\x20Chrome;774A992E-4B54-4DBA-AD26-44520094A014|com.google.Chrome��������������������������������������������������������������������������������������� < lots of these question marks>
��������������������������
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.data.parse.DataLineParser.parseLine(DataLineParser.java:234)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.data.parse.DataLineParser.parseLine(DataLineParser.java:54)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.data.FileProvider.createDataSource(FileProvider.java:481)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.data.FileProvider.createSourceMap(FileProvider.java:431)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.data.FileProvider.open(FileProvider.java:318)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.DataSourceDictionary.open(DataSourceDictionary.java:92)
10-15 19:10:34.576: W/System.err(16596): at edu.mit.jwi.CachingDictionary.open(CachingDictionary.java:133)
10-15 19:10:34.576: W/System.err(16596): at com.sriram.dict.EHDictionary.initDict(EHDictionary.java:250)
10-15 19:10:34.576: W/System.err(16596): at
com.sriram.dict.EHDictionary.<init>(EHDictionary.java:50)
10-15 19:10:34.576: W/System.err(16596): at com.sriram.dict.EHTextView.initEHTextView(EHTextView.java:83)
10-15 19:10:34.576: W/System.err(16596): at com.sriram.dict.ContentHandler.onCreate(ContentHandler.java:84)
10-15 19:10:34.576: W/System.err(16596): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-15 19:10:34.576: W/System.err(16596): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
10-15 19:10:34.576: W/System.err(16596): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
10-15 19:10:34.576: W/System.err(16596): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-15 19:10:34.576: W/System.err(16596): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
10-15 19:10:34.576: W/System.err(16596): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 19:10:34.576: W/System.err(16596): at android.os.Looper.loop(Looper.java:123)
10-15 19:10:34.576: W/System.err(16596): at android.app.ActivityThread.main(ActivityThread.java:3691)
10-15 19:10:34.576: W/System.err(16596): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 19:10:34.576: W/System.err(16596): at java.lang.reflect.Method.invoke(Method.java:507)
10-15 19:10:34.576: W/System.err(16596): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
10-15 19:10:34.576: W/System.err(16596): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-15 19:10:34.576: W/System.err(16596): at dalvik.system.NativeStart.main(Native Method)
10-15 19:10:34.581: W/System.err(16596): Caused by: java.lang.NumberFormatException: unable to parse '��������Mac' as integer
10-15 19:10:34.581: W/System.err(16596): at java.lang.Integer.parse(Integer.java:383)
10-15 19:10:34.581: W/System.err(16596): at java.lang.Integer.parseInt(Integer.java:372)
10-15 19:10:34.581: W/System.err(16596): at java.lang.Integer.parseInt(Integer.java:332)
10-15 19:10:34.581: W/System.err(16596): at edu.mit.jwi.data.parse.DataLineParser.parseLine(DataLineParser.java:95)
10-15 19:10:34.581: W/System.err(16596): ... 23 more
And the code is:
try {
dict.open();
if(VERBOSE) Log.v(this.toString(), "Dictionary open.");
wns = new WordnetStemmer(dict);
} catch(IOException e) {
Log.e(this.toString(), "IOException in opening dictionary.");
e.printStackTrace();
} catch(RuntimeException e1) {
Log.e(this.toString(), "Run time exception caught.");
e1.printStackTrace();
}
The error above seems to occur in cases where the dictionary is downloaded from a repository I have made available. Thinking it might be a case of something-lost-in-download, I added a checksum (with MD5) such that each time the app is loaded, this checksum is performed and then compared with a list of checksums for the various files in the dictionary (from files known to not give this error). The checksum matches each time.
My question(s):
1. What does the ???? in the error above indicate? Is there any way I can get to the text of it?
2. Any clues on solving this would be most welcome.