Author: toad
Date: 2008-06-26 01:25:06 +0000 (Thu, 26 Jun 2008)
New Revision: 20736

Modified:
   branches/db4o/freenet/src/freenet/client/Metadata.java
Log:
Paranoia

Modified: branches/db4o/freenet/src/freenet/client/Metadata.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/Metadata.java      2008-06-26 
01:22:37 UTC (rev 20735)
+++ branches/db4o/freenet/src/freenet/client/Metadata.java      2008-06-26 
01:25:06 UTC (rev 20736)
@@ -535,7 +535,9 @@
                splitfileBlocks = dataURIs.length;
                splitfileCheckBlocks = checkURIs.length;
                splitfileDataKeys = dataURIs;
+               assert(keysValid(splitfileDataKeys));
                splitfileCheckKeys = checkURIs;
+               assert(keysValid(splitfileCheckKeys));
                clientMetadata = cm;
                this.decompressedLength = decompressedLength;
                if(cm != null)
@@ -545,6 +547,12 @@
                splitfileParams = Fields.intsToBytes(new int[] { segmentSize, 
checkSegmentSize } );
        }

+       private boolean keysValid(ClientCHK[] keys) {
+               for(int i=0;i<keys.length;i++)
+                       if(keys[i].getNodeCHK().getRoutingKey() == null) return 
false;
+               return true;
+       }
+
        /**
         * Set the MIME type to a string. Compresses it if possible for transit.
         */


Reply via email to