jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1461300 - in /jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction: Journal.java Transaction.java
Date Tue, 26 Mar 2013 20:30:40 GMT
Author: andy
Date: Tue Mar 26 20:30:39 2013
New Revision: 1461300

URL: http://svn.apache.org/r1461300
Log:
Shuffle journal entry reading around so checks done before attempting to use the data.

Modified:
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java?rev=1461300&r1=1461299&r2=1461300&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Journal.java Tue Mar
26 20:30:39 2013
@@ -225,10 +225,10 @@ class Journal implements Sync, Closeable
         Adler32 adler = new Adler32() ;
         adler.update(header.array()) ;
 
-        JournalEntryType type = JournalEntryType.type(typeId) ;
-        FileRef fileRef = FileRef.get(ref) ;
         ByteBuffer bb = ByteBuffer.allocate(len) ;
         lenRead = channel.read(bb) ;
+        if ( lenRead != len)
+            throw new TDBTransactionException("Failed to read the journal entry: wanted "+len+"
bytes, got "+lenRead) ;
         adler.update(bb.array()) ;
         bb.rewind() ;
         // checksum
@@ -240,6 +240,9 @@ class Journal implements Sync, Closeable
         if ( checksum != (int)adler.getValue() )
         	throw new TDBTransactionException("Checksum error reading from the Journal.") ;
 
+        JournalEntryType type = JournalEntryType.type(typeId) ;
+        FileRef fileRef = FileRef.get(ref) ;
+
         Block block = new Block(blockId, bb) ;
         return new JournalEntry(type, fileRef, block) ;
     } 

Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java?rev=1461300&r1=1461299&r2=1461300&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java Tue
Mar 26 20:30:39 2013
@@ -159,7 +159,7 @@ public class Transaction
                 SystemTDB.errlog.warn("IOException after commit point : transaction commited
but internal status not recorded properly : "+ex.getMessage()) ;
             else
                 SystemTDB.errlog.warn("Exception after commit point : transaction commited
but internal status not recorded properly", ex) ;
-            throw new TDBTransactionException("Exc eption after commit point - transaction
did commit", ex) ;
+            throw new TDBTransactionException("Exception after commit point - transaction
did commit", ex) ;
         }
     }
     



Mime
View raw message