Unable to commit a new version of a nt:file node within a transaction  using  a 
specfic configuration
-----------------------------------------------------------------------------------------------------

                 Key: JCR-1329
                 URL: https://issues.apache.org/jira/browse/JCR-1329
             Project: Jackrabbit
          Issue Type: Bug
          Components: config, transactions
    Affects Versions: 1.4
            Reporter: Eric Norman
         Attachments: TestCase.java

A NullPointerException is thrown when committing a version of a nt:file node 
within a transaction using the following repository configuration:

1. File data size > 1024 bytes (causes the BLOB to use a temp file, otherwise 
the data is kept in memory)
2. Persistance Manager: 
org.apache.jackrabbit.core.state.db.DerbyPersistenceManager
3. No <DataStore> configured in repository.xml

The cause appears to be that during the commit operation 
BLOBInTempFile.discard() is called which deletes the temp file, then later on, 
BLOBInTempFile.getStream() is called on the same object, but the file has 
already been deleted, so it fails resulting in the following exception:

121375 [main] ERROR 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager  - failed 
to write property state: 
c4c5b6ec-b12d-419d-8a1f-03eb69f30aee/{http://www.jcp.org/jcr/1.0}data
java.lang.NullPointerException
        at java.io.FileInputStream.<init>(FileInputStream.java:103)
        at 
org.apache.jackrabbit.core.value.BLOBInTempFile.getStream(BLOBInTempFile.java:145)
        at 
org.apache.jackrabbit.core.persistence.util.Serializer.serialize(Serializer.java:198)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:476)
        at 
org.apache.jackrabbit.core.persistence.AbstractPersistenceManager.store(AbstractPersistenceManager.java:75)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:282)
        at 
org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:688)
        at 
org.apache.jackrabbit.core.state.XAItemStateManager.commit(XAItemStateManager.java:162)
        at 
org.apache.jackrabbit.core.version.XAVersionManager.commit(XAVersionManager.java:476)
        at 
org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:189)
        at 
org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:339)
        at TestCase.main(TestCase.java:81)


Workarounds:
1. Use a different persistance manager.  
'org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager' does 
not fail.
2. Configure a <DataStore> in your repository.xml.  This results in a different 
code path that seems to work.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to