NPE in BlockMgrCache in direct mode
-----------------------------------

                 Key: JENA-86
                 URL: https://issues.apache.org/jira/browse/JENA-86
             Project: Jena
          Issue Type: Bug
          Components: TDB
            Reporter: Simon Helsen
            Priority: Critical


There seems to be a problem with the implementation of getWrite in 
BlockMgrCache. Whenever there is a write and read cache miss, the code does not 
actually delegate to the wrapped BlockMgr. In direct mode, this would have to 
be the file system. The resulting exception is 

java.lang.NullPointerException
        at 
com.hp.hpl.jena.tdb.base.page.PageBlockMgr.getWrite(PageBlockMgr.java:50)
        at 
com.hp.hpl.jena.tdb.index.bplustree.BPTreeNode.getMgrWrite(BPTreeNode.java:162)
        at 
com.hp.hpl.jena.tdb.index.bplustree.BPTreeNode.get(BPTreeNode.java:145)
        at 
com.hp.hpl.jena.tdb.index.bplustree.BPTreeNode.delete(BPTreeNode.java:227)
        at 
com.hp.hpl.jena.tdb.index.bplustree.BPlusTree.deleteAndReturnOld(BPlusTree.java:324)
        at 
com.hp.hpl.jena.tdb.index.bplustree.BPlusTree.delete(BPlusTree.java:318)
        at 
com.hp.hpl.jena.tdb.index.TupleIndexRecord.performDelete(TupleIndexRecord.java:55)
        at 
com.hp.hpl.jena.tdb.index.TupleIndexBase.delete(TupleIndexBase.java:61)
        at com.hp.hpl.jena.tdb.index.TupleTable.delete(TupleTable.java:108)
        at 
com.hp.hpl.jena.tdb.graph.BulkUpdateHandlerTDB.removeWorker(BulkUpdateHandlerTDB.java:136)
        at 
com.hp.hpl.jena.tdb.graph.BulkUpdateHandlerTDB.removeAll(BulkUpdateHandlerTDB.java:90)
        at com.hp.hpl.jena.rdf.model.impl.ModelCom.removeAll(ModelCom.java:315)

I think the fix is to change the following code in the getWrite method of 
BlockMgrCache (starting at line 158):

     // Did not find.
        cacheMisses++ ;
        log("Miss/w: %d", id) ;
        if ( writeCache != null )
            writeCache.put(id, blk) ;
        return blk ;

into 

     // Did not find.
        cacheMisses++ ;
        log("Miss/w: %d", id) ;
        blk = super.getWrite(id);
        if ( writeCache != null )
            writeCache.put(id, blk) ;
        return blk ;

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to