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

NPE on Array deserialization #93

Closed
orabelt opened this issue Aug 27, 2012 · 0 comments
Closed

NPE on Array deserialization #93

orabelt opened this issue Aug 27, 2012 · 0 comments

Comments

@orabelt
Copy link

orabelt commented Aug 27, 2012

public void testArrays() throws IOException {

        Object[][] odata = new Object[][] {
            {(int)25, (short)20, (short)32, (short)16, (short)20},
        };

        String testFile = TestCaseWithTestFile.newTestFile();

        // write
        DB db = DBMaker.openFile(testFile).disableTransactions().make();
        Map<Long, Object> map = db.createTreeMap("testArrays");
        map.put(1L, odata[0]);
        db.close();

        // read
        DB dbr = DBMaker.openFile(testFile).disableTransactions().make();
        Object arr = dbr.getTreeMap("testArrays").get(1L); // <- NPE
        dbr.close();
    }

java.lang.NullPointerException
at java.lang.reflect.Array.newArray(Native Method)
at java.lang.reflect.Array.newInstance(Array.java:52)
at org.apache.jdbm.Serialization.deserializeArrayObject(Serialization.java:1092)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:910)
at org.apache.jdbm.Serialization.deserialize(Serialization.java:614)
at org.apache.jdbm.BTreeLazyRecord.fastDeser(BTreeLazyRecord.java:69)
at org.apache.jdbm.BTreeNode.readValues(BTreeNode.java:1007)
at org.apache.jdbm.BTreeNode.deserialize(BTreeNode.java:947)
at org.apache.jdbm.BTreeNode.deserialize(BTreeNode.java:43)
at org.apache.jdbm.DBStore.fetch2(DBStore.java:400)
at org.apache.jdbm.DBStore.fetch(DBStore.java:366)
at org.apache.jdbm.DBCacheMRU.fetch(DBCacheMRU.java:165)
at org.apache.jdbm.BTree.getRoot(BTree.java:496)
at org.apache.jdbm.BTree.get(BTree.java:385)
at org.apache.jdbm.BTreeMap.get(BTreeMap.java:248)

patch:
Serialization.java
+1091 if (clazz == null) clazz = Object.class;

jankotek added a commit that referenced this issue Aug 28, 2012
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

No branches or pull requests

2 participants