Author: toad
Date: 2008-07-19 18:43:22 +0000 (Sat, 19 Jul 2008)
New Revision: 21264

Modified:
   branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
Log:
Really fix the NPEs: Set the buckets before deactivating them, and don't null 
out if we're going to keep the array

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java       
2008-07-19 18:42:08 UTC (rev 21263)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java       
2008-07-19 18:43:22 UTC (rev 21264)
@@ -119,8 +119,11 @@
                if(persistent) {
                        // Deactivate all buckets, and let dataBuckets be GC'ed
                        for(int i=0;i<dataBuckets.length;i++) {
+                               // If we don't set them now, they will be set 
when the segment is set, which means they will be set deactivated, and cause 
NPEs.
+                               container.set(dataBuckets[i]);
                                container.deactivate(dataBuckets[i], 5);
-                               dataBuckets[i] = null;
+                               if(dataBuckets.length > segmentSize) // 
Otherwise we are nulling out within the segment
+                                       dataBuckets[i] = null;
                        }
                }
                dataBuckets = null;


Reply via email to