itkach / aard2-android

Aard2 for Android, a simple dictionary app
GNU General Public License v3.0
457 stars 97 forks source link

Aard2 fails to view articles in Gesner Latin dictionary #166

Closed LRN closed 1 year ago

LRN commented 1 year ago

See https://github.com/latin-dict/Gesner1749/releases

java.lang.NullPointerException: Attempt to invoke interface method 'byte[] itkach.slob.Slob$Compressor.decompress(byte[])' on a null object reference
    at itkach.slob.Slob$StoreItem.getBinItem(Slob.java:626)
    at itkach.slob.Slob$StoreItem.access$300(Slob.java:611)
    at itkach.slob.Slob$Store.getContentData(Slob.java:682)
    at itkach.slob.Slob.getContent(Slob.java:902)
    at itkach.slob.Slob.getContent(Slob.java:898)
    at itkach.slobber.Slobber$4.GET(Slobber.java:527)
    at itkach.slobber.Slobber$GETContainer.handle(Slobber.java:77)
    at itkach.slobber.Slobber.handle(Slobber.java:618)
    at org.simpleframework.http.core.RequestDispatcher.dispatch(RequestDispatcher.java:121)
    at org.simpleframework.http.core.RequestDispatcher.run(RequestDispatcher.java:103)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)

Now, it's quite possible that the dictionary is poorly-formed, but i have no way to check that.

itkach commented 1 year ago

Now, it's quite possible that the dictionary is poorly-formed

it is. Here's the header (retrieved with slob or aard2-web):

         id: 63629b7e9f1940889df4b89c24382f0e
   encoding: utf-8
compression:
 blob count: 58522
  ref count: 223578

compression name is missing

nikita-moor commented 1 year ago

Hello. It's my dictionary, and it was intentionally stored w/o compression:

import slob
with slob.create(filename, compression="") as slb:
    ...

I think slob library does allow it:

Empty value means bins are not compressed.

itkach commented 1 year ago

I think slob library does allow it:

Indeed. But Java implementation doesn't support this :)

Using zlib should incur negligible overhead though, even if it doesn't ultimately decrease dictionary size, no reason not to use it. It seems to me that use of TIFF is way more problematic. Dictionary content is typically rendered/viewed with a web browser (desktop or embedded like WebView on Android) and no mainstream browser supports TIFF (other than perhaps Safari?).