Skip to content
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

Cannot read any leveldb (IndexedDB) from Skype for Desktop #119

Closed
dyorgio opened this issue Feb 22, 2020 · 2 comments · May be fixed by #127
Closed

Cannot read any leveldb (IndexedDB) from Skype for Desktop #119

dyorgio opened this issue Feb 22, 2020 · 2 comments · May be fixed by #127

Comments

@dyorgio
Copy link

dyorgio commented Feb 22, 2020

Hi!

I tried to use this lib without success to read two leveldb produced by Skype app:

SKYPE_DATA_DIR/IndexedDB/file__0.indexeddb.leveldb
and
SKYPE_DATA_DIR/Local Storage/leveldb.

For the first I needed to register a custom comparator: idb_cmp1

options.comparator(new DBComparator() {
    @Override
    public String name() {
        return "idb_cmp1";
    }

    @Override
    public byte[] findShortestSeparator(byte[] start, byte[] limit) {
        return start;
    }

    @Override
    public byte[] findShortSuccessor(byte[] key) {
        return key;
    }

    @Override
    public int compare(byte[] o1, byte[] o2) {
        return new String(o1).compareTo(new String(o2));
    }
});

But for both I received this error:

Exception in thread "main" java.lang.NullPointerException
	at org.iq80.leveldb.util.Snappy.uncompress(Snappy.java:234)
	at org.iq80.leveldb.table.MMapTable.readBlock(MMapTable.java:121)
	at org.iq80.leveldb.table.Table.openBlock(Table.java:80)
	at org.iq80.leveldb.util.TableIterator.getNextBlock(TableIterator.java:102)
	at org.iq80.leveldb.util.TableIterator.getNextElement(TableIterator.java:79)
	at org.iq80.leveldb.util.AbstractSeekingIterator.hasNext(AbstractSeekingIterator.java:48)
	at org.iq80.leveldb.util.InternalTableIterator.getNextElement(InternalTableIterator.java:51)
	at org.iq80.leveldb.util.AbstractSeekingIterator.hasNext(AbstractSeekingIterator.java:48)
	at org.iq80.leveldb.util.DbIterator.resetPriorityQueue(DbIterator.java:155)
	at org.iq80.leveldb.util.DbIterator.<init>(DbIterator.java:75)
	at org.iq80.leveldb.impl.DbImpl.internalIterator(DbImpl.java:778)
	at org.iq80.leveldb.impl.DbImpl.iterator(DbImpl.java:744)
	at org.iq80.leveldb.impl.DbImpl.iterator(DbImpl.java:735)
	at org.iq80.leveldb.impl.DbImpl.iterator(DbImpl.java:84)

I already tried to disable compression on Options.

Did anyone read Skype App database with this lib? (aka Electron/Chromium IndexedDB)

@dain
Copy link
Owner

dain commented Feb 22, 2020

Looking at the code, that stack ends at https://github.com/dain/leveldb/blob/master/leveldb/src/main/java/org/iq80/leveldb/util/Snappy.java#L234, which would imply that snappy did not load properly. I'd use a debugger and figure out why.

@dyorgio
Copy link
Author

dyorgio commented Feb 22, 2020

Thank you @dain!
Puttiing snappy dep in my pom solve this issue, maybe converting NPE to something like this:

public static void uncompress(ByteBuffer compressed, ByteBuffer uncompressed)
        throws IOException
{
    checkSnappy();
    SNAPPY.uncompress(compressed, uncompressed);
}

private void checkSnappy() {
    if (SNAPPY == null) throw new RuntimeException("Compressed database, snappy library not found in your classpath.");
}

Help future users ;)

I really didn't guess that it is a required lib for this case.

@dyorgio dyorgio closed this as completed Feb 22, 2020
stdedos added a commit to stdedos/leveldb that referenced this issue Feb 14, 2021
Fixes dain#119

Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
stdedos added a commit to stdedos/leveldb that referenced this issue Feb 17, 2021
Fixes dain#119

Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants