Author: j16sdiz
Date: 2008-09-09 13:48:53 +0000 (Tue, 09 Sep 2008)
New Revision: 22575

Modified:
   trunk/freenet/src/freenet/support/BloomFilter.java
Log:
try to track the "*.bloom" file not created problem

Modified: trunk/freenet/src/freenet/support/BloomFilter.java
===================================================================
--- trunk/freenet/src/freenet/support/BloomFilter.java  2008-09-09 11:06:42 UTC 
(rev 22574)
+++ trunk/freenet/src/freenet/support/BloomFilter.java  2008-09-09 13:48:53 UTC 
(rev 22575)
@@ -29,8 +29,8 @@
        }

        public static BloomFilter createFilter(File file, int length, int k, 
boolean counting) throws IOException {
-               if (k == 0 || length == 0)
-                       return new NullBloomFilter(length, k);
+               //if (k == 0 || length == 0)
+               //      return new NullBloomFilter(length, k);
                if (counting)
                        return new CountingBloomFilter(file, length, k);
                else
@@ -147,12 +147,13 @@
         * @param maxKey
         * @return optimal K
         */
-       // may return 0 if the length is too short
        public static int optimialK(int filterLength, long maxKey) {
                long k = Math.round(Math.log(2) * filterLength / maxKey);

                if (k > 64)
                        k = 64;
+               if (k < 1)
+                       k = 1;

                return (int) k;
        }


Reply via email to