Author: toad
Date: 2009-03-18 00:11:38 +0000 (Wed, 18 Mar 2009)
New Revision: 26082

Added:
   branches/db4o/freenet/src/freenet/support/CurrentTimeUTC.java
   branches/db4o/freenet/src/freenet/support/LogThresholdCallback.java
Modified:
   branches/db4o/freenet/
   branches/db4o/freenet/devnotes/specs/metadata-v0.txt
   branches/db4o/freenet/src/freenet/client/
   branches/db4o/freenet/src/freenet/client/Metadata.java
   branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
   branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
   branches/db4o/freenet/src/freenet/client/async/RequestCooldownQueue.java
   branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
   branches/db4o/freenet/src/freenet/client/async/USKFetcher.java
   branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
   branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
   branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
   branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
   branches/db4o/freenet/src/freenet/clients/http/filter/CSSReadFilter.java
   branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
   
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
   branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java
   branches/db4o/freenet/src/freenet/clients/http/filter/GIFFilter.java
   
branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
   branches/db4o/freenet/src/freenet/clients/http/filter/JPEGFilter.java
   branches/db4o/freenet/src/freenet/clients/http/filter/PNGFilter.java
   
branches/db4o/freenet/src/freenet/clients/http/filter/UnsafeContentTypeException.java
   
branches/db4o/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat
   branches/db4o/freenet/src/freenet/crypt/Yarrow.java
   branches/db4o/freenet/src/freenet/io/NetworkInterface.java
   branches/db4o/freenet/src/freenet/io/comm/DisconnectedException.java
   branches/db4o/freenet/src/freenet/io/comm/FreenetInetAddress.java
   branches/db4o/freenet/src/freenet/io/comm/Message.java
   branches/db4o/freenet/src/freenet/io/comm/MessageCore.java
   branches/db4o/freenet/src/freenet/io/comm/NotConnectedException.java
   branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java
   branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java
   branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java
   branches/db4o/freenet/src/freenet/io/xfer/PacketThrottle.java
   branches/db4o/freenet/src/freenet/keys/ClientCHK.java
   branches/db4o/freenet/src/freenet/keys/FreenetURI.java
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.es.properties
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fi.properties
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
   branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties
   branches/db4o/freenet/src/freenet/node/BlockedTooLongException.java
   branches/db4o/freenet/src/freenet/node/DarknetPeerNode.java
   branches/db4o/freenet/src/freenet/node/FNPPacketMangler.java
   branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
   branches/db4o/freenet/src/freenet/node/LowLevelGetException.java
   branches/db4o/freenet/src/freenet/node/Node.java
   branches/db4o/freenet/src/freenet/node/NodeClientCore.java
   branches/db4o/freenet/src/freenet/node/NodeCryptoConfig.java
   branches/db4o/freenet/src/freenet/node/NodeDispatcher.java
   branches/db4o/freenet/src/freenet/node/NodePinger.java
   branches/db4o/freenet/src/freenet/node/NodeStats.java
   branches/db4o/freenet/src/freenet/node/OpennetManager.java
   branches/db4o/freenet/src/freenet/node/PacketSender.java
   branches/db4o/freenet/src/freenet/node/PacketTracker.java
   branches/db4o/freenet/src/freenet/node/PeerNode.java
   branches/db4o/freenet/src/freenet/node/PeerNodeStatus.java
   branches/db4o/freenet/src/freenet/node/RequestSender.java
   branches/db4o/freenet/src/freenet/node/RequestStarter.java
   branches/db4o/freenet/src/freenet/node/RequestTag.java
   branches/db4o/freenet/src/freenet/node/SendableGetRequestSender.java
   branches/db4o/freenet/src/freenet/node/StillNotAckedException.java
   branches/db4o/freenet/src/freenet/node/TextModeClientInterfaceServer.java
   branches/db4o/freenet/src/freenet/node/Version.java
   branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
   
branches/db4o/freenet/src/freenet/pluginmanager/RedirectPluginHTTPException.java
   
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
   branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java
   branches/db4o/freenet/src/freenet/support/BloomFilter.java
   branches/db4o/freenet/src/freenet/support/ByteBufferInputStream.java
   branches/db4o/freenet/src/freenet/support/CountingBloomFilter.java
   branches/db4o/freenet/src/freenet/support/DoublyLinkedList.java
   branches/db4o/freenet/src/freenet/support/DoublyLinkedListImpl.java
   branches/db4o/freenet/src/freenet/support/Executor.java
   branches/db4o/freenet/src/freenet/support/LRUHashtable.java
   branches/db4o/freenet/src/freenet/support/LRUQueue.java
   branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
   branches/db4o/freenet/src/freenet/support/Logger.java
   branches/db4o/freenet/src/freenet/support/LoggerHook.java
   branches/db4o/freenet/src/freenet/support/PooledExecutor.java
   branches/db4o/freenet/src/freenet/support/PrioritizedSerialExecutor.java
   branches/db4o/freenet/src/freenet/support/SerialExecutor.java
   branches/db4o/freenet/src/freenet/support/TransferThread.java
   branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedList.java
   
branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedListWithForeignIndex.java
   branches/db4o/freenet/src/freenet/support/VoidLogger.java
   branches/db4o/freenet/src/freenet/support/WouldBlockException.java
   branches/db4o/freenet/src/freenet/support/io/BaseFileBucket.java
   branches/db4o/freenet/src/freenet/support/io/LineReadingInputStream.java
   branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java
   branches/db4o/freenet/src/freenet/tools/AddRef.java
   branches/db4o/freenet/test/freenet/io/Inet4AddressMatcherTest.java
   branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
   branches/db4o/freenet/test/freenet/support/FieldsTest.java
   branches/db4o/freenet/test/freenet/support/LRUHashtableTest.java
   branches/db4o/freenet/test/freenet/support/LRUQueueTest.java
   branches/db4o/freenet/test/freenet/support/SortedLongSetTest.java
   branches/db4o/freenet/test/freenet/support/io/MockInputStream.java
   
branches/db4o/freenet/test/freenet/support/io/PaddedEphemerallyEncryptedBucketTest.java
   branches/db4o/freenet/test/freenet/support/io/TempFileBucketTest.java
Log:
Merge trunk up to SVN r25872



Property changes on: branches/db4o/freenet
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/freenet:19964-25209,25900
   + /branches/db4o:25594
/trunk/freenet:19964-25872,25900

Modified: branches/db4o/freenet/devnotes/specs/metadata-v0.txt
===================================================================
--- branches/db4o/freenet/devnotes/specs/metadata-v0.txt        2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/devnotes/specs/metadata-v0.txt        2009-03-18 
00:11:38 UTC (rev 26082)
@@ -11,6 +11,7 @@
 size, metadata of any conceivable size, ZIP manifests and ordinary
 manifests. Limits will be imposed at the client level. Comments?

+All numbers are in java big-endian.

 8 bytes - magic number for freenet metadata
 Wasted bytes, just being paranoid.
@@ -19,78 +20,73 @@
 0 for now.

 1 byte - document type
-0 = simple redirect (including splitfiles)
-1 = multi-level metadata (fetch this key, then use it as metadata)
-2 = ordinary manifest
-3 = ZIP manifest
-4 = reserved for use in ZIP manifests, see below
-5+ = available
+ 0  = SIMPLE_REDIRECT            - simple redirect (including splitfiles)
+ 1  = MULTI_LEVEL_METADATA       - multi-level metadata (fetch this key, then 
use it as metadata)
+ 2  = SIMPLE_MANIFEST            - ordinary manifest
+ 3  = ARCHIVE_MANIFEST           - ZIP/TAR manifest
+ 4  = ARCHIVE_INTERNAL_REDIRECT  - reserved for use in ZIP/TAR manifests, see 
below

-If multi-level metadata:
+If documentType == MULTI_LEVEL_METADATA:
  1 byte - number of levels (must decrease by 1 on each level!)
  1 byte - document type of final metadata
  8 bytes - length of final data

-For a simple redirect, multi-level metadata, or a ZIP manifest:
+If documentType == SIMPLE_REDIRECT or SIMPLE_MANIFEST or ARCHIVE_MANIFEST or 
ARCHIVE_INTERNAL_REDIRECT
+ 2 bytes - flags
+  bit 0 = FLAGS_SPLITFILE          - splitfile
+  bit 1 = FLAGS_DBR                - DBR (splitfile + DBR *is* valid, not 
supported)
+  bit 2 = FLAGS_NO_MIME            - no MIME type
+  bit 3 = FLAGS_COMPRESSED_MIME    - compressed MIME type
+  bit 4 = FLAGS_EXTRA_METADATA     - has extra metadata fields (ignored)
+  bit 5 = FLAGS_FULL_KEYS          - redirects as full keys (invalid if 
splitfile)
+  bit 6 = FLAGS_SPLIT_USE_LENGTHS  - reserved/unused
+  bit 7 = FLAGS_COMPRESSED         - compressed splitfile

-2 bytes - flags
-bit 0 = splitfile
-bit 1 = DBR (splitfile + DBR *is* valid)
-bit 2 = no MIME type
-bit 3 = compressed MIME type
-bit 4 = has extra metadata fields
-bit 5 = redirects as full keys (invalid if splitfile)
-bit 6 = unused
-bit 7 = compressed splitfile (might work with normal redirects but there
-is no point as single blocks are transparently gzipped anyway)
+If documentType == ARCHIVE_MANIFEST:
+  2 bytes - ARCHIVE_TYPE
+   0 = ZIP ("application/zip", "application/x-zip") /* eventually get rid of 
ZIP support at some point */
+   1 = TAR ("application/x-tar")

-If a ZIP manifest:
-2 bytes - archive ID (initially 0 = ZIP. We may in future support 1 =
-tar, with the compressed splitfile bit set, and then a codec specified
-below, for tar.gz, tar.bz2 etc)
+If flags |= FLAGS_SPLITFILE:
+  8 bytes - real content length (compressed size, signed number)

-If a splitfile:
-8 bytes - real content length (uncompressed)
-Note no 2GB limit. :)
+If flags |= FLAGS_COMPRESSED:
+  2 bytes - COMPRESSOR_TYPE
+   0 = GZIP
+   1 = BZIP2
+   2 = LZMA
+  8 bytes - decompressed content length (signed number)

-If compressed:
-2 bytes - codec ID
-Initially we only support gzip (0).
-8 bytes - decompressed content length
+If _NOT_ flags |= FLAGS_NO_MIME:
+ If flags |= FLAGS_COMPRESSED_MIME:
+  2 bytes - compressedMIMEValue (base MIME type IDs)
+       See DefaultMIMETypes.java for the look up table

-If has a MIME type:
-If raw:
-1 byte - length (N)
-N bytes - string
+  If compressedMIMEValue & 0x7fff == 0x7fff:
+       2 bytes - compressedMIMEParams
+ else 
+  1 byte  - length (N)
+  N bytes - MIME Type (UTF-8 String)

-If compressed:
-2 bytes - base MIME type ID; index into lookup table; last bit is not
- part of the lookup index, and defines whether parameters are necessary.
-2 bytes - if parameters are expected, parameters ID (mostly charset= for
- text/ types; other types may define other parameters)
+If flags |= DBR: (not supported yet)
+ 4 bytes - period, in seconds
+ 4 bytes - offset, in seconds

+If flags |= FLAGS_EXTRA_METADATA: (ignored)
+ 2 bytes - number of extra metadata fields
+  For each extra metadata field:
+   2 bytes - metadata field type
+   1 byte  - length
+   N bytes - metadata field specific information

-If DBR:
-4 bytes - period, in seconds
-4 bytes - offset, in seconds

-If has extra metadata fields:
-2 bytes - number of extra metadata fields
+If (!(flags |= FLAGS_SPLITFILE) && ((documentType == SIMPLE_REDIRECT) || 
(documentType == ARCHIVE_MANIFEST)):
+ If FLAGS_FULL_KEYS 
+  1 byte  - length of binary key
+  N bytes - binary key (this is just a compressed FreenetURI, see 
FreenetURI.java)
+ Else 
+  5+32+32 bytes - raw binary form of a CHK

-For each:
-2 bytes - metadata field type
-1 byte - length
-N bytes - metadata field specific information
-
-
-For a simple redirect:
-
-If bit 5 is set above:
-1 byte - length of binary key
-N bytes - binary key (this is just a compressed FreenetURI)
-Else:
-<fixed number yet to be determined> bytes - raw binary form of a CHK
-
 For a splitfile redirect:
 2 bytes - algorithm ID
 0 = no redundancy. Invalid unless bit 6 or 5 above is set.


Property changes on: branches/db4o/freenet/src/freenet/client
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/db4o/src/freenet/client:25594

Modified: branches/db4o/freenet/src/freenet/client/Metadata.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/Metadata.java      2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/Metadata.java      2009-03-18 
00:11:38 UTC (rev 26082)
@@ -25,6 +25,7 @@
 import freenet.client.ArchiveManager.ARCHIVE_TYPE;
 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.api.Bucket;
 import freenet.support.api.BucketFactory;
 import freenet.support.compress.Compressor.COMPRESSOR_TYPE;
@@ -33,7 +34,18 @@

 /** Metadata parser/writer class. */
 public class Metadata implements Cloneable {
+    private static volatile boolean logMINOR;

+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+            }
+        });
+    }
+
        static final long FREENET_METADATA_MAGIC = 0xf053b2842d91482bL;
        static final int MAX_SPLITFILE_PARAMS_LENGTH = 32768;
        /** Soft limit, to avoid memory DoS */
@@ -66,7 +78,7 @@
        /** Keys stored in full (otherwise assumed to be CHKs) */
        boolean fullKeys;
        static final short FLAGS_SPLITFILE = 1;
-       static final short FLAGS_DBR = 2;
+       static final short FLAGS_DBR = 2;       // not supported
        static final short FLAGS_NO_MIME = 4;
        static final short FLAGS_COMPRESSED_MIME = 8;
        static final short FLAGS_EXTRA_METADATA = 16;
@@ -191,7 +203,6 @@
                documentType = dis.readByte();
                if((documentType < 0) || (documentType > 5))
                        throw new MetadataParseException("Unsupported document 
type: "+documentType);
-               boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Document type: "+documentType);

                boolean compressed = false;
@@ -333,7 +344,7 @@

                        // Parse the sub-Manifest.

-                       Logger.minor(this, "Simple manifest, 
"+manifestEntryCount+" entries");
+                       if(logMINOR)Logger.minor(this, "Simple manifest, 
"+manifestEntryCount+" entries");

                        for(int i=0;i<manifestEntryCount;i++) {
                                short nameLength = dis.readShort();

Modified: 
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -33,6 +33,7 @@
 import freenet.node.SendableInsert;
 import freenet.node.SendableRequest;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.PrioritizedSerialExecutor;
 import freenet.support.api.StringCallback;
 import freenet.support.io.NativeThread;
@@ -47,8 +48,18 @@
        private final ClientRequestSchedulerCore schedCore;
        final ClientRequestSchedulerNonPersistent schedTransient;

-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;

+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+                       
+                       @Override
+                       public void shouldUpdate() {
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
+       
        public static class PrioritySchedulerCallback extends StringCallback 
implements EnumerableOptionCallback {
                final ClientRequestScheduler cs;
                private final String[] possibleValues = new String[]{ 
ClientRequestScheduler.PRIORITY_HARD, ClientRequestScheduler.PRIORITY_SOFT };
@@ -137,7 +148,6 @@
                else
                        transientCooldownQueue = null;
                jobRunner = clientContext.jobRunner;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        public static void loadKeyListeners(final ObjectContainer container, 
ClientContext context) {
@@ -259,7 +269,6 @@
         * @throws FetchException 
         */
        public void register(final HasKeyListener hasListener, final 
SendableGet[] getters, final boolean persistent, boolean onDatabaseThread, 
ObjectContainer container, final BlockSet blocks, final boolean noCheckStore) 
throws KeyListenerConstructionException {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, 
"register("+persistent+","+hasListener+","+getters);
                if(isInsertScheduler) {

Modified: branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java 
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/async/OfferedKeysList.java 
2009-03-18 00:11:38 UTC (rev 26082)
@@ -20,6 +20,7 @@
 import freenet.node.SendableRequestSender;
 import freenet.node.NodeClientCore.SimpleRequestSenderCompletionListener;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;

 /**
  * All the keys at a given priority which we have received key offers from 
other nodes for.
@@ -39,7 +40,17 @@

        private final HashSet<Key> keys;
        private final Vector<Key> keysList; // O(1) remove random element the 
way we use it, see chooseKey().
-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
        private final RandomSource random;
        private final short priorityClass;
        private final NodeClientCore core;
@@ -53,13 +64,11 @@
                this.priorityClass = priorityClass;
                this.core = core;
                this.isSSK = isSSK;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        /** Called when a key is found, when it no longer belongs to this list 
etc. */
        public synchronized void remove(Key key) {
                assert(keysList.size() == keys.size());
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(keys.remove(key)) {
                        keysList.remove(key);
                        if(logMINOR) Logger.minor(this, "Found "+key+" , 
removing it "+" for "+this+" size now "+keysList.size());

Modified: 
branches/db4o/freenet/src/freenet/client/async/RequestCooldownQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -11,6 +11,7 @@
 import freenet.node.SendableGet;
 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;

 /**
  * Queue of keys which have been recently requested, which we have 
unregistered for a fixed period.
@@ -34,14 +35,23 @@
        int startPtr;
        /** location next key will be put in (may be < startPtr if wrapped 
around) */
        int endPtr;
-       static boolean logMINOR;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }

        static final int MIN_SIZE = 128;

        final long cooldownTime;

        RequestCooldownQueue(long cooldownTime) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                keys = new Key[MIN_SIZE];
                times = new long[MIN_SIZE];
                clients = new SendableGet[MIN_SIZE];
@@ -72,7 +82,6 @@

        private synchronized void add(Key key, SendableGet client, long 
removeTime) {
                if(holes < 0) Logger.error(this, "holes = "+holes+" !!");
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, "Adding key "+key+" client 
"+client+" remove time "+removeTime+" startPtr="+startPtr+" endPtr="+endPtr+" 
keys.length="+keys.length);
                int ptr = endPtr;
@@ -119,9 +128,8 @@
         */
        public synchronized Object removeKeyBefore(long now, long 
dontCareAfterMillis, ObjectContainer container, int maxKeys) {
                ArrayList v = new ArrayList();
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                boolean foundIT = false;
-               if(Logger.shouldLog(Logger.DEBUG, this)) {
+               if(logDEBUG) {
                        foundIT = bigLog();
                }
                if(logMINOR)
@@ -241,7 +249,6 @@
         */
        public synchronized boolean removeKey(Key key, SendableGet client, long 
time, ObjectContainer container) {
                if(time <= 0) return false; // We won't find it.
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(holes < 0) Logger.error(this, "holes = "+holes+" !!");
                if(logMINOR) Logger.minor(this, "Remove key "+key+" client 
"+client+" at time "+time+" startPtr="+startPtr+" endPtr="+endPtr+" 
holes="+holes+" keys.length="+keys.length);
                int idx = -1;

Modified: branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -444,6 +444,7 @@
                                        if(persistent) container.store(this);
                                        return;
                                }
+                               metadataBucket.free();
                                continue;
                        } else if(metadata.isArchiveInternalRedirect()) {
                                if(logMINOR) Logger.minor(this, "Is 
archive-internal redirect");

Modified: branches/db4o/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/USKFetcher.java      
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/client/async/USKFetcher.java      
2009-03-18 00:11:38 UTC (rev 26082)
@@ -18,6 +18,7 @@
 import freenet.keys.USK;
 import freenet.node.RequestStarter;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.api.Bucket;
 import freenet.support.io.BucketTools;

@@ -64,8 +65,17 @@
  * - Passive requests (when we have passive requests).
  */
 public class USKFetcher implements ClientGetState {
+    private static volatile boolean logMINOR;

-       private static boolean logMINOR;
+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+            }
+        });
+    }

        /** USK manager */
        private final USKManager uskManager;
@@ -232,11 +242,9 @@
                this.ctx = ctx;
                this.backgroundPoll = pollForever;
                this.keepLastData = keepLastData;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        void onDNF(USKAttempt att, ClientContext context) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "DNF: "+att);
                boolean finished = false;
                long curLatest = uskManager.lookup(origUSK);
@@ -313,7 +321,6 @@
        }

        void onSuccess(USKAttempt att, boolean dontUpdate, ClientSSKBlock 
block, final ClientContext context) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                LinkedList<USKAttempt> l = null;
                final long lastEd = uskManager.lookup(origUSK);
                long curLatest;

Modified: 
branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -205,9 +205,10 @@
                        HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "bwForm");
                        HTMLNode result = bandwidthForm.addChild("select", 
"name", "bw");

-                       Option sizeOption = 
config.get("node").getOption("outputBandwidthLimit");
+                       @SuppressWarnings("unchecked")
+                       Option<Integer> sizeOption = (Option<Integer>) 
config.get("node").getOption("outputBandwidthLimit");
                        if(!sizeOption.isDefault()) {
-                               int current = (Integer)sizeOption.getValue();
+                               int current = sizeOption.getValue();
                                result.addChild("option", new String[] { 
"value", "selected" }, new String[] { SizeUtil.formatSize(current), "on" }, 
l10n("currentSpeed")+" "+SizeUtil.formatSize(current)+"/s");
                        }

@@ -245,9 +246,10 @@
                        HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "dsForm");
                        HTMLNode result = bandwidthForm.addChild("select", 
"name", "ds");

-                       Option sizeOption = 
config.get("node").getOption("storeSize");
+                       @SuppressWarnings("unchecked")
+                       Option<Long> sizeOption = (Option<Long>) 
config.get("node").getOption("storeSize");
                        if(!sizeOption.isDefault()) {
-                               long current = (Long)sizeOption.getValue();
+                               long current = sizeOption.getValue();
                                result.addChild("option", new String[] { 
"value", "selected" }, new String[] { SizeUtil.formatSize(current), "on" }, 
l10n("currentPrefix")+" "+SizeUtil.formatSize(current));
                        }
                        result.addChild("option", "value", "512M", "512MiB");

Modified: 
branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -55,34 +55,58 @@
                if(furi != null)
                        extra = "&key="+furi.toASCIIString();

+               File thisPath;
+               
                String path = request.getParam("path");
                if (path.length() == 0) {
                        if (currentPath == null) {
-                               currentPath = new 
File(System.getProperty("user.home"));
+                               currentPath = new 
File(System.getProperty("user.home")); // FIXME what if user.home is denied?
                        }
                        writePermanentRedirect(toadletContext, "Found", 
"?path=" + URLEncoder.encode(currentPath.getAbsolutePath(),true)+extra);
                        return;
                }

-               currentPath = new File(path).getCanonicalFile();
+               thisPath = new File(path).getCanonicalFile();

-               if(!core.allowUploadFrom(currentPath)) {
-                       sendErrorPage(toadletContext, 403, "Forbidden", 
l10n("dirAccessDenied"));
-                       return;
-               }

                PageMaker pageMaker = toadletContext.getPageMaker();

-               HTMLNode pageNode = pageMaker.getPageNode(l10n("listingTitle", 
"path", currentPath.getAbsolutePath()), toadletContext);
-               HTMLNode contentNode = pageMaker.getContentNode(pageNode);
-               if(toadletContext.isAllowedFullAccess())
-                       contentNode.addChild(core.alerts.createSummary());
+               if(!core.allowUploadFrom(thisPath)) {
+                       HTMLNode pageNode = 
pageMaker.getPageNode(l10n("listingTitle", "path", thisPath.getAbsolutePath()), 
toadletContext);
+                       HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);
+                       HTMLNode infoboxE = 
contentNode.addChild(pageMaker.getInfobox("infobox-error",  "Forbidden"));
+                       HTMLNode infoboxEContent = 
pageMaker.getContentNode(infoboxE);
+                       infoboxEContent.addChild("#", l10n("dirAccessDenied"));
+
+                       thisPath = currentPath;
+                       if(!core.allowUploadFrom(thisPath)) {
+                               File[] allowedDirs = 
core.getAllowedUploadDirs();
+                               if(allowedDirs.length == 0) {
+                                       sendErrorPage(toadletContext, 403, 
"Forbidden", l10n("dirAccessDenied"));
+                                       return;
+                               } else {
+                                       thisPath = 
allowedDirs[core.node.fastWeakRandom.nextInt(allowedDirs.length)];
+                               }
+                       }
+               }

-               HTMLNode infoboxDiv = contentNode.addChild("div", "class", 
"infobox");
-               infoboxDiv.addChild("div", "class", "infobox-header", 
l10n("listing", "path",  currentPath.getAbsolutePath()));
-               HTMLNode listingDiv = infoboxDiv.addChild("div", "class", 
"infobox-content");
+               HTMLNode pageNode;

                if (currentPath.exists() && currentPath.isDirectory() && 
currentPath.canRead()) {
+                       // Known safe at this point
+                       currentPath = thisPath;
+
+                       pageNode = pageMaker.getPageNode(l10n("listingTitle", 
"path", currentPath.getAbsolutePath()), toadletContext);
+                       HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);
+                       if(toadletContext.isAllowedFullAccess())
+                               
contentNode.addChild(core.alerts.createSummary());
+                       
+                       HTMLNode infoboxDiv = contentNode.addChild("div", 
"class", "infobox");
+                       infoboxDiv.addChild("div", "class", "infobox-header", 
l10n("listing", "path",  currentPath.getAbsolutePath()));
+                       HTMLNode listingDiv = infoboxDiv.addChild("div", 
"class", "infobox-content");
+
+
+                       
                        File[] files = currentPath.listFiles();
                        Arrays.sort(files, new Comparator<File>() {
                                public int compare(File firstFile, File 
secondFile) {
@@ -154,6 +178,15 @@
                                }
                        }
                } else {
+                       pageNode = pageMaker.getPageNode(l10n("listingTitle", 
"path", currentPath.getAbsolutePath()), toadletContext);
+                       HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);
+                       if(toadletContext.isAllowedFullAccess())
+                               
contentNode.addChild(core.alerts.createSummary());
+                       
+                       HTMLNode infoboxDiv = contentNode.addChild("div", 
"class", "infobox");
+                       infoboxDiv.addChild("div", "class", "infobox-header", 
l10n("listing", "path",  currentPath.getAbsolutePath()));
+                       HTMLNode listingDiv = infoboxDiv.addChild("div", 
"class", "infobox-content");
+
                        listingDiv.addChild("#", l10n("dirCannotBeRead", 
"path", currentPath.getAbsolutePath()));
                        HTMLNode ulNode = listingDiv.addChild("ul");
                        ulNode.addChild("li", l10n("checkPathExist"));

Modified: 
branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2009-03-18 00:11:38 UTC (rev 26082)
@@ -637,16 +637,13 @@
                        synchronized(this) {
                                if(myThread == null) return;
                        }
-                       try {
-                               Socket conn = networkInterface.accept();
-                               if(Logger.shouldLog(Logger.MINOR, this))
-                                       Logger.minor(this, "Accepted 
connection");
-                               SocketHandler sh = new SocketHandler(conn);
-                               sh.start();
-                       } catch (SocketTimeoutException e) {
-                               // Go around again, this introduced to avoid 
blocking forever when told to quit
-                               /* FIXME: WTF? Why does 
networkInterface.accept() not support being interrupted ? */
-                       } 
+                       Socket conn = networkInterface.accept();
+            if(conn == null)
+                continue; // timeout
+            if(Logger.shouldLog(Logger.MINOR, this))
+                Logger.minor(this, "Accepted connection");
+            SocketHandler sh = new SocketHandler(conn);
+            sh.start();
                }
        }


Modified: 
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java    
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java    
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -90,7 +90,7 @@
        }

        public void reAddDefaultBookmarks() {
-               BookmarkCategory bc = new BookmarkCategory("Default bookmarks - 
" + new Date());
+               BookmarkCategory bc = new 
BookmarkCategory(l10n("defaultBookmarks") + " - " + new Date());
                addBookmark("/", bc);
                _innerReadBookmarks("/", bc, DEFAULT_BOOKMARKS);
        }

Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSReadFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/filter/CSSReadFilter.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/filter/CSSReadFilter.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -23,9 +23,8 @@

 public class CSSReadFilter implements ContentDataFilter, CharsetExtractor {

-       public Bucket readFilter(Bucket bucket, BucketFactory bf, String 
charset,
-                       HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-                       IOException {
+       public Bucket readFilter(Bucket bucket, BucketFactory bf, String 
charset, HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                if (Logger.shouldLog(Logger.DEBUG, this))
                        Logger.debug(
                                this,
@@ -67,9 +66,8 @@
                return temp;
        }

-       public Bucket writeFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-                       IOException {
+       public Bucket writeFilter(Bucket data, BucketFactory bf, String 
charset, HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                throw new UnsupportedOperationException();
        }


Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java   
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java   
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.1 on 1/4/09 3:25 PM */
+/* The following code was generated by JFlex 1.4.1 on 2/13/09 11:03 PM */

 /* This code is part of Freenet. It is distributed under the GNU General
  * Public License, version 2 (or at your option any later version). See
@@ -13,12 +13,12 @@
 // just needs somebody to go over the standard carefully and eliminate 
everything that isn't sufficiently specific (e.g. matching a '-' on its own).
 // Mostly from http://www.w3.org/TR/REC-CSS2/grammar.html

- at SuppressWarnings("fallthrough")
+ at SuppressWarnings({ "fallthrough", "unused" })

 /**
  * This class is a scanner generated by 
  * <a href="http://www.jflex.de/";>JFlex</a> 1.4.1
- * on 1/4/09 3:25 PM from the specification file
+ * on 2/13/09 11:03 PM from the specification file
  * <tt>src/freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt>
  */
 class CSSTokenizerFilter {

Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex  
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex  
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -11,7 +11,7 @@
 // just needs somebody to go over the standard carefully and eliminate 
everything that isn't sufficiently specific (e.g. matching a '-' on its own).
 // Mostly from http://www.w3.org/TR/REC-CSS2/grammar.html

- at SuppressWarnings("fallthrough")
+ at SuppressWarnings({ "fallthrough", "unused" })
 %%

 %{

Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/filter/ContentFilter.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -24,7 +24,7 @@
  */
 public class ContentFilter {

-       static final Hashtable mimeTypesByName = new Hashtable();
+       static final Hashtable<String, MIMEType> mimeTypesByName = new 
Hashtable<String, MIMEType>();

        static {
                init();
@@ -106,7 +106,7 @@
        }

        public static MIMEType getMIMEType(String mimeType) {
-               return (MIMEType) mimeTypesByName.get(mimeType);
+               return mimeTypesByName.get(mimeType);
        }

        public static class FilterOutput {
@@ -142,7 +142,7 @@
                String type = typeName;
                String options = "";
                String charset = null;
-               HashMap otherParams = null;
+               HashMap<String, String> otherParams = null;

                // First parse the MIME type

@@ -165,7 +165,8 @@
                                if(before.equals("charset")) {
                                        charset = after;
                                } else {
-                                       if(otherParams == null) otherParams = 
new HashMap();
+                                       if (otherParams == null)
+                                               otherParams = new 
HashMap<String, String>();
                                        otherParams.put(before, after);
                                }
                        }

Modified: branches/db4o/freenet/src/freenet/clients/http/filter/GIFFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/filter/GIFFilter.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/filter/GIFFilter.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -29,9 +29,8 @@
                { (byte)'G', (byte)'I', (byte)'F', (byte)'8', (byte)'9', 
(byte)'a' };


-       public Bucket readFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-                       IOException {
+       public Bucket readFilter(Bucket data, BucketFactory bf, String charset, 
HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                if(data.size() < 6) {
                        throwHeaderError(l10n("tooShortTitle"), 
l10n("tooShort"));
                }
@@ -66,9 +65,8 @@
                                "<p>"+message+"</p>", new 
HTMLNode("p").addChild("#", message));
        }

-       public Bucket writeFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-                       IOException {
+       public Bucket writeFilter(Bucket data, BucketFactory bf, String 
charset, HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                return null;
        }


Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
        2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
        2009-03-18 00:11:38 UTC (rev 26082)
@@ -24,7 +24,7 @@
        public static final HashSet<String> allowedProtocols;

        static {
-               allowedProtocols = new HashSet();
+               allowedProtocols = new HashSet<String>();
                allowedProtocols.add("http");
                allowedProtocols.add("https");
                allowedProtocols.add("ftp");

Modified: branches/db4o/freenet/src/freenet/clients/http/filter/JPEGFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/filter/JPEGFilter.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/filter/JPEGFilter.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -61,9 +61,8 @@
                (byte)'J', (byte)'F', (byte)'X', (byte)'X', 0
        };

-       public Bucket readFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb) 
-       throws DataFilterException, IOException {
+       public Bucket readFilter(Bucket data, BucketFactory bf, String charset, 
HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                Bucket output = readFilter(data, bf, charset, otherParams, cb, 
deleteComments, deleteExif, null);
                if(output != null)
                        return output;
@@ -82,9 +81,9 @@
                return filtered;
        }

-       public Bucket readFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb, boolean 
deleteComments, boolean deleteExif, OutputStream output) 
-       throws DataFilterException, IOException {
+       public Bucket readFilter(Bucket data, BucketFactory bf, String charset, 
HashMap<String, String> otherParams,
+               FilterCallback cb, boolean deleteComments, boolean deleteExif, 
OutputStream output)
+               throws DataFilterException, IOException {
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                long length = data.size();
                if(length < 6) {
@@ -439,9 +438,8 @@
                throw e;
        }

-       public Bucket writeFilter(Bucket data, BucketFactory bf, String charset,
-                       HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-                       IOException {
+       public Bucket writeFilter(Bucket data, BucketFactory bf, String 
charset, HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                return null;
        }


Modified: branches/db4o/freenet/src/freenet/clients/http/filter/PNGFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/clients/http/filter/PNGFilter.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/clients/http/filter/PNGFilter.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -75,9 +75,8 @@
                this.checkCRCs = checkCRCs;
        }

-       public Bucket readFilter(Bucket data, BucketFactory bf, String charset,
-               HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-               IOException {
+       public Bucket readFilter(Bucket data, BucketFactory bf, String charset, 
HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                Bucket output = readFilter(data, bf, charset, otherParams, cb, 
deleteText, deleteTimestamp, checkCRCs, null);
                if(output != null)
                        return output;
@@ -96,9 +95,9 @@
                return filtered;
        }

-       public Bucket readFilter(Bucket data, BucketFactory bf, String charset,
-               HashMap otherParams, FilterCallback cb, boolean deleteText, 
boolean deleteTimestamp, boolean checkCRCs, OutputStream output) throws 
DataFilterException,
-               IOException {
+       public Bucket readFilter(Bucket data, BucketFactory bf, String charset, 
HashMap<String, String> otherParams,
+               FilterCallback cb, boolean deleteText, boolean deleteTimestamp, 
boolean checkCRCs, OutputStream output)
+               throws DataFilterException, IOException {
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                boolean logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
                InputStream is = null;
@@ -161,8 +160,10 @@
                                        if((val >= 65 && val <= 99) || (val >= 
97 && val <= 122)) {
                                                chunkTypeBytes[i] = 
lengthBytes[i];
                                                sb.append(val);
-                                       } else
-                                               throw new IOException("The name 
of the chunk is invalid!");
+                                       } else { 
+                                               String chunkName = 
HexUtil.bytesToHex(lengthBytes, 0, 4);
+                                               throwError("Unknown Chunk"  , 
"The name of the chunk is invalid! (" + chunkName+")");
+                                       }
                                }
                                chunkTypeString = sb.toString();
                                if(logMINOR)
@@ -205,30 +206,30 @@

                                if(!skip && "IHDR".equals(chunkTypeString)) {
                                        if(hasSeenIHDR)
-                                               throw new IOException("Two IHDR 
chunks detected!!");
+                                               throwError("Duplicate IHDR", 
"Two IHDR chunks detected!!");
                                        hasSeenIHDR = true;
                                        validChunkType = true;
                                }

                                if(!hasSeenIHDR)
-                                       throw new IOException("No IHDR chunk!");
+                                       throwError("No IHDR chunk!", "No IHDR 
chunk!");

                                if(!skip && "IEND".equals(chunkTypeString)) {
-                                       if(hasSeenIEND)
-                                               throw new IOException("Two IEND 
chunks detected!!");
+                                       if(hasSeenIEND) // XXX impossible code 
path: it should have throwed as "IEND not last chunk" 
+                                               throwError("Two IEND chunks 
detected!!", "Two IEND chunks detected!!");
                                        hasSeenIEND = true;
                                        validChunkType = true;
                                }

                                if(!skip && 
"PLTE".equalsIgnoreCase(chunkTypeString)) {
                                        if(hasSeenIDAT)
-                                               throw new IOException("PLTE 
must be before IDAT");
+                                               throwError("PLTE must be before 
IDAT", "PLTE must be before IDAT");
                                        validChunkType = true;
                                }

                                if(!skip && 
"IDAT".equalsIgnoreCase(chunkTypeString)) {
                                        if(hasSeenIDAT && 
!"IDAT".equalsIgnoreCase(lastChunkType))
-                                               throw new IOException("Multiple 
IDAT chunks must be consecutive!");
+                                               throwError("Multiple IDAT 
chunks must be consecutive!", "Multiple IDAT chunks must be consecutive!");
                                        hasSeenIDAT = true;
                                        validChunkType = true;
                                }
@@ -242,7 +243,7 @@

                                if(dis.available() < 1) {
                                        if(!(hasSeenIEND && hasSeenIHDR))
-                                               throw new IOException("Missing 
IEND or IHDR!");
+                                               throwError("Missing IEND or 
IHDR!", "Missing IEND or IHDR!");
                                        finished = true;
                                }

@@ -273,8 +274,8 @@
                                }
                                lastChunkType = chunkTypeString;
                        }
-                       if(finished && dis.available() > 0 && output == null)
-                               throw new IOException("IEND not last chunk");
+                       if(hasSeenIEND && dis.available() > 0 && output == null)
+                               throwError("IEND not last chunk", "IEND not 
last chunk");

                        dis.close();
                } finally {
@@ -289,9 +290,8 @@
                return L10n.getString("PNGFilter." + key);
        }

-       public Bucket writeFilter(Bucket data, BucketFactory bf, String charset,
-               HashMap otherParams, FilterCallback cb) throws 
DataFilterException,
-               IOException {
+       public Bucket writeFilter(Bucket data, BucketFactory bf, String 
charset, HashMap<String, String> otherParams,
+               FilterCallback cb) throws DataFilterException, IOException {
                // TODO Auto-generated method stub
                return null;
        }
@@ -315,4 +315,18 @@
                        data.free();
                }
        }
+
+       private void throwError(String shortReason, String reason) throws 
DataFilterException {
+               // Throw an exception
+               String message = "Invalid PNG";
+               if(reason != null) 
+                       message += ' ' + reason;
+               if(shortReason != null)
+                       message += " - " + shortReason;
+               DataFilterException e = new DataFilterException(shortReason, 
shortReason,
+                               "<p>"+message+"</p>", new 
HTMLNode("p").addChild("#", message));
+               if(Logger.shouldLog(Logger.NORMAL, this))
+                       Logger.normal(this, "Throwing "+e, e);
+               throw e;
+       }
 }

Modified: 
branches/db4o/freenet/src/freenet/clients/http/filter/UnsafeContentTypeException.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/filter/UnsafeContentTypeException.java
       2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/filter/UnsafeContentTypeException.java
       2009-03-18 00:11:38 UTC (rev 26082)
@@ -14,6 +14,7 @@
  * Base class for UnknownContentTypeException and 
KnownUnsafeContentTypeException.
  */
 public abstract class UnsafeContentTypeException extends IOException {
+       private static final long serialVersionUID = 1L;

        /**
         * Get the contents of the error page.

Modified: 
branches/db4o/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat
===================================================================
--- 
branches/db4o/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/clients/http/staticfiles/defaultbookmarks.dat 
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -7,26 +7,26 @@
 BookmarkCategory0.Content.Bookmark0.Name=The Ultimate FreeNet Index
 BookmarkCategory0.Content.Bookmark0.Description=A new one-page index with a 
menu including categories
 BookmarkCategory0.Content.Bookmark0.hasAnActivelink=true
-BookmarkCategory0.Content.Bookmark0.URI=USK at 
0I8gctpUE32CM0iQhXaYpCMvtPPGfT4pjXm01oid5Zc,3dAcn4fX2LyxO6uCnWFTx-2HKZ89uruurcKwLSCxbZ4,AQACAAE/Ultimate-Freenet-Index/37/
+BookmarkCategory0.Content.Bookmark0.URI=USK at 
0I8gctpUE32CM0iQhXaYpCMvtPPGfT4pjXm01oid5Zc,3dAcn4fX2LyxO6uCnWFTx-2HKZ89uruurcKwLSCxbZ4,AQACAAE/Ultimate-Freenet-Index/41/
 BookmarkCategory0.Content.Bookmark3.Name=Index des sites Fran?ais
 BookmarkCategory0.Content.Bookmark3.Description=A small French index with 
descriptions
 BookmarkCategory0.Content.Bookmark3.hasAnActivelink=true
-BookmarkCategory0.Content.Bookmark3.URI=USK at 
RJnh1EnvOSPwOWVRS2nyhC4eIQkKoNE5hcTv7~yY-sM,pOloLxnKWM~AL24iDMHOAvTvCqMlB-p2BO9zK96TOZA,AQACAAE/index_fr/77/
+BookmarkCategory0.Content.Bookmark3.URI=USK at 
RJnh1EnvOSPwOWVRS2nyhC4eIQkKoNE5hcTv7~yY-sM,pOloLxnKWM~AL24iDMHOAvTvCqMlB-p2BO9zK96TOZA,AQACAAE/index_fr/88/
 BookmarkCategory0.Content.Bookmark2.Name=Freenet Activelink Index (SLOW: 
graphical index, preloads all the sites, so takes *ages* to load)
 BookmarkCategory0.Content.Bookmark2.hasAnActivelink=true
 BookmarkCategory0.Content.Bookmark2.Description=A graphical freenet index 
(this will take a long time to load as it preloads the sites)
-BookmarkCategory0.Content.Bookmark2.URI=USK at 
qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index/95/
+BookmarkCategory0.Content.Bookmark2.URI=USK at 
qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index/102/
 BookmarkCategory0.Content.Bookmark1.Name=Freenet Activelink Index Text Version 
(a quick-loading non-graphical index site, no porn)
 BookmarkCategory0.Content.Bookmark1.hasAnActivelink=true
 BookmarkCategory0.Content.Bookmark1.Description=Text version of the Activelink 
Index
-BookmarkCategory0.Content.Bookmark1.URI=USK at 
qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index-text/56/
+BookmarkCategory0.Content.Bookmark1.URI=USK at 
qd-hk0vHYg7YvK2BQsJMcUD5QSF0tDkgnnF6lnWUH0g,xTFOV9ddCQQk6vQ6G~jfL6IzRUgmfMcZJ6nuySu~NUc,AQACAAE/activelink-index-text/63/
 BookmarkCategory1.Name=Freenet related software and documentation
 BookmarkCategory1.Content.BookmarkCategory=0
 BookmarkCategory1.Content.Bookmark=5
 BookmarkCategory1.Content.Bookmark0.Name=Freenet Message System
 BookmarkCategory1.Content.Bookmark0.Description=The official freesite of FMS, 
a spam resistant message board system for Freenet
 BookmarkCategory1.Content.Bookmark0.hasAnActivelink=true
-BookmarkCategory1.Content.Bookmark0.URI=USK at 
0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/85/
+BookmarkCategory1.Content.Bookmark0.URI=USK at 
0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fms/94/
 BookmarkCategory1.Content.Bookmark1.Name=Freemail
 BookmarkCategory1.Content.Bookmark1.Description=The official site for Freemail 
- email over Freenet
 BookmarkCategory1.Content.Bookmark1.hasAnActivelink=true
@@ -39,7 +39,7 @@
 BookmarkCategory1.Content.Bookmark3.Name=Freesite HOWTO
 BookmarkCategory1.Content.Bookmark3.Description=A more detailed explanation of 
publishing freesites
 BookmarkCategory1.Content.Bookmark3.hasAnActivelink=true
-BookmarkCategory1.Content.Bookmark4.URI=USK at 
ugb~uuscsidMI-Ze8laZe~o3BUIb3S50i25RIwDH99M,9T20t3xoG-dQfMO94LGOl9AxRTkaz~TykFY-voqaTQI,AQACAAE/FAFS/44/
+BookmarkCategory1.Content.Bookmark4.URI=USK at 
ugb~uuscsidMI-Ze8laZe~o3BUIb3S50i25RIwDH99M,9T20t3xoG-dQfMO94LGOl9AxRTkaz~TykFY-voqaTQI,AQACAAE/FAFS/47/
 BookmarkCategory1.Content.Bookmark4.hasAnActivelink=true
 BookmarkCategory1.Content.Bookmark4.Name=The Freenet Applications Freesite
 BookmarkCategory1.Content.Bookmark4.Description=Various links to Freenet 
applications, and instructions for using them

Modified: branches/db4o/freenet/src/freenet/crypt/Yarrow.java
===================================================================
--- branches/db4o/freenet/src/freenet/crypt/Yarrow.java 2009-03-17 23:32:40 UTC 
(rev 26081)
+++ branches/db4o/freenet/src/freenet/crypt/Yarrow.java 2009-03-18 00:11:38 UTC 
(rev 26082)
@@ -23,6 +23,7 @@
 import java.util.Properties;

 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.io.Closer;

 /**
@@ -52,6 +53,15 @@
 public class Yarrow extends RandomSource {

        private static final long serialVersionUID = -1;
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
        /**
         * Security parameters
         */
@@ -535,7 +545,6 @@
                if(performedPoolReseed && (seedfile != null)) {
                        //Dont do this while synchronized on 'this' since
                        //opening a file seems to be suprisingly slow on windows
-                       boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        if(logMINOR)
                                Logger.minor(this, "Writing seedfile");
                        write_seed(seedfile);

Modified: branches/db4o/freenet/src/freenet/io/NetworkInterface.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/NetworkInterface.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/NetworkInterface.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -32,6 +32,7 @@
 import freenet.io.AddressIdentifier.AddressType;
 import freenet.support.Executor;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;

 /**
  * Replacement for {@link ServerSocket} that can handle multiple bind addresses
@@ -42,6 +43,16 @@
  */
 public class NetworkInterface implements Closeable {

+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+            @Override
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
         public static final String DEFAULT_BIND_TO = 
"127.0.0.1,0:0:0:0:0:0:0:1";

        /** Object for synchronisation purpose. */
@@ -184,22 +195,21 @@
         * {@link SocketTimeoutException}. If no timeout has been set this 
method
         * will wait until a connection has been established.
         * 
-        * @return The socket that is connected to the client
-        * @throws SocketTimeoutException
-        *             if the timeout has expired waiting for a connection
+        * @return The socket that is connected to the client or null
+     * if the timeout has expired waiting for a connection
         */
-       public Socket accept() throws SocketTimeoutException {
+       public Socket accept() {
                synchronized (syncObject) {
                        while (acceptedSockets.size() == 0) {
                                if (acceptors.size() == 0) {
-                                       throw new SocketTimeoutException();
+                                       return null;
                                }
                                try {
                                        syncObject.wait(timeout);
                                } catch (InterruptedException ie1) {
                                }
                                if ((timeout > 0) && (acceptedSockets.size() == 
0)) {
-                                       throw new SocketTimeoutException();
+                                       return null;
                                }
                        }
                        return acceptedSockets.remove(0);
@@ -297,7 +307,6 @@
                public void run() {
                    freenet.support.Logger.OSThread.logPID(this);
                        while (!closed) {
-                               boolean logMINOR = 
Logger.shouldLog(Logger.MINOR, this);
                                try {
                                        Socket clientSocket = 
serverSocket.accept();
                                        InetAddress clientAddress = 
clientSocket.getInetAddress();

Modified: branches/db4o/freenet/src/freenet/io/comm/DisconnectedException.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/DisconnectedException.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/DisconnectedException.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -10,4 +10,9 @@
  */
 public class DisconnectedException extends Exception {
        private static final long serialVersionUID = -1;
+
+    @Override
+    public final synchronized Throwable fillInStackTrace() {
+        return null;
+    }
 }

Modified: branches/db4o/freenet/src/freenet/io/comm/FreenetInetAddress.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/FreenetInetAddress.java   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/FreenetInetAddress.java   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -369,6 +369,13 @@
                }
        }

+       /**
+        * Get a new <code>FreenetInetAddress</code> with host name removed.
+        * 
+        * @return a new <code>FreenetInetAddress</code> with host name 
removed; or {@code null} if no
+        *         known ip address is associated with this object. You may 
want to do a
+        *         <code>getAddress(true)</code> before calling this.
+        */
        public FreenetInetAddress dropHostname() {
                if(_address == null) {
                        Logger.error(this, "Can't dropHostname() if no 
address!");

Modified: branches/db4o/freenet/src/freenet/io/comm/Message.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/Message.java      2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/Message.java      2009-03-18 
00:11:38 UTC (rev 26082)
@@ -32,6 +32,7 @@
 import freenet.support.ByteBufferInputStream;
 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Serializer;
 import freenet.support.ShortBuffer;

@@ -43,7 +44,18 @@
 public class Message {

     public static final String VERSION = "$Id: Message.java,v 1.11 2005/09/15 
18:16:04 amphibian Exp $";
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;

+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
+
        private final MessageType _spec;
        private final WeakReference<? extends PeerContext> _sourceRef;
        private final boolean _internal;
@@ -59,13 +71,12 @@

        private static Message decodeMessage(ByteBufferInputStream bb, 
PeerContext peer, int recvByteCount,
                boolean mayHaveSubMessages, boolean inSubMessage) {
-               boolean logMINOR = Logger.shouldLog(Logger.MINOR, 
Message.class);
                MessageType mspec;
         try {
             mspec = MessageType.getSpec(Integer.valueOf(bb.readInt()));
         } catch (IOException e1) {
-               if(Logger.shouldLog(Logger.DEBUG, Message.class))
-                       Logger.minor(Message.class,"Failed to read message 
type: "+e1, e1);
+               if(logDEBUG)
+                       Logger.debug(Message.class,"Failed to read message 
type: "+e1, e1);
             return null;
         }
         if (mspec == null) {
@@ -214,8 +225,8 @@
 //             if (this.getSpec() != MessageTypes.ping && this.getSpec() != 
MessageTypes.pong)
 //             Logger.logMinor("<<<<< Send message : " + this);

-       if(Logger.shouldLog(Logger.DEBUG, Message.class))
-               Logger.minor(this, "My spec code: 
"+_spec.getName().hashCode()+" for "+_spec.getName());
+       if(logDEBUG)
+               Logger.debug(this, "My spec code: 
"+_spec.getName().hashCode()+" for "+_spec.getName());
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                DataOutputStream dos = new DataOutputStream(baos);
                try {
@@ -243,8 +254,8 @@
                }

                byte[] buf = baos.toByteArray();
-       if(Logger.shouldLog(Logger.DEBUG, Message.class))
-               Logger.minor(this, "Length: "+buf.length+", hash: 
"+Fields.hashCode(buf));
+       if(logDEBUG)
+               Logger.debug(this, "Length: "+buf.length+", hash: 
"+Fields.hashCode(buf));
                return buf;
        }

@@ -339,4 +350,4 @@
                return System.currentTimeMillis() - localInstantiationTime;
        }

-}
\ No newline at end of file
+}

Modified: branches/db4o/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/MessageCore.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/MessageCore.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -28,12 +28,24 @@
 import freenet.node.PeerNode;
 import freenet.node.Ticker;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.TimeUtil;

 public class MessageCore {

        public static final String VERSION = "$Id: MessageCore.java,v 1.22 
2005/08/25 17:28:19 amphibian Exp $";
-       private static boolean logMINOR; 
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
+
        private Dispatcher _dispatcher;
        /** _filters serves as lock for both */
        private final LinkedList<MessageFilter> _filters = new 
LinkedList<MessageFilter>();
@@ -50,7 +62,6 @@

        public MessageCore() {
                _timedOutFilters = new Vector<MessageFilter>(32);
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        /**
@@ -97,7 +108,6 @@
      * Remove timed out filters.
      */
        void removeTimedOutFilters() {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                long tStart = System.currentTimeMillis() + 1;
                // Extra millisecond to give waitFor() a chance to remove the 
filter.
                // Avoids exhaustive and unsuccessful search in waitFor() 
removal of a timed out filter.
@@ -292,7 +302,6 @@
        }

        public void addAsyncFilter(MessageFilter filter, 
AsyncMessageFilterCallback callback) throws DisconnectedException {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                filter.setAsyncCallback(callback);
                if(filter.matched()) {
                        Logger.error(this, "addAsyncFilter() on a filter which 
is already matched: "+filter, new Exception("error"));
@@ -372,9 +381,7 @@
         * @throws DisconnectedException If the single peer being waited for 
disconnects.
         */
        public Message waitFor(MessageFilter filter, ByteCounter ctr) throws 
DisconnectedException {
-               boolean logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
                if(logDEBUG) Logger.debug(this, "Waiting for "+filter);
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                long startTime = System.currentTimeMillis();
                if(filter.matched()) {
                        Logger.error(this, "waitFor() on a filter which is 
already matched: "+filter, new Exception("error"));

Modified: branches/db4o/freenet/src/freenet/io/comm/NotConnectedException.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/NotConnectedException.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/NotConnectedException.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -24,4 +24,8 @@
                initCause(e);
        }

+    @Override
+    public final synchronized Throwable fillInStackTrace() {
+        return null;
+    }
 }

Modified: branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/comm/RetrievalException.java   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -101,4 +101,9 @@
        public String getMessage() {
                return toString();
        }
+
+    @Override
+    public final synchronized Throwable fillInStackTrace() {
+        return null;
+    }
 }

Modified: branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/xfer/BlockReceiver.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -36,7 +36,6 @@
 import freenet.support.Buffer;
 import freenet.support.Logger;
 import freenet.support.math.MedianMeanRunningAverage;
-import freenet.support.math.TrivialRunningAverage;

 /**
  * @author ian
@@ -144,7 +143,7 @@
                                Buffer data = (Buffer) m1.getObject(DMT.DATA);
                                _prb.addPacket(packetNo, data);
                                // Remove it from rrmp if its in there
-                               
_recentlyReportedMissingPackets.remove(Integer.valueOf(packetNo));
+                               
_recentlyReportedMissingPackets.remove(packetNo);
                                // Check that we have what the sender thinks we 
have
                                LinkedList<Integer> missing = new 
LinkedList<Integer>();
                                for (int x = 0; x < sent.getSize(); x++) {

Modified: branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java     
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/xfer/BlockTransmitter.java     
2009-03-18 00:11:38 UTC (rev 26082)
@@ -37,7 +37,6 @@
 import freenet.support.TimeUtil;
 import freenet.support.io.NativeThread;
 import freenet.support.math.MedianMeanRunningAverage;
-import freenet.support.math.TrivialRunningAverage;

 /**
  * @author ian

Modified: branches/db4o/freenet/src/freenet/io/xfer/PacketThrottle.java
===================================================================
--- branches/db4o/freenet/src/freenet/io/xfer/PacketThrottle.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/io/xfer/PacketThrottle.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -26,9 +26,20 @@
 import freenet.io.comm.PeerContext;
 import freenet.node.SyncSendWaitedTooLongException;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;

 public class PacketThrottle {

+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
+
        protected static final double PACKET_DROP_DECREASE_MULTIPLE = 0.875;
        protected static final double PACKET_TRANSMIT_INCREMENT = (4 * (1 - 
(PACKET_DROP_DECREASE_MULTIPLE * PACKET_DROP_DECREASE_MULTIPLE))) / 3;
        protected static final double SLOW_START_DIVISOR = 3.0;
@@ -54,13 +65,11 @@
        /** The number of would-be packets which are no longer waiting in line 
for the transmition window */
        private long _abandonedTickets;

-       private static boolean logMINOR;
        private PacketThrottle _deprecatedFor;

        public PacketThrottle(Peer peer, int packetSize) {
                _peer = peer;
                PACKET_SIZE = packetSize;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        public synchronized void setRoundTripTime(long rtt) {
@@ -69,7 +78,6 @@
        }

     public synchronized void notifyOfPacketLost() {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                _droppedPackets++;
                _totalPackets++;
                _simulatedWindowSize *= PACKET_DROP_DECREASE_MULTIPLE;
@@ -80,7 +88,6 @@
     }

     public synchronized void notifyOfPacketAcknowledged() {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
         _totalPackets++;
                // If we didn't use the whole window, shrink the window a bit.
                // This is similar but not identical to RFC2861
@@ -105,7 +112,7 @@
        }
        if(_simulatedWindowSize > (windowSize + 1))
                notifyAll();
-       if(Logger.shouldLog(Logger.MINOR, this))
+       if(logMINOR)
                Logger.minor(this, "notifyOfPacketAcked(): "+this);
     }

@@ -150,7 +157,6 @@
                long start = System.currentTimeMillis();
                long bootID = peer.getBootID();
                synchronized(this) {
-                       logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        long thisTicket=_packetTicketGenerator++;
                        // FIXME a list, or even a TreeMap by deadline, would 
use less CPU than waking up every waiter twice whenever a packet is acked.
                        while(true) {

Modified: branches/db4o/freenet/src/freenet/keys/ClientCHK.java
===================================================================
--- branches/db4o/freenet/src/freenet/keys/ClientCHK.java       2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/keys/ClientCHK.java       2009-03-18 
00:11:38 UTC (rev 26082)
@@ -133,7 +133,7 @@
        public byte[] getExtra() {
                byte[] extra = new byte[EXTRA_LENGTH];
                extra[0] = (byte) (cryptoAlgorithm >> 8);
-               extra[1] = (byte) cryptoAlgorithm;
+               extra[1] = cryptoAlgorithm;
                extra[2] = (byte) (controlDocument ? 2 : 0);
                extra[3] = (byte) (compressionAlgorithm >> 8);
                extra[4] = (byte) compressionAlgorithm;

Modified: branches/db4o/freenet/src/freenet/keys/FreenetURI.java
===================================================================
--- branches/db4o/freenet/src/freenet/keys/FreenetURI.java      2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/keys/FreenetURI.java      2009-03-18 
00:11:38 UTC (rev 26082)
@@ -567,6 +567,7 @@
     /**
      * @deprecated Use {@link #toASCIIString()} instead
      */
+       @Deprecated
     public String toACIIString() {
         return toASCIIString();
     }
@@ -910,4 +911,16 @@

                return new FreenetURI("USK", siteName, metaStr, routingKey, 
cryptoKey, extra, edition);
        }
+       
+       public long getEdition() {
+               if(keyType.equalsIgnoreCase("USK"))
+                       return suggestedEdition;
+               else if(keyType.equalsIgnoreCase("SSK")) {
+                       if (!docName.matches(".*\\-[0-9]+")) /* Taken from 
uskForSSK, also modify there if necessary */
+                               throw new IllegalStateException();
+                       
+                       return 
Long.valueOf(docName.substring(docName.lastIndexOf('-') + 1, docName.length()));
+               } else
+                       throw new IllegalStateException();
+       }
 }

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.de.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -56,6 +56,7 @@
 BookmarkItem.bookmarkUpdatedWithLink=Die in den Lesezeichen gespeicherte Seite 
${link}${name}${/link} wurde auf die Ausgabe ${edition} aktualisiert.
 BookmarkItem.deleteBookmarkUpdateNotification=Benachrichtigung l?schen
 BookmarkItem.unnamedBookmark=Unbenanntes Lesezeichen
+BookmarkManager.defaultBookmarks=Standard-Lesezeichen
 BookmarkManager.list=Liste von Lesezeichen
 BookmarkManager.listLong=Eine Liste von Lesezeichen von Freesites
 BookmarkManager.malformedBookmark=Missgebildetes Lesezeichen
@@ -422,6 +423,8 @@
 FileOffer.succeededReceiveTitle=Datei erfolgreich empfangen
 FirstTimeWizardToadlet.bandwidthLimit=Bandbreiten-Limits
 FirstTimeWizardToadlet.bandwidthLimitLong=Bitte w?hlen Sie Ihren 
Internet-Verbindungs-Typ und -Geschwindigkeit (Download/Upload) aus der unten 
befindlichen Dropdown-Liste. Wenn Sie einen DSL-1000- oder DSL-2000-Anschluss 
besitzen, w?hlen sie bitte "512+/128kbps" aus. Bei einer besseren Anbindung 
k?nnen sie die Standardeinstellung ?bernehmen oder bei sehr schneller Anbindung 
entsprechend ausw?hlen.
+FirstTimeWizardToadlet.browserWarningPageTitle=Sie sollten einen seperaten 
Browser f?r Freenet benutzen!
+FirstTimeWizardToadlet.browserWarningShort=Sie sollten einen seperaten Browser 
f?r Freenet benutzen!
 FirstTimeWizardToadlet.bwlimitHigherSpeed=h?here Geschwindigkeit
 FirstTimeWizardToadlet.bwlimitLowerSpeed=niedrigere Geschwindigkeit
 FirstTimeWizardToadlet.chooseNodeName=Knoten-Name ben?tigt!
@@ -720,7 +723,8 @@
 Node.storeDirectory=Speicher-Verzeichnis
 Node.storeDirectoryLong=Name des Verzeichnisses in welchem die 
Speicher-Dateien platziert werden
 Node.storeMaxMemTooHigh=Mehr als 80% Ihres RAMs (Hauptspeichers) an BDB 
(Datenbank) abzugeben ist wahrscheinlich nicht das was Sie tun wollen!
-Node.storePreallocate=Speicherplatz f?r Datenbank vorbelegen
+Node.storePreallocate=Speicherplatz f?r Datenbank reservieren
+Node.storePreallocateLong=Reserviere den Platz f?r die Datenbank
 Node.storeSaltHashMigrated=Migration der Datenbank abgeschlossen! Wenn sie 
m?chten, k?nnen sie nun die Dateien der alten Datenbank l?schen:
 Node.storeSaltHashMigratedShort=Migration der Datenbank abgeschlossen!
 Node.storeSaltHashResizeOnStart=Ver?ndere die Speichergr??e beim Knotenstart 
(Nur beim salt-hash)
@@ -1123,6 +1127,8 @@
 SecurityLevels.physicalThreatLevel.name.LOW=NIEDRIG
 SecurityLevels.physicalThreatLevel.name.NORMAL=NORMAL
 ShortOption.parseError=Kann den Wert nicht als String-Array 
(Zeichenfolgen-Feld) erkennen: ${error}
+SimpleHelpToadlet.connectivityTitle=Erreichbarkeit
+SimpleHelpToadlet.definitionsTitle=Definitionen
 SimpleHelpToadlet.descriptionTitle=Beschreibung
 SimpleToadletServer.advancedMode=Erweiterten Modus aktivieren?
 SimpleToadletServer.advancedModeLong=Aktiviert die standardm??ige Anzeige von 
erweiterten Einstellungen und Informationen in der Web-Oberfl?che. Diese 
Einstellung sollte in den meisten F?llen auf "nein" stehen.

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.en.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -57,6 +57,7 @@
 BookmarkItem.bookmarkUpdatedShort=Bookmarked freesite updated: ${name}
 BookmarkItem.deleteBookmarkUpdateNotification=Delete notification
 BookmarkItem.unnamedBookmark=Unnamed Bookmark
+BookmarkManager.defaultBookmarks=Default bookmarks
 BookmarkManager.list=List of bookmarks
 BookmarkManager.listLong=A list of bookmarked freesites
 BookmarkManager.malformedBookmark=Malformed Bookmark

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.es.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.es.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.es.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -78,8 +78,10 @@
 ConfigToadlet.contributeTranslation=Contribuir a la traducci?n
 ConfigToadlet.defaultIs=El valor predefinido para esta opci?n es: '${default}'.
 ConfigToadlet.fullTitle=Configuraci?n del nodo ${name}
+ConfigToadlet.needRestart=Algunas configuraciones necesitan que el nodo sea 
reiniciado para tomar efecto
 ConfigToadlet.possibilitiesTitle=Posibilidades
 ConfigToadlet.reset=Reiniciar
+ConfigToadlet.restartNode=Reiniciar ahora
 ConfigToadlet.returnToNodeConfig=Regresar a la configuraci?n del nodo
 ConfigToadlet.shortTitle=Configuraci?n
 ConfigToadlet.ssl=SSL (requiere reiniciar)
@@ -104,6 +106,7 @@
 ConnectivityToadlet.localRemoteTitle=Local/Remoto
 ConnectivityToadlet.noreply=SIN RESPUESTA
 ConnectivityToadlet.remote=REMOTO
+ConnectivityToadlet.sentReceivedTitle=Paquetes Enviados/Recibidos
 ConnectivityToadlet.summaryTitle=Conectividad
 ConnectivityToadlet.title=Conectividad a internet de ${nodeName}
 ContentDataFilter.unknownCharset=La p?gina que se va a mostrar tiene un juego 
de caracteres desconocido. Esto significa que no se ha podido filtrar la 
p?gina, lo cual puede comprometer su anonimato.
@@ -191,6 +194,7 @@
 DarknetConnectionsToadlet.referenceCopyWarning=La referencia del nodo debe 
copiarse ${bold}TAL CUAL${/bold}. Modificarla la ${bold}inutilizar?${/bold}.
 DarknetConnectionsToadlet.remove=?Eliminar!
 DarknetConnectionsToadlet.removePeers=Eliminar contactos seleccionados
+DarknetConnectionsToadlet.seedServers=Nodos que estamos usando como seednodes.
 DarknetConnectionsToadlet.selectAction=-- Seleccione acci?n --
 DarknetConnectionsToadlet.sendMessageTitle=Enviar mensaje de texto entre nodos
 DarknetConnectionsToadlet.sendMessageToPeers=Enviar mensaje de texto (N2NTM) a 
los contactos seleccionados
@@ -234,6 +238,7 @@
 FProxyToadlet.friendsTitle=Amigos
 FProxyToadlet.goBack=Retroceder
 FProxyToadlet.goBackToPrev=Volver a la p?gina anterior
+FProxyToadlet.help=Ayuda
 FProxyToadlet.invalidKeyTitle=Clave inv?lida
 FProxyToadlet.invalidKeyWithReason=Clave inv?lida: ${reason}
 FProxyToadlet.largeFile=Documento grande
@@ -257,7 +262,7 @@
 FProxyToadlet.plugins=configure y utilice los complementos
 FProxyToadlet.pluginsTitle=Complementos
 FProxyToadlet.queue=peticiones en cola
-FProxyToadlet.queueTitle=Cola
+FProxyToadlet.queueTitle=Descargas y Subidas
 FProxyToadlet.retryNow=Reintentar ahora mismo
 FProxyToadlet.sizeLabel=Tama?o:
 FProxyToadlet.sizeUnknown=Tama?o: desconocido
@@ -266,7 +271,7 @@
 FProxyToadlet.unableToRetrieve=Freenet no ha podido recuperar este documento.
 FProxyToadlet.unknownMIMEType=Tipo MIME: desconocido
 FProxyToadlet.welcome=P?gina de bienvenida
-FProxyToadlet.welcomeTitle=Principal
+FProxyToadlet.welcomeTitle=Navegar
 FcpServer.allowedHosts=M?quinas admitidas (?lea la advertencia!)
 FcpServer.allowedHostsFullAccess=M?quinas con acceso total
 FcpServer.allowedHostsFullAccessLong=Direcciones IP desde las que se tiene 
control total sobre el nodo. Clientes provenientes de esas direcciones pueden 
reiniciar el nodo, reconfigurarlo, etc. Note que TODOS los clientes mencionados 
pueden leer/escribir en el disco duro.
@@ -375,6 +380,7 @@
 FileOffer.succeededReceiveTitle=Documento recibido con ?xito
 FirstTimeWizardToadlet.bandwidthLimit=L?mites de ancho de banda
 FirstTimeWizardToadlet.bandwidthLimitLong=Por favor, seleccione su tipo de 
conexi?n y velocidad de acceso en el men? desplegable a continuaci?n.
+FirstTimeWizardToadlet.browserWarningShort=Deberias usar un navegador solo 
para Freenet!
 FirstTimeWizardToadlet.bwlimitHigherSpeed=maxima velocidad
 FirstTimeWizardToadlet.bwlimitLowerSpeed=m?nima velocidad
 FirstTimeWizardToadlet.chooseNodeName=?Hace falta un nombre para el nodo!
@@ -386,19 +392,24 @@
 FirstTimeWizardToadlet.connectToStrangersLong=Si permite a Freenet conectarse 
con desconocidos, Freenet ser? menos seguro para usted. Cualquiera podr? 
averiguar que usted usa Freenet, y entes enemigos podr?n conectarse a este 
nodo. Si no lo permite, tendr? que conectarse manualmente con al menos tres 
Amigos (personas de su confianza) que ya est?n usando Freenet.
 FirstTimeWizardToadlet.continue=Continuar
 FirstTimeWizardToadlet.continueEnd=Clickea aqui para comenzar a usar Freenet!
+FirstTimeWizardToadlet.currentPrefix=Tamano actual:
+FirstTimeWizardToadlet.currentSpeed=Limite actual:
 FirstTimeWizardToadlet.datastoreSize=Tama?o del almac?n de datos
 FirstTimeWizardToadlet.datastoreSizeLong=Por favor, seleccione el tama?o del 
almac?n de datos. Este almac?n act?a como una cach?; al guardar datos de la red 
favorece que las transferencias sean m?s r?pidas al solicitarse documentos 
populares. Cuanto m?s espacio pueda dedicar, m?s se beneficiar? la comunidad y 
m?s r?pido funcionar? este nodo.
 FirstTimeWizardToadlet.enableOpennet=?Conectarse autom?ticamente a nodos 
desconocidos no de confianza?
 FirstTimeWizardToadlet.fivePercentDisk=(= 5% del espacio libre en disco)
+FirstTimeWizardToadlet.friendsSecurityPageTitle=Ayudante de configuracion - 
Configuraciones de seguridad para mis nodos amigos
 FirstTimeWizardToadlet.homepageTitle=?Asistente para la primera vez en Freenet!
 FirstTimeWizardToadlet.iDoTrust=?Conf?a en las conexiones desde ${interface} 
(${ip}) ?
 FirstTimeWizardToadlet.isNetworkTrusted=?Es de confianza la red local?
 FirstTimeWizardToadlet.isNetworkTrustedLong=?Es de confianza la red local? Si 
responde que s?, todos los servicios proporcionados por el nodo estar?n 
abiertos a cualquiera que los solicite desde dicha red. Puede configurar 
controles de acceso m?s espec?ficos en la p?gina de configuraci?n cuando 
termine con el asistente.
 FirstTimeWizardToadlet.memoryLimit=Uso de memoria
+FirstTimeWizardToadlet.networkSecurityPageTitle=Asistente de configuracion! - 
Configuracion de seguridad de la red
 FirstTimeWizardToadlet.noNetworkIF=No se han encontrado interfaces de red 
adicionales
 FirstTimeWizardToadlet.noNetworkIFLong=Freenet no ha encontrado ninguna 
interfaz de red adicional. Se asumir? que s?lo va a conectarse al nodo desde 
este computador.
 FirstTimeWizardToadlet.opennetNo=Tengo al menos 5 amigos que usan Freenet y 
voy a agregar sus datos en la pagina de Amigos.
 FirstTimeWizardToadlet.opennetYes=Quiero que el nodo encuentre personas 
(desconocidos) a los cuaales conectarse automaticamente.
+FirstTimeWizardToadlet.physicalSecurityPageTitle=Ayudante de Freenet! - 
Configuraciones de seguridad fisica
 FirstTimeWizardToadlet.skipWizard=?No soy un novato, omita el asistente!
 FirstTimeWizardToadlet.step1Title=?Asistente para la primera vez en Freenet! - 
Amigos y desconocidos
 FirstTimeWizardToadlet.step2Title=?Asistente para la primera vez en Freenet! - 
D? nombre al nodo
@@ -414,6 +425,7 @@
 FirstTimeWizardToadlet.memory.128M=128MiB - lo minimo
 FirstTimeWizardToadlet.memory.192M=192MiB - razonable
 FirstTimeWizardToadlet.memory.256M=256MiB - si tenes al menos 1GiB de memoria 
RAM
+FirstTimeWizardToadlet.memory.512M=512MiB - si tenes mucha RAM
 FirstTimeWizardToadlet.memory.64M=64MiB - solo si tenes muy poca memoria
 GIFFilter.invalidHeader=El documento no comienza con una cabecera GIF v?lida.
 GIFFilter.invalidHeaderTitle=Cabecera inv?lida
@@ -438,8 +450,10 @@
 IPDetectorPluginManager.connectionProblems=Problemas de conecci?n:
 IPDetectorPluginManager.direct=Parece estar conectado directamente a internet. 
Enhorabuena, deber?a poder conectar con cualquier otro nodo de Freenet.
 IPDetectorPluginManager.directTitle=Se ha detectado que la conexi?n a internet 
es directa
+IPDetectorPluginManager.forwardPortShortMaybeForwarded=Redirigi el puerto UDP 
${port} (quiza ya lo hiciste, pero al nodo le cuesta detectarlo).
 IPDetectorPluginManager.fullCone=Su conexi?n parece estar tras un enrutador de 
tipo "full cone NAT". Enhorabuena, el nodo deber?a ser capaz de conectarse a 
cualquier otro nodo de Freenet.
 IPDetectorPluginManager.fullConeTitle=Se ha detectado una conexi?n de tipo 
'Full cone NAT'
+IPDetectorPluginManager.maybeAlreadyForwarded=Quiza ya lo hiciste (pero es 
dificil para Freenet detectarlo).
 IPDetectorPluginManager.noConnectivity=Su conexi?n a internet parece no 
soportar UDP. A no ser que esta detecci?n sea err?nea, es improbable que 
Freenet pueda funcionar en esta m?quina por el momento.
 IPDetectorPluginManager.noConnectivityTitle=No hay conectividad UDP
 IPDetectorPluginManager.noConnectivityshort=Problemas graves de conecci?n: no 
hay conectividad UDP, Freenet will no va a funcionar!
@@ -456,6 +470,7 @@
 IPUndetectedUserAlert.detecting=Freenet est? intentando detectar su direcci?n 
IP externa. Si tarda m?s de unos minutos, entonces algo no ha funcionado 
correctamente...
 IPUndetectedUserAlert.detectingShort=Freenet esta intentando detectar tu 
direccion IP externa
 IPUndetectedUserAlert.detectingWithConfigLink=Freenet est? intentando detectar 
su direcci?n IP externa. Si esto tarda m?s de unos minutos, entonces algo no ha 
funcionado y usted puede user la opci?n 'sugerencia de IP transitoria' 
${link}configuration parameter${/link}. Adem?s, ser?a conveniente redirigir el 
puerto UDP ${port} en el router a su direcci?n local para facilitar la conexi?n 
del nodo.
+IPUndetectedUserAlert.noDetectorPlugins=Freenet no puede detectar tu direccion 
IP! Proba cargando los complementos UPnP y JSTUN!
 IPUndetectedUserAlert.suggestForwardPort=Ser?a tambi?n una buena idea 
redirigir el puerto ${port} (UDP) en el router para facilitar la conexi?n del 
nodo
 IPUndetectedUserAlert.suggestForwardTwoPorts=Ser?a tambi?n una buena idea 
redirigir los puertos ${port1} y ${port2} (UDP) en el router para facilitar la 
conexi?n del nodo.
 IPUndetectedUserAlert.unknownAddress=Freenet no ha podido detectar su 
direcci?n IP externa (o la del cortafuegos o NAT). A?n as?, usted puede 
intercambiar referencias con otras personas, aunque ?stas s?lo funcionaran si 
ellos no est?n tras un cortafuegos o NAT. Tan pronto como consiga una conexi?n 
de este modo, Freenet podr? determinar su IP externa. Si usted la conoce, puede 
indicarla en la opci?n 'sugerencia de IP transitoria' ${link}configuration 
parameter${/link}. Adem?s, ser?a conveniente redirigir el puerto UDP ${port} en 
su enrutador a su direcci?n local para facilitar la conexi?n del nodo.
@@ -580,6 +595,7 @@
 Node.dropPacketEveryLong=Frecuencia de descarte de paquetes. Opci?n de prueba 
que los desarrolladores emplean para simular p?rdidas de paquetes. Cero 
significa nunca descartar artificialmente un paquete. ?No toque esto!
 Node.enableARKs=Activar ARKs? (NO DESACTIVAR!)
 Node.enableARKsLong=Activar ARKs? (NO DESACTIVAR!).
+Node.enableOpennetFailedTitle=Error al activar opennet
 Node.errorApplyingConfig=Error al aplicar la nueva configuraci?n : ${error}
 Node.extraPeerDir=Carpeta para datos extra de los contactos
 Node.extraPeerDirLong=Nombre de la carpeta en la que guardar datos adicionales 
de los nodos conectados
@@ -616,8 +632,11 @@
 Node.storeDirectory=Carpeta del almac?n de datos (store)
 Node.storeDirectoryLong=Ruta de la carpeta en la que guardar el almac?n de 
datos
 Node.storeMaxMemTooHigh=?Dar m?s del 80% de la RAM a BDB no es probablemente 
una buena idea!
+Node.storeSaltHashMigrated=Ha terminado la migracion del almacen de datos, ya 
puede borrar el viejo almacen de datos.
+Node.storeSaltHashResizeOnStart=Cambiar el tamanio del almacen de datos cuando 
reinicie el nodo (solo salt-hash)
 Node.storeSize=Tama?o del almac?n en bytes
 Node.storeSizeLong=Tama?o del almac?n de datos en bytes
+Node.storeType=Tipo de almacen de datos (NO TOCAR)
 Node.swapRInterval=Intervalo de env?o de peticiones de intercambio de 
ubicaci?n (ms)
 Node.swapRIntervalLong=Intervalo entre intentos de env?o de peticiones de 
intercambio de ubicaci?n, en milisegundos. ?No lo toque!
 Node.tooSmallMTU=MTU muy peque?o
@@ -630,6 +649,7 @@
 NodeClientCore.downloadAllowedDirsLong=Una lista separada por puntos y coma de 
carpetas en las que se permite descargar. "downloads" significa downloadsDir, 
vac?o significa que no se permiten descargas a disco, "all" significa que se 
permite descargar a cualquier parte. ?CUIDADO! Si se usa "all", cualquier 
usuario puede descargar cualquier documento a cualquier parte de su disco.
 NodeClientCore.downloadDir=Carpeta predeterminada para descargas
 NodeClientCore.downloadDirLong=Carpeta predeterminada para guardar descargas
+NodeClientCore.encryptPersistentTempBuckets=Encrypt the persistent temporary 
buckets? NO TOCAR!
 NodeClientCore.fileForClientStats=Archivo para las estad?sticas del cliente
 NodeClientCore.fileForClientStatsLong=Archivo para guardar las estad?sticas de 
regulaci?n del cliente (que se usan para decidir la frecuencia de env?o de 
peticiones)
 NodeClientCore.ignoreTooManyPathComponents=Descartar partes sobrantes en las 
rutas
@@ -654,6 +674,7 @@
 NodeIPDectector.tempAddressHint=Direcci?n IP actual para un solo uso
 NodeIPDectector.tempAddressHintLong=Direcci?n IP actual, si bien 
temporalmente. Se emplea una vez y luego se descarta. Para uso en contextos de 
IP din?mica.
 NodeIPDetector.maybeSymmetric=Parece que el nodo est? tras un NAT sim?trico. 
Esto puede causar problemas de conexi?n: de ser cierto, es probable que solo se 
pueda conectar con nodos directamente abiertos a internet.
+NodeIPDetector.maybeSymmetricShort=Problemas de conexion: probablemente estes 
detras de un NAT simetrico.
 NodeIPDetector.maybeSymmetricTitle=Problemas de conexi?n
 NodeIPDetector.unknownHostErrorInIPOverride=M?quina desconocida: ${error}
 NodeStat.aggressiveGC=Modificador AggressiveGC
@@ -737,8 +758,10 @@
 PluginManager.loadedOnStartupLong=Classpath, nombre y ubicaci?n para los 
complementos a cargar cuando el nodo arranca
 PluginManager.loadedPlugins=Complementos a cargar al arrancar
 PluginManager.loadedPluginsLong=Una lista de complementos que se cargan cuando 
el nodo arranca
+PluginManager.pluginLoadingFailed=El complemento ${name} no pudo ser cargado
 PluginManager.pluginLoadingFailedShort=No se puedo cargar el complemento 
${name}!
 PluginManager.pluginLoadingFailedTitle=No se puedo cargar el complemento!
+PluginManager.pluginLoadingFailedWithMessage=El complemento ${name} no puedo 
ser cargado: ${mesage}
 PluginManager.pluginReqNewerJVM=El complemento ${name} parece requerir una JVM 
m?s reciente. Por favor, instale al menos la versi?n 1.5 de Sun Java, o elimine 
el complemento.
 PluginManager.pluginReqNewerJVMTitle=El complemento ${name} requiere una JVM 
m?s reciente
 PluginToadlet.addPluginTitle=A?adir un complemento
@@ -761,10 +784,13 @@
 PproxyToadlet.Load=Cargar
 PproxyToadlet.changeReloadOnStartup=Cambiar
 PproxyToadlet.classNameTitle=Nombre de clase
+PproxyToadlet.downloadNotAllowedFromRemoteServer=Solo esta permitido descargar 
complementos de nuestro servidor.
 PproxyToadlet.fileonly=solo archivos locales
 PproxyToadlet.internalIDTitle=ID interno
+PproxyToadlet.loadFreenetURLLabel=Key del Complemento
 PproxyToadlet.loadOfficialPlugin=Agregar complemento oficial
 PproxyToadlet.loadOfficialPluginLabel=Cargar complemento oficial
+PproxyToadlet.loadOfficialPluginWarning=CUIDADO: Cargar un complemento oficial 
implica bajarlo de internet (no de Freenet). No cargues complementos si 
bajarlos a travez de internet representa un problema.
 PproxyToadlet.loadOtherPlugin=Agregar complemento no oficial
 PproxyToadlet.loadOtherURLLabel=URL del complemento
 PproxyToadlet.loadPluginLabel=Cargar complemento:
@@ -888,7 +914,35 @@
 SSL.enable=Activar soporte para SSL?
 SSL.enableLong=Activar soporte para SSL?
 SSL.version=Versi?n de SSL
+SSL.versionLong=Version de SSL, SSLv3 o TLSv1 (valor por defecto SSLv3)
+SaltedHashFreenetStore.cleanerAlertTitle=Esta ejecutandose una tarea de 
mantenimiento del datastore
+SecurityLevels.friendsThreatLevelConfirmTitle=CUIDADO: Configurando el nivel 
de seguridad sobre amigos a {$mode}
+SecurityLevels.friendsThreatLevelShort=Proteccion si tus amigoos atacan tu 
anonimato
+SecurityLevels.highFriendsThreatLevelCheckbox=Estoy seguro! Necesito un nivel 
alto de proteccion contra nodos peligrosos de amigos
+SecurityLevels.networkThreatLevelConfirmTitle=CUIDADO: Configurando seguridad 
de red a nivel {$mode}
+SecurityLevels.networkThreatLevelLowCheckbox=Estoy seguro, quiero mas 
velocidad y no me importa que alguien sepa que estoy haciendo en Freenet!
+SecurityLevels.networkThreatLevelShort=Proteccion contra un extranio 
atacandote a travez de internet
+SecurityLevels.noFriendsCheckbox=Estoy seguro, activar nivel de seguridad 
elevado, voy a agregar amigos a mi nodo lo mas pronto que pueda.
+SecurityLevels.physicalThreatLevel=Que tanto te preocupa que tu computadora 
sea fisicamente examinada si es robada o confiscada?
+SecurityLevels.physicalThreatLevelShort=Proteccion si mi computadora es 
revisada o robada
+SecurityLevels.title=Niveles de seguridad
+SecurityLevels.tooltip=Configurar el grado de seguridad del nodo
+SecurityLevels.userAlertExtro=Podes cambiar estas configuraciones en la 
${link}pagina de configuracion${/link}.
+SecurityLevels.userAlertFriendsThreatLevel=Prooteccion si tus amigos atacan tu 
anonimato: ${level}
+SecurityLevels.userAlertNetworkThreatLevel=Nivel de proteccion contra 
extranios atacandote atravez de internet: ${level}
+SecurityLevels.userAlertShortText=Niveles de seguridad: Red: ${network}, 
Amigos: ${friends}, Fisica: ${physical}
+SecurityLevels.friendsThreatLevel.name.HIGH=ALTA
+SecurityLevels.friendsThreatLevel.name.LOW=BAJO
+SecurityLevels.networkThreatLevel.name.HIGH=ALTO
+SecurityLevels.networkThreatLevel.name.LOW=BAJO
+SecurityLevels.networkThreatLevel.name.MAXIMUM=MAXIMO
+SecurityLevels.physicalThreatLevel.choice.LOW=Me importa
+SecurityLevels.physicalThreatLevel.choice.NORMAL=Me importa
+SecurityLevels.physicalThreatLevel.name.LOW=BAJO
 ShortOption.parseError=No se ha podido interpretar como un vector de cadenas: 
${error}
+SimpleHelpToadlet.connectivityTitle=Conectividad
+SimpleHelpToadlet.definitionsTitle=Definiciones
+SimpleHelpToadlet.descriptionTitle=Descripcion
 SimpleToadletServer.advancedMode=?Activar modo avanzado?
 SimpleToadletServer.advancedModeLong=Mostrar o no informaci?n destinada a 
usuarios avanzados/desarrolladores. Este ajuste deber?a mantenerse desactivado 
(false) como norma general.
 SimpleToadletServer.allowedFullAccess=M?quinas con acceso total a FProxy (lea 
el aviso)
@@ -907,10 +961,13 @@
 SimpleToadletServer.cssOverrideNotInUploads=No se puede aceptar este ajuste: 
"${filename} es una carpeta desde la que est? prohibido hacer inserciones
 SimpleToadletServer.doRobots=?Excluir robots mediante robots.txt?
 SimpleToadletServer.doRobotsLong=Si debe servirse un /robots.txt que indique a 
google, wget y otros rastreadores (spiders) que se vayan
+SimpleToadletServer.enableActivelinks=Activar activelinks?
+SimpleToadletServer.enableActivelinksLong=Mostar iconos de los sitios en la 
pagina inicial? Quitar los iconos hace que cargue mas rapido, dejarlos nos 
sirve para saber si el sitio esta disponible.
 SimpleToadletServer.enableJS=Activar el uso de Javascript en FProxy
 SimpleToadletServer.enableJSLong=Usar o no, en FProxy, "helpers" Javascript. 
Este ajuste puede estar desactivado en la mayor?a de los caso. Sepa que los 
freesitios no pueden usar javascript aunque est? activado.
 SimpleToadletServer.enabled=?Activar FProxy?
 SimpleToadletServer.enabledLong=Activar o no FProxy y los servicios HTML 
relacionados
+SimpleToadletServer.hasCompletedWizard=Ya usaste el asistente de configuracion?
 SimpleToadletServer.illegalCSSName=El nombre de CSS no debe contener barras 
'/' o dos puntos ':'
 SimpleToadletServer.panicButton=?Mostrar el bot?n de p?nico?
 SimpleToadletServer.panicButtonLong=Si debe mostrarse o no el bot?n de p?nico 
en la p?gina de /cola/
@@ -972,6 +1029,7 @@
 TextModeClientInterfaceServer.enabled=Activar TMCI (Cliente de modo texto / 
Text Mode Client Interface)
 TextModeClientInterfaceServer.enabledLong=Determina si se activar? el TMCI
 TextModeClientInterfaceServer.ssl=Activar SSL?
+TextModeClientInterfaceServer.sslLong=Activar SSL en la terminal de linea de 
comandos
 TextModeClientInterfaceServer.telnetPortNumber=Puerto para Telnet
 TextModeClientInterfaceServer.telnetPortNumberLong=N?mero de puerto para Telnet
 TimeSkewDetectedUserAlert.text=El nodo ha detectado un salto en el reloj. Esto 
es MUY perjudicial. El nodo no funcionar? correctamente hasta que se corrija. 
Son causas habituales ajustes incorrectos del modo de ahorro de energ?a, 
clientes de sincronizaci?n temporal por  red (NTP) o hardware defectuoso.
@@ -989,6 +1047,7 @@
 Toadlet.permRedirectWithReason=Redirecci?n permanente: ${reason}
 Toadlet.returnToNodeHomepage=Regresar a la p?gina de bienvenida
 Toadlet.returnToPrevPage=Regresar a la p?gina anterior
+Toadlet.returnToQueuepage=Volver a la cola de descargas
 Toadlet.tempRedirectWithReason=Redirecci?n temporal: ${reason}
 Toadlet.unauthorized=No se le permite acceder a esta p?gina.
 Toadlet.unauthorizedTitle=No autorizado
@@ -1053,7 +1112,9 @@
 UserAlertManager.alertsOnAlertsPage=| Ver en ${link}la apagina de 
avisos${/link}.
 UserAlertManager.alertsOnHomepage=| Cons?ltelas en la ${link}p?gina de 
bienvenida${/link}.
 UserAlertManager.alertsTitle=Avisos importantes
+UserAlertManager.clickForMore=Hace click en un item para obtener mas 
informacion o eliminar el mensaje de alerta.
 UserAlertManager.criticalErrorCountLabel=Errores cr?ticos:
+UserAlertManager.dumpEventsButton=Quitar mensajes de alerta sin importancia
 UserAlertManager.errorCountLabel=Errores:
 UserAlertManager.minorCountLabel=Menor:
 UserAlertManager.totalLabel=Total:
@@ -1104,6 +1165,8 @@
 WelcomeToadlet.restartNode=Reiniciar el nodo
 WelcomeToadlet.restarting=Por favor, espere mientras el nodo se reinicia. Esto 
puede llevar hasta 3 minutos. Gracias por usar Freenet.
 WelcomeToadlet.restartingTitle=El nodo est? reinici?ndose.
+WelcomeToadlet.searchBoxLabel=Buscar en Freenet (puede llevar bastante tiempo)
+WelcomeToadlet.searchPluginNotLoaded=El complemento de Busqueda no esta 
cargado!
 WelcomeToadlet.shutdown=Apagar
 WelcomeToadlet.shutdownConfirm=?Est? seguro de que desea apagar el nodo?
 WelcomeToadlet.shutdownConfirmTitle=Apagado del nodo

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fi.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fi.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fi.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -1,5 +1,11 @@
+Announcer.announceAlertIntro=Freenet-solmu yhdist?? verkkoon ? t?ss? voi 
kest?? muutamia minuutteja. Solmun suorituskyky kasvaa seuraavien tuntien 
aikana. T?m? tulee tapahtumaan joka kerta, kun suljet Freenet-solmusi 
useammaksi kuin muutamaksi minuutiksi, joten sinun kannattaa j?tt?? solmusi 
py?rim??n kellon ymp?ri, jos vain mahdollista.
+Announcer.announceAlertNoSeednodes=Solmusi ei l?yt?nyt 
seednodes.fref-tiedostoa, joten solmusi ei kykene yhdist?m??n itse??n 
Opennettiin. Sinun kannattaa lis?t? muutama solmu k?sin tai ladata 
seednodes.fref-tiedosto osoitteesta 
http://downloads.freenetproject.org/alpha/opennet/ .
 Announcer.announceAlertShort=Solmu yritt?? yhdist?? verkkoon, se on eritt?in 
hidas jonkin aikaa.
+Announcer.announceAlertTitle=Solmun julistus
+Announcer.announceDetails=Olemme l?hett?neet ?skett?in 
${recentSentAnnouncements} julistusta, joista ${runningAnnouncements} on 
edelleen k?ynniss? ja lis?nneet ${addedNodes} solmua (${refusedNodes} solmua on 
hyl?nnyt meid?t). Olemme parhaillaan yhteydess? ${connectedSeednodes} 
l?hdesolmuun ja yrit?mme ottaa yhteytt? ${disconnectedSeednodes} muuhun 
l?hdesolmuun.
 Announcer.announceDisabledTooOld=Solmu n?ytt?isi olevan liian vanha 
yhdist??kseen Freenettiin. Solmu otti pois k?yt?st? itsens? ilmoittamisen, 
sill? se olisi turhaa. Sinun kannattaa p?ivitt?? solmusi mahdollisimman 
nopeasti (automaattip?ivitys voi odottaa sy?tett? tai se voi olla poi k?yt?st?).
+Announcer.announceDisabledTooOldShort=Solmusi yritti yhdist?? verkkoon, mutta 
Freenet-versiosi on liian vanha. Sinun kannattaisi p?ivitt?? Freenet-solmusi.
+Announcer.announceDisabledTooOldTitle=Julistaminen kytketty pois p??lt? (liian 
vanha)
 Announcer.announceLoading=Freenet yritt?? parhaillaan ladata 
l?hdesolmutiedostoa, jotta se voi yritt?? ilmoittaa itsest??n muulle verkolle. 
Ilmoittaminen voi ottaa muutamia minuutteja.
 Announcer.coolingOff=Seuraavien ${time] sekuntien aikana solmu odottaa muita 
solmuja, joille se ilmoitti yhdist?v?ns?. Jos sill? ei ole tarpeeksi solmuja, 
se yritt?? toista solmua.
 Announcer.dontKnowAddress=Freenet ei viel? ole kyennyt tunnistamaan 
IP-osoitettaan. Solmu ei kykene ilmoittamaan itsest??n ennen t?t? tietoa.
@@ -194,6 +200,8 @@
 DarknetConnectionsToadlet.updateChangedPrivnotes=P?ivit? muutetut 
yksityismerkinn?t
 DarknetConnectionsToadlet.urlReference=Referenssin osoite:
 DarknetConnectionsToadlet.versionTitle=Versio
+ExtOldAgeUserAlert.extTooOld=Sinun freenet-ext.jar-tiedosto n?ytt?isi olevan 
vanhentunut: sinun kannattaa ehdottomasti p?ivitt?? se osoitteesta 
http://downloads.freenetproject.org/alpha/freenet-ext.jar.
+ExtOldAgeUserAlert.extTooOldShort=Sinun freenet-ext.jar on vanhentunut. 
Suosittelen p?ivitt?m??n sen.
 ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext on liian vanha
 FNPPacketMangler.somePeersDisconnectedStillNotAcked=Mahdollinen ohjelmavirhe: 
${count} vertaista pakotettu sulkemaan yhteys hyv?ksym?tt?mien pakettien takia.
 FNPPacketMangler.somePeersDisconnectedStillNotAckedDetail=${count}:lla 
vertaisistasi on vakavia ongelmia (eiv?t ole hyv?ksyneet pakettejasi kymmenen 
minuutin kuluessa). T?m? on luultavasti koodivirhe. Toivomme sinun ilmoittavan 
t?m?n virheen Freenetin vianseurantaan osoitteessa 
${link}https://bugs.freenetproject.org/${/link} tai s?hk?postiosoitteeseen 
support at freenetproject.org. Muista lis?t? t?m? viesti ja tieto py?ritt?m?si 
solmun versiosta. Ongelman vaivaamat vertaiset (et varmaankaan halua lis?t? 
niit? virheilmoitukseen, jos ne ovat sinun darknet-vertaisiasi) ovat:
@@ -259,14 +267,17 @@
 FileOffer.askUserTitle=Suora tiedostonsiirto
 FileOffer.commentLabel=Kommentti:
 FileOffer.failedReceiveHeader=Tiedoston ${filename} siirto solmulta ${node} 
ep?onnistui.
+FileOffer.failedReceiveShort=Tiedoston ${filename} siirto yst?v?lt?si nimelt? 
${node} ep?onnistui.
 FileOffer.failedReceiveTitle=Tiedoston vastaanotto ep?onnistui
 FileOffer.fileLabel=Tiedosto:
 FileOffer.mimeLabel=MIME-tyyppi:
 FileOffer.offeredFileHeader=Solmu ${name} tarjosi tiedostoa:
+FileOffer.offeredFileShort=Yst?v?si ${node} tarjoaa sinulle tiedostoa nimelt? 
${filename}.
 FileOffer.rejectTransferButton=Hylk?? siirto
 FileOffer.senderLabel=L?hett?j?:
 FileOffer.sizeLabel=Koko:
 FileOffer.succeededReceiveHeader=Tiedoston ${filename} siirto solmulta ${node} 
onnistui.
+FileOffer.succeededReceiveShort=Onnistuneesti vastaanotettu tiedosto 
${filename} yst?v?lt?si ${node}.
 FileOffer.succeededReceiveTitle=Tiedoston vastaanotto onnistui
 FirstTimeWizardToadlet.bandwidthLimit=Nopeusrajoitukset
 FirstTimeWizardToadlet.chooseNodeName=Solmun nimi on pakollinen!
@@ -307,12 +318,16 @@
 IPUndetectedUserAlert.detectingWithConfigLink=Freenet yritt?? parhaillaan 
tunnistaa julkisen IP-osoitteesi. Jos t?m? ottaa enemm?n kuin muutaman 
minuutin, jotain on v??rin, jolloin voit k?ytt?? ty?kalua ${link}IP-osoitteen 
korvaus${/link} auttaaksesi IP-osoitteen selvityst?.
 IPUndetectedUserAlert.loadDetectPlugins=Freenet ei kykene tunnistamaan 
julkista IP-osoitettasi, eik? yht??n IP:n tunnistamiseen tarvittavaa lis?osaa 
ole k?yt?ss?. Freenetill? tulee olemaan eritt?in vaikeaa yhdist?ess??n muihin 
solmuihin. Sinun kannattaa menn? ${plugins}liit?nn?issivulle${/plugins} ja 
ottaa k?ytt??n UPnP- ja JSTUN-liit?nn?iset. Vaihtoehtoisesti, jos sinulla on 
staattinen IP-osoite tai domain, voit kertoa Freenetille sen k?ytt?en 
?IP-osoitteen korvaus?-toimintoa ${config}asetussivulla${/config}.
 IPUndetectedUserAlert.noDetectorPlugins=Freenet ei kykene tunnistamaan 
IP-osoitettasi! Sinun kannattaa ottaa k?ytt??n UPnP- ja JSTUN-lis?osat.
-IPUndetectedUserAlert.suggestForwardPort=My?s UDP-portin{port1} avaaminen 
reitittimest?si tekisi yhdist?misen solmuusi helpoksi.
-IPUndetectedUserAlert.suggestForwardTwoPorts=My?s UDP-porttiesi ${port1} ja 
${port2] avaaminen reitittimest?si tekisi yhdist?misen solmuusi helpoksi.
+IPUndetectedUserAlert.suggestForwardPort=My?s UDP-portin ${port1} avaaminen 
reitittimest?si tekisi yhdist?misen solmuusi helpoksi.
+IPUndetectedUserAlert.suggestForwardTwoPorts=My?s UDP-porttiesi ${port1} ja 
${port2} avaaminen reitittimest?si tekisi yhdist?misen solmuusi helpoksi.
 IPUndetectedUserAlert.unknownAddress=Freenet ei kyennyt tunnistamaan julkista 
IP-osoitettasi. Voit silti vaihtaa referenssej? muiden kanssa, mutta se ei 
toimi kuin k?ytt?jien, jotka eiv?t ole palomuurin tai NAT:n takana, kanssa. 
Heti kun olet yhdist?nyt edes yhteen k?ytt?j??n t?ll? tavalla, Freenet kykenee 
tunnistamaan julkisen IP-osoitteesi. Voit antaa solmulle k?sinm??ritetyn 
vihjeen ty?kalulla ${link}}V?liaikainen IP-osoitteen vihje${/link}.
 IPUndetectedUserAlert.unknownAddressShort=Freenet ei kyennyt tunnistamaan 
IP-osoitettasi. Sinulla voi olla ongelmia yhdistett?ess?.
 IPUndetectedUserAlert.unknownAddressTitle=Tuntematon julkinen osoite
 IPUndetectedUserAlert.unknownAddressWithConfigLink=Freenet ei kyennyt 
tunnistamaan julkista IP-osoitettasi (tai NAT-laitteesi/palomuurisi 
IP-osoitetta). Voit silti vaihtaa referenssej? muiden kanssa, mutta t?m? toimii 
vain, jos toinen k?ytt?j? ei ole palomuurin tai NAT:n takana. Heti kun olet 
yhdist?nyt yhteen toiseen k?ytt?j??n t?ll? tavalla, Freenet kykenee 
m??rittelem??n julkisen IP-osoitteesi. Voit my?s lis?t? julkisen IP-osoitteesi 
k?sin k?ytt?en ty?kalua ${link}IP-osoitteen korvaus${/link}.
+InvalidAddressOverrideUserAlert.unknownAddress=Freenet-solmu on huomannut, 
ett? nykyinen ?ipAddressOverride?-asetus on ep?kelpo, eli se ei ole kelvollinen 
verkkonimi, IP(v4/v6)-osoite.
+InvalidAddressOverrideUserAlert.unknownAddressShort=Sinun ?ipAddressOverride? 
on virheellinen. Korjaa se.
+InvalidAddressOverrideUserAlert.unknownAddressTitle=Ep?kelpo osoitteen 
ylikirjoitusarvo
+InvalidAddressOverrideUserAlert.unknownAddressWithConfigLink=Freenet-solmu on 
huomannut, ett? nykyinen ?ipAddressOverride?-asetus on ep?kelpo, eli se ei ole 
kelvollinen verkkonimi, IP(v4/v6)-osoite. Voit korjata  osoitteen kohdassa 
?IP-osoitteen ylikirjoitus? ${link}asetuksissa${/link}.
 JPEGFilter.tooShort=Tiedosto on liian lyhyt ollakseen JPEG.
 JPEGFilter.tooShortTitle=Liian lyhyt
 KnownUnsafeContentTypeException.dangerousInlines=T?m?ntyyppinen sis?lt?ss? voi 
olla sis?llytettyj? kuvia tai videoita, ja voi niiden avulla ladata sis?lt?? 
avoimesta verkosta, paljastaen n?in IP-osoitteesi.
@@ -328,7 +343,7 @@
 KnownUnsafeContentTypeException.title=Tunnettu vaarallinen tyyppi: ${type}
 LocalFileInsertToadlet.checkPathExist=Tarkista, ett? m??ritetty polku on 
olemassa.
 LocalFileInsertToadlet.checkPathIsDir=Tarkista, ett? m??ritelty polku on 
hakemisto.
-LocalFileInsertToadlet.checkPathReadable=Tarkista, ett? m??r?tty polku voidaan 
lukea solmua py?ritt?v?n tunnuksen toimesta.
+LocalFileInsertToadlet.checkPathReadable=Tarkista, ett? solmu pystyy lukemaan 
m??r?tty? polkua.
 LocalFileInsertToadlet.dirAccessDenied=Et voi selata t?t? hakemistoa
 LocalFileInsertToadlet.dirCannotBeRead=Hakemistoa "${path}" ei voida lukea.
 LocalFileInsertToadlet.fileHeader=Tiedosto
@@ -358,18 +373,30 @@
 N2NTMUserAlert.delete=Poista
 N2NTMUserAlert.reply=Vastaa
 Node.acceptSeedConnectionsShort=Ole l?hdesolmu
+Node.bindToLong=IP-osoite, johon kiinnitty?
+Node.enableARKsLong=Salli ARK:t? (?L? KYTKE T?T? POIS P??LT?!)
+Node.enablePacketCoalescingLong=Salli pakettien yhdist?minen? Pakettien 
yhdist?minen kasvattaa kaistan hy?tykuormaa, pienent?? prosessorink?ytt?? ja 
antaa jonkin verran vastustuskyky? liikenneanalyysille, kasvattaen hieman 
viivett? viesteiss?. ?l? kytke t?t? pois, ellet tied?, mit? olet tekem?ss?.
 Node.inBWLimit=Latausnopeuden rajoitus (tavua / sekunti)
 Node.inBWLimitLong=Latausnopeuden rajoitus (tavua / sekunti). Solmun ei 
pit?isi k?yt?nn?ss? ikin? ylitt?? t?t?. -1 tarkoittaa 4 x l?hetysnopeus.
 Node.l10nLanguage=Kieli, jolla solmu n?ytt?? viestit
 Node.l10nLanguageLong=T?m? asetus muuttaa solmun k?ytt?m?n kielen viestien 
n?ytt?miseen. Pid? kuitenkin mieless?, ett? jotkin viestit eiv?t ole 
k??nnettyin? ennen seuraavaa solmun uudelleenk?ynnistyst?.
+Node.maxHTL=Maksimi HTL.
+Node.maxHTLLong=Maksimi HTL (T?M? ASETUS ON VAIN KEHITT?JILLE!)
+Node.mustBePositive=Asetusarvon t?ytyy olla positiivinen
 Node.nodeName=Freenet-solmun lempinimi
 Node.nodeNameLong=Solmun lempinimi. T?m? n?kyy vain yst?ville.
 Node.opennetEnabled=K?yt? turvatonta tilaa (yhdist? automaattisesti 
turvattomiin solmuihin)
 Node.opennetEnabledLong=K?yt? turvatonta tilaa (tunnetaan nimell? opennet). 
Jos t?m? on k?yt?ss?, solmu automaattisesti vaihtaa solmureferenssej? muiden 
turvattomien solmujen kanssa (muukalaiset ja yst?v?t). Mutta t?m? tarkoittaa, 
ettei yll?pit?m?si solmu ole en?? yksityinen, ja monet hy?kk?ykset ovat paljon 
helpompia. Jos tunnet tarpeeksi Freenetin k?ytt?ji?, sinun kannattaa pysytell? 
luotettuissa(yst?v?t) yhteyksiss? ja kytke? t?m? pois.
 Node.outBWLimit=L?hetysnopeuden rajoitus (tavua / sekunti)
 Node.outBWLimitLong=Kova rajoitus l?hetysnopeudelle (tavua / sekunti). solmun 
ei pit?isi k?yt?nn?ss? koskaan ylitt?? t?t?.
+Node.routeAccordingToOurPeersLocation=Pit?isik? meid?n k?ytt?? vertaistemme 
vertaisten sijainteja hyv?ksi reitityksess??
+Node.storeDirectory=Varaston hakemisto
+Node.storePreallocateLong=Varaa etuk?teen tietovaraston vaatima tila
+Node.storeSaltHashMigrated=Tietovaraston muuttaminen valmistui. Nyt voit 
poistaa vanhan tietovaraston tiedostot:
 Node.storeSize=Varaston koko tavuissa
 Node.storeSizeLong=Varaston koko tavuissa
+Node.swapRInterval=Vaihtopyynt?jen l?hetysintervalli (millisekuntia)
+Node.tooSmallMTU=Liian pieni MTU
 NodeClientCore.couldNotFindOrCreateDir=Hakemistoa ei l?ytynyt tai sit? ei 
voinut luoda.
 NodeClientCore.downloadAllowedDirs=Hakemistot, joihin lataaminen on sallittua
 NodeClientCore.downloadAllowedDirsLong=Puolipisteell? eroteltu lista 
hakemistoista, joista lataaminen on sallittua. "downloads" tarkoittaa 
downloadDir:?, tyhj? tarkoittaa, ettei levylle tallentaminen ole sallittua, 
"all" sallii lataukset kaikkialle. VAROITUS! Jos t?m? on asetettu "all":ksi, 
jokainen k?ytt?j?, jolla on FCP-oikeudet, voi ladata mink? tahansa tiedoston 
koneeltasi!
@@ -378,7 +405,7 @@
 NodeClientCore.encryptPersistentTempBuckets=Kryptaa sinnikk?iden 
v?liaikaistiedostot? ?L? KOSKE T?H?N!
 NodeClientCore.encryptPersistentTempBucketsLong=Salaa sinnikk?t v?liaikaiset 
s?ili?t? Joissakin tapauksissa (jos k?yt?t kiintolevy- ja 
sivutustiedostosalausta) v?liaikaisten s?ili?iden salaaminen voi olla t?ysin 
turhaa. ?L? KOSKE T?H?N ELLET TIED?, MIT? OLET TEKEM?SS?!
 NodeClientCore.encryptTempBuckets=Kryptaa v?liaikaiset s?ili?t? ?L? KOSKE 
T?H?N!
-NodeClientCore.encryptTempBucketsLong=Kryptaa v?liaikaiset s?ili?t? Joissakin 
tapauksissa (jos k?yt?t kiintolevy- ja swap-kryptausta) ei kenties ole mit??n 
j?rke? kryptata v?liaikaisia s?ili?it?. ?L? KOSKE T?H?N JOS ET TIED?, MIT? OLET 
TKEM?SS?!
+NodeClientCore.encryptTempBucketsLong=Kryptaa v?liaikaiset s?ili?t? Joissakin 
tapauksissa (jos k?yt?t kiintolevy- ja swap-kryptausta) ei kenties ole mit??n 
j?rke? kryptata v?liaikaisia s?ili?it?. ?L? KOSKE T?H?N JOS ET TIED?, MIT? OLET 
TEKEM?SS?!
 NodeClientCore.fileForClientStats=Tiedosto, johon tallennetaan asiakasohjelman 
statistiikat
 NodeClientCore.fileForClientStatsLong=Tiedosto, johon tallennetaan klientin 
kuristusstatistiikka (k?ytet??n pyynt?jen l?hetysm??r?n m??rittelemiseen)
 NodeClientCore.lazyResume=T?ydellinen sinnikk?iden pyynt?jen lataus 
k?ynnistyksen j?lkeen? (kuluttaa enemm?n muistia)
@@ -388,7 +415,7 @@
 NodeClientCore.maxRAMBucketSize=Suurin sallittu koko k?ytt?muistis?ili?lle.
 NodeClientCore.maxRAMBucketSizeLong=Suurin mahdollinen koko 
v?limuistis?ili?lle (suuremmat s?ili?t pidet??n kiintolevyll?)
 NodeClientCore.maxUSKFetchers=Suurin sallittu USK-hakijoiden m??r?
-NodeClientCore.maxUSKFetchersLong=Suurin USK-hakijoiden sallittu m??r?
+NodeClientCore.maxUSKFetchersLong=Maksimim??r? USK-hakijoille.
 NodeClientCore.maxUSKFetchersMustBeGreaterThanZero=T?ytyy olla suurempi kuin 
nolla
 NodeClientCore.movingTempDirOnTheFlyNotSupported=V?liaikaishakemiston siirtoa 
lennosta ei tueta t?ll? hetkell?.
 NodeClientCore.persistentTempDir=Sinnikk?iden v?liaikaistiedostojen hakemisto
@@ -412,6 +439,8 @@
 NodeIPDetector.maybeSymmetricShort=Yhteysongelmia: saatat olla symmetrisen 
NATin takana.
 NodeIPDetector.maybeSymmetricTitle=Yhteysongelmia
 NodeIPDetector.unknownHostErrorInIPOverride=Tuntematon is?nt?: ${error}
+NodeStats.mustBePercentValueNotFull=T?m?n arvon t?ytyy olla prosenttiarvo 
v?lilt? 0-99.
+NodeStats.valueTooLow=T?m? arvo on liian pieni tuolle asetukselle, nosta sit?.
 NodeUpdateManager.enabled=Lataa uudet Freenet-versiot
 NodeUpdateManager.enabledLong=Solmusi etsii uusia versioita Freenetist? 
automaattisesti? Jos etsii, uudet versiot tunnistetaan ja ladataan 
automaattisesti, mutta ei v?ltt?m?tt? asenneta. T?m? asetus muuttuu takaisin 
ep?todeksi, ellei solmua ajeta wrapper:lla.
 NodeUpdateManager.extURI=Mist? solmun pit?isi etsi? p?ivityksi? 
freenet-ext.jar:a varten?
@@ -624,7 +653,7 @@
 SecurityLevels.networkThreatLevel.choice.LOW=En v?lit? seurantayrityksist? ja 
haluan mahdollisimman suuren suorituskyvyn.
 SecurityLevels.networkThreatLevel.choice.MAXIMUM=Aion selata tietoa, joka 
voisi saada minut pid?tetyksi, vankilaan tai pahempaa. Ymm?rr?n, ett? Freenet 
on kokeellinen eik? voi taata tietoturvaa tiettyj? tunnettuja hy?kk?yksi? 
vastaan, mutta hyv?ksyn riskit verrattuna vaihtoehtoihin.
 SecurityLevels.networkThreatLevel.choice.NORMAL=El?n suhteellisen vapaassa 
maassa, mutta haluaisin vaikeuttaa muiden seurantaa koskien minun yhteyksi?.
-SecurityLevels.networkThreatLevel.desc.HIGH=Freenet yhdist?? vain yst?viisi, 
joten ${bold}sinula t?ytyy olla yst?vi? valitaksesi t?m?n tilan${/bold}. 
Freenet tule olemaan hidas ellei sinulla ole v?hint??n viitt? yst?v??, eik? 
toimi ollenkaan ellei sinulla ole v?hint??n yksi.
+SecurityLevels.networkThreatLevel.desc.HIGH=Freenet yhdist?? vain yst?viisi, 
joten ${bold}sinulla t?ytyy olla yst?vi? valitaksesi t?m?n tilan${/bold}. 
Freenet toimii hitaasti ellei sinulla ole v?hint??n viitt? yst?v??, eik? toimi 
ollenkaan ellei sinulla ole v?hint??n yksi.
 SecurityLevels.networkThreatLevel.desc.LOW=Muut saattavat l?yt?? 
identiteettisi melko helposti!
 SecurityLevels.networkThreatLevel.desc.MAXIMUM=Freenet tulee olemaan 
${bold}huomattavasti${/bold} hitaampi korkealla tasolla, ja ${bold}sinulla 
t?ytyy olla yst?vi? k?ytt??ksesi t?t? muotoa${/bold}.
 SecurityLevels.networkThreatLevel.desc.NORMAL=Freenet tulee olemaan varovainen 
suojellakseen anonymiteetti?si, keskisuurella suorituskykyh?vi?ll?. Freenet 
automaattisesti yhdist?? tuntemattomiin solmuihin. Suosittelemme, ett? lis??t 
yst?vi?, jotka py?ritt?v?t Freenet-solmua ja muutat t?m?n tason korkeaksi.
@@ -708,7 +737,9 @@
 Toadlet.notSupportedTitle=Ei tuettu
 Toadlet.yes=Kyll?
 TranslationToadlet.bracketRemoveOverride=(poista k??nn?s)
+TranslationToadlet.bracketTranslateIt=(k??nn? suomen kieliseksi!)
 TranslationToadlet.bracketUpdateTranslation=(muokkaa k??nn?st?)
+TranslationToadlet.confirmRemoveOverride=Oletko varma, ett? haluat poistaa 
seuraavan avain-arvo-parin: (${key} - ${value})?
 TranslationToadlet.contributingToLabelWithLang=Muokkaat parhaillaan kielen 
${lang} k??nn?st?:
 TranslationToadlet.currentTranslationLabel=Nykyinen k??nn?s
 TranslationToadlet.downloadTranslationsFile=Lataa nykyinen k??nn?stiedosto
@@ -718,11 +749,14 @@
 TranslationToadlet.originalVersionLabel=Alkuper?inen (englanninkielinen versio)
 TranslationToadlet.reEdit=Muokkaa k??nn?st? uudelleen
 TranslationToadlet.remove=Poista
+TranslationToadlet.removeOverrideTitle=Poista k??nn?ksen ylikirjoitusavain
+TranslationToadlet.removeOverrideWarningTitle=Olet aikeissa poistaa k??nn?ksen 
ylikirjoitusavaimen!
 TranslationToadlet.returnToTranslations=Palaa k??nn?ssivulle
 TranslationToadlet.showEverything=N?yt? kaikki, mukaanlukien k??nnetyt rivit
 TranslationToadlet.translationKeyLabel=K??nn?ksen avain
 TranslationToadlet.translationUpdateTitle=K??nn?sp?ivitys
 TranslationToadlet.translationUpdatedTitle=K??nn?s p?ivitetty!
+TranslationToadlet.updateTranslationCommand=P?ivit? k??nn?st?!
 UnknownContentTypeException.explanation=Freenettisi ei tied? mit??n t?st? 
MIME-tyypist?. T?m? tarkoittaa, ett? selaimesi saattaa tehd? jotain vaarallista 
t?m?n latauksen takia. Esimerkiksi, monet tiedostomuodot voivat sis?lt?? 
sis?llytettyj? kuvia tai videoita, jotka ladataan www-sivulta; t?m? ei miss??n 
tapauksessa ole vaaratonta, sill? ne voivat tuhota anonyymiteettisi ja 
paljastaa IP-osoitteesi (jos hy?kk??j? py?ritt?? www-sivua tai p??see sen 
lokeihin). Linkit www-sivuille voi olla my?s uhka, melko pitk?lti samasta 
syyst?, kuten my?s erilaiset skriptit.
 UnknownContentTypeException.title=Tuntematon ja mahdollisesti vaarallinen 
sis?lt?tyyppi: ${type}
 UpdateDeployContext.cannotUpdateNoExtJar=freenet-ext.jar:a ei kyetty l?yt?m??n 
wrapper.conf:sta (freenet.jar l?ydettiin: ${mainFilename})

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.fr.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -430,6 +430,10 @@
 FileOffer.succeededReceiveTitle=Fichier re?u
 FirstTimeWizardToadlet.bandwidthLimit=Limites de d?bit
 FirstTimeWizardToadlet.bandwidthLimitLong=Veuillez choisir le type et la 
vitesse de votre connexion internet (download/upload) dans la liste ci-dessous.
+FirstTimeWizardToadlet.browserWarning=Nous vous recommandons 
${bold}fortement${/bold} de ne pas utiliser le m?me navigateur web ? la fois 
pour naviguer sur le web et sur Freenet. La technique du vol de l'historique de 
votre navigateur, utilis?e par des sites web malveillants, peut permettre de 
d?terminer les freesites (les sites de Freenet) que vous avez r?cemment 
visit?s, ce qui compromet votre anonymat. S'il vous pla?t, utilisez un 
navigateur s?par?, ou au moins un autre profil utilisateur, pour acc?der ? 
l'interface web de Freenet.
+FirstTimeWizardToadlet.browserWarningPageTitle=Vous devez utiliser un 
navigateur s?par? pour Freenet !
+FirstTimeWizardToadlet.browserWarningShort=Vous devez utiliser un navigateur 
s?par? pour Freenet !
+FirstTimeWizardToadlet.browserWarningSuggestion=La plupart des navigateurs 
Web, ? l'exception de Microsoft InternetExplorer (qui a des probl?mes avec la 
d?tection du type de contenu), fonctionnent de mani?re ad?quate avec Freenet. 
Par exemple : Firefox, Opera, Safari, et Lynx sont connus pour fonctionner 
parfaitement. Vous devez installer l'un d'entre eux, ou cr?er un nouveau profil 
dans votre navigateur. Ensuite, copiez l'URL de la barre d'adresse, et 
ouvrez-la dans ce nouveau navigateur, ou dans ce nouveau profil utilisateur.
 FirstTimeWizardToadlet.bwlimitHigherSpeed=plus rapide
 FirstTimeWizardToadlet.bwlimitLowerSpeed=plus lent
 FirstTimeWizardToadlet.chooseNodeName=Vous devez choisir un nom !
@@ -1166,6 +1170,8 @@
 SimpleToadletServer.cssOverrideNotInUploads=Vous de pouvez pas configurer ce 
param?tre : "${filename} n'est pas un r?pertoire d'o? l'upload est autoris? !
 SimpleToadletServer.doRobots=Exclure les robots dans robots.txt ?
 SimpleToadletServer.doRobotsLong=Pr?senter un fichier robots.txt disant ? 
Google, aux spiders et ? wget d'aller voir ailleurs
+SimpleToadletServer.enableActivelinks=Afficher les activelinks ?
+SimpleToadletServer.enableActivelinksLong=Afficher les activelinks sur la page 
d'accueil de Freenet (FProxy) ? La page se chargera plus rapidement si les 
activelinks ne sont pas affich?es. (Non par d?faut.)
 SimpleToadletServer.enableInlinePrefetch=T?l?charger les images en avance ?
 SimpleToadletServer.enableInlinePrefetchLong=Ca peut aider si votre navigateur 
n'utilise qu'un petit nombre de connexions pour communiquer avec le noeud. 
Sinon, ?a n'aidera pas.
 SimpleToadletServer.enableJS=Autoriser FProxy ? utiliser du Javascript ?

Modified: branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties
===================================================================
--- branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/l10n/freenet.l10n.it.properties   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -266,10 +266,10 @@
 ExtOldAgeUserAlert.extTooOldShort=Il file freenet-ext.jar ? obsoleto. Si prega 
di aggiornarlo.
 ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext obsoleto
 FNPPacketMangler.somePeersDisconnectedStillNotAcked=Probabile bug: si prega di 
riportare: E' stata forzata la disconnessione di ${count} peer per mancata 
conferma della ricezione dei pacchetti.
-FNPPacketMangler.somePeersDisconnectedStillNotAckedDetail=${count} peer non 
segnalano di aver ricevuto pacchetti nonostante siano trascorsi 10 minuti. Ci? 
? probabilmente dovuto a un 'bug' (difetto) nel programma. Si prega di 
riportare l'accaduto presso il bug tracker 
${link}https://bugs.freenetproject.org/${/link} o e-mail support at 
freenetproject.org. Il rapporto va scritto in inglese ma in altrnativa si puo' 
scrivere in italiano a Luca (traduttore ufficiale di Freenet) che provveder? a 
tradurre e inoltrare il rapporto, all'indirizzo e-mail luke771 at gmail.com. 
Includere questo messaggio e la versione di Freenet che si sta usando. I peer 
affetti (non ? necessario riportarli, specialmente se sono darknet) sono:
+FNPPacketMangler.somePeersDisconnectedStillNotAckedDetail=${count} peer non 
segnalano di aver ricevuto pacchetti nonostante siano trascorsi 10 minuti, 
forse a causa di un 'bug' (difetto) nel programma. Si prega di riportare 
l'accaduto presso il bug tracker 
${link}https://bugs.freenetproject.org/${/link} o e-mail support at 
freenetproject.org. Includere questo messaggio e la versione di Freenet che si 
sta usando. I peer affetti (non ? necessario riportarli, specialmente se sono 
darknet) sono:
 FProxyToadlet.abortToHomepage=Interrompi e ritorna alla homepage di FProxy
 FProxyToadlet.alerts=Messaggi dettagliati sullo stato del nodo e messaggi da 
parte di Amici
-FProxyToadlet.alertsTitle=Avvertenze
+FProxyToadlet.alertsTitle=Messaggi
 FProxyToadlet.backToFProxy=${link}Clicca qui${/link} per andare alla homepage 
di FProxy
 FProxyToadlet.backToReferrer=${link}Clicca qui${/link} per tornare alla pagina 
referente.
 FProxyToadlet.cantBindPort=Non ? possibile abbinare FProxy a quella porta!
@@ -292,6 +292,7 @@
 FProxyToadlet.friendsTitle=Connessioni ad Amici
 FProxyToadlet.goBack=Indietro
 FProxyToadlet.goBackToPrev=Torna alla pagina precedente
+FProxyToadlet.help=Aiuto
 FProxyToadlet.homepage=Homepage
 FProxyToadlet.homepageTitle=Homepage del nodo
 FProxyToadlet.internalErrorReportIt=Errore interno: riportare, se possibile
@@ -442,6 +443,10 @@
 FileOffer.succeededReceiveTitle=Trasferimento file completato
 FirstTimeWizardToadlet.bandwidthLimit=Limitazione banda
 FirstTimeWizardToadlet.bandwidthLimitLong=Scegliere il tipo di connessione e 
la velocit? dal drop-down menu.
+FirstTimeWizardToadlet.browserWarning=Si consiglia ${bold}vivamente${/bold} di 
non usare lo stesso browser per internet e Freenet. Siti internet malevoli 
potrebbero usare un browser history attack per determinare quali siti ospitati 
su Freenet ("freesite") sono stati recentemente visitati, compromettendo 
l'anonimato dell'utente. Si prega pertanto di accedere all' interfaccia web di 
Freenet tramite un browser o almeno un profilo separato da quello usato per i 
normali siti web.
+FirstTimeWizardToadlet.browserWarningPageTitle=Usare un browser separato per 
Freenet
+FirstTimeWizardToadlet.browserWarningShort=E' necssario l'utilizzo di un 
browser per uso esclusivo di Freenet
+FirstTimeWizardToadlet.browserWarningSuggestion=Microsoft Internet Explorer ha 
dei problemi nel rilevare il tipo di contenuto, ma la maggioranza degli altri 
browser funziona adeguatamente con Freenet. Tra i browser che sono stati 
collaudati con esito positivo vi sono Opera, Firefox, Safari e Lynx. Si 
consiglia di installare un browser dedicato per Freenet o creare un profilo nel 
browser esistente, copiare la URL dalla barra degli indirizzi ed aprirla nel 
nuovo browser.
 FirstTimeWizardToadlet.bwlimitHigherSpeed=Velocit? maggiore
 FirstTimeWizardToadlet.bwlimitLowerSpeed=Velocit? minore
 FirstTimeWizardToadlet.chooseNodeName=Il nome del nodo ? obbligatorio!
@@ -1170,6 +1175,14 @@
 SecurityLevels.physicalThreatLevel.name.LOW=BASSO
 SecurityLevels.physicalThreatLevel.name.NORMAL=NORMALE
 ShortOption.parseError=Il valore specificato non pu? essere interpretato come 
16-bit integer : ${val}
+SimpleHelpToadlet.CHK=CHK = Content Hash Key - Chiave statica derivata dall' 
hash matematico di un file.
+SimpleHelpToadlet.SSK=SSK = Signed Subspace Key - Chiave di subspazio, firmata
+SimpleHelpToadlet.USK=USK = Updateable Subspace Key - Chiave di subspazio, 
aggiornabile
+SimpleHelpToadlet.connectivityText=Prova. Test. uno, due tre, prova.   Bla bla 
bla, eccetera eccetera eccetera
+SimpleHelpToadlet.connectivityTitle=Connettivit?
+SimpleHelpToadlet.definitionsTitle=Definizioni
+SimpleHelpToadlet.descriptionText=Questa pagina contiene alcume informazioni 
basilari per cominciare ad usare Freenet. Informazioni pi? dettagliate (in 
inglese) sono disponibili presso il sito ufficiale del progetto 
http://freenetproject.org, il wiki http://wiki.freenetproject.org e su Freenet 
stesso, presso diversi freesties.
+SimpleHelpToadlet.descriptionTitle=Descrizione
 SimpleToadletServer.advancedMode=Abilita modalit? avanzata
 SimpleToadletServer.advancedModeLong=Mostra informazioni che possono 
interessare solo utenti avanzati o sviluppatori. Nella maggioranza dei casi 
dovrebbe essere impostata su 'falso'.
 SimpleToadletServer.allowedFullAccess=Host ai quali ? consentito pieno accesso 
a FProxy (leggere l'avvertenza)
@@ -1188,6 +1201,8 @@
 SimpleToadletServer.cssOverrideNotInUploads=Non ? possibile usare questa 
impostazione: "${filename} non ? una directory dalla quale sono permessi gli 
upload.
 SimpleToadletServer.doRobots=Usa robots.txt per escludere i robot
 SimpleToadletServer.doRobotsLong=Pubblica un file /robots.txt allo scopo di 
tenere lontano Google, spiders, Wget, etc.
+SimpleToadletServer.enableActivelinks=Abilita activelinks
+SimpleToadletServer.enableActivelinksLong=Determina se visualizzare le icone 
per I siti aggiunti ai segnalibri alla pagina 'Esplora Freenet'. Una pagina 
senza icone carica pi? velocemente... ma ovviamente non ha le icone!
 SimpleToadletServer.enableInlinePrefetch=Abilita pre-ricezione (prefetching) 
di immagini inlinea (inline)
 SimpleToadletServer.enableInlinePrefetchLong=Questo potrebbe essere utile se 
il browser utilizza un numero ridotto di connessioni per comunicare con il 
nodo. D'altra parte potrebbe non esserlo.
 SimpleToadletServer.enableJS=Permetti a FProxy di usare Javascript
@@ -1307,9 +1322,14 @@
 Toadlet.unauthorized=L'accesso a questa pagina ? interdetto.
 Toadlet.unauthorizedTitle=Non Autorizzato
 Toadlet.yes=S?
+ToadletContextImpl.browserHistoryWarningBoxTitle=Attenzione: Alcune 
informazioni potrebbero essere trapelate!
+ToadletContextImpl.browserHistoryWarningDisableButton=Elimina avvertenza 
(Leggere, prima!!)
+ToadletContextImpl.browserHistoryWarningLink=Fare click ${link}qui${/link} per 
andare alla pagina richiesta.
+ToadletContextImpl.browserHistoryWarningTitle=Attenzione: alcune informazioni 
potrebbero essere trapelate!
 ToadletContextImpl.cannotParseContentLength=errore nell' analisi 
contenuto-lunghezza: ${error}
 ToadletContextImpl.cannotParseContentLengthWithError=Impossibile interpretare 
contenuto-lunghezza: ${error}
 ToadletContextImpl.headersLineTooLong=Rigo troppo lungo dalla ricostruzione di 
headers
+ToadletContextImpl.invalidURICheckingSecureID=URI non valida (while checking 
secureid=)
 ToadletContextImpl.methodNotAllowed=Metodo HTTP Non Permesso
 ToadletContextImpl.noContentLengthInPOST=Nessun content-length in POST
 ToadletContextImpl.noSuchToadlet=Nessuna Toadlet con quel nome
@@ -1421,6 +1441,8 @@
 WelcomeToadlet.restartNode=Riavvia nodo
 WelcomeToadlet.restarting=Si prega di attendere durante il riavvio del nodo. 
Questa schermata  si aggiorner? automaticamente, fino a mostrare la pagina 
iniziale di Freenet. Grazie di aver scelto Freenet.
 WelcomeToadlet.restartingTitle=Riavvio del nodo Freenet in corso.
+WelcomeToadlet.searchBoxLabel=Cerca su Freenet (pu? volerci del tempo)
+WelcomeToadlet.searchPluginNotLoaded=Il plugin di ricerca non ? stato caricato
 WelcomeToadlet.shutdown=Arresta
 WelcomeToadlet.shutdownConfirm=Conferma: Arresta nodo Freenet?
 WelcomeToadlet.shutdownConfirmTitle=Arresta Nodo

Modified: branches/db4o/freenet/src/freenet/node/BlockedTooLongException.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/BlockedTooLongException.java 
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/BlockedTooLongException.java 
2009-03-18 00:11:38 UTC (rev 26082)
@@ -1,6 +1,7 @@
 package freenet.node;

 public class BlockedTooLongException extends Exception {
+       private static final long serialVersionUID = 1L;

        public final PacketTracker tracker;
        public final long delta;

Modified: branches/db4o/freenet/src/freenet/node/DarknetPeerNode.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/DarknetPeerNode.java 2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/DarknetPeerNode.java 2009-03-18 
00:11:38 UTC (rev 26082)
@@ -16,7 +16,6 @@
 import java.util.LinkedHashSet;

 import freenet.client.DefaultMIMETypes;
-import freenet.crypt.BlockCipher;
 import freenet.io.comm.DMT;
 import freenet.io.comm.DisconnectedException;
 import freenet.io.comm.FreenetInetAddress;

Modified: branches/db4o/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/FNPPacketMangler.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/FNPPacketMangler.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -47,6 +47,7 @@
 import freenet.support.HTMLNode;
 import freenet.support.HexUtil;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.SimpleFieldSet;
 import freenet.support.TimeUtil;
 import freenet.support.WouldBlockException;
@@ -62,8 +63,18 @@
  * changes in IncomingPacketFilter).
  */
 public class FNPPacketMangler implements OutgoingPacketMangler, 
IncomingPacketFilter {
-       private static boolean logMINOR;
-       private static boolean logDEBUG;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
+
        private final Node node;
        private final NodeCrypto crypto;
        private final MessageCore usm;
@@ -168,8 +179,6 @@

                fullHeadersLengthMinimum = HEADERS_LENGTH_MINIMUM + 
sock.getHeadersLength();
                fullHeadersLengthOneMessage = HEADERS_LENGTH_ONE_MESSAGE + 
sock.getHeadersLength();
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
-               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
        }

        /**
@@ -208,8 +217,6 @@
         */
        public void process(byte[] buf, int offset, int length, Peer peer, long 
now) {
                node.random.acceptTimerEntropy(fnpTimingSource, 0.25);
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
-               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
                if(logMINOR) Logger.minor(this, "Packet length "+length+" from 
"+peer);

                /**
@@ -572,8 +579,7 @@
                        // Phase 3
                        processJFKMessage3(payload, 4, null, replyTo, false, 
true, setupType, negType);
                } else {
-                       // FIXME reinstate as ERROR, investigate whether there 
is a real problem.
-                       Logger.normal(this, "Invalid phase "+packetType+" for 
anonymous-initiator (we are the responder) from "+replyTo);
+                       Logger.error(this, "Invalid phase "+packetType+" for 
anonymous-initiator (we are the responder) from "+replyTo);
                }
        }

@@ -620,8 +626,7 @@
                        // Phase 4
                        processJFKMessage4(payload, 4, pn, replyTo, false, 
true, setupType, negType);
                } else {
-                       // FIXME reinstate as ERROR, investigate whether there 
is a real problem.
-                       Logger.normal(this, "Invalid phase "+packetType+" for 
anonymous-initiator (we are the initiator) from "+replyTo);
+                       Logger.error(this, "Invalid phase "+packetType+" for 
anonymous-initiator (we are the initiator) from "+replyTo);
                }
        }

@@ -1808,7 +1813,7 @@
        private boolean tryProcess(byte[] buf, int offset, int length, 
SessionKey tracker, long now) {
                // Need to be able to call with tracker == null to simplify 
code above
                if(tracker == null) {
-                       if(Logger.shouldLog(Logger.DEBUG, this)) 
Logger.debug(this, "Tracker == null");
+                       if(logDEBUG) Logger.debug(this, "Tracker == null");
                        return false;
                }
                if(logMINOR) Logger.minor(this,"Entering tryProcess: 
"+Fields.hashCode(buf)+ ',' +offset+ ',' +length+ ',' +tracker);

Modified: branches/db4o/freenet/src/freenet/node/FailureTableEntry.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/FailureTableEntry.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/FailureTableEntry.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -121,7 +121,7 @@
                int nulls = 0;
                int ret = -1;
                for(int i=0;i<requestorNodes.length;i++) {
-                       PeerNode got = requestorNodes[i] == null ? null : 
(PeerNode) requestorNodes[i].get();
+                       PeerNode got = requestorNodes[i] == null ? null : 
requestorNodes[i].get();
                        // No longer subscribed if they have rebooted, or 
expired
                        if(got == requestor) {
                                // Update existing entry
@@ -204,7 +204,7 @@
                int nulls = 0;
                int ret = -1;
                for(int i=0;i<requestedNodes.length;i++) {
-                       PeerNode got = requestedNodes[i] == null ? null : 
(PeerNode) requestedNodes[i].get();
+                       PeerNode got = requestedNodes[i] == null ? null : 
requestedNodes[i].get();
                        if(got == requestedFrom) {
                                // Update existing entry
                                includedAlready = true;

Modified: branches/db4o/freenet/src/freenet/node/LowLevelGetException.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/LowLevelGetException.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/LowLevelGetException.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -3,8 +3,22 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.node;

+import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
+
 public class LowLevelGetException extends Exception {
+    private static volatile boolean logDEBUG;

+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+            }
+        });
+    }
+
        private static final long serialVersionUID = 1L;
        /** Decode of data failed, probably was bogus at source */
        public static final int DECODE_FAILED = 1;
@@ -76,5 +90,12 @@
        public String toString() {
                return super.toString()+':'+getMessage(code);
        }
-       
+
+    @Override
+    public final synchronized Throwable fillInStackTrace() {
+        if(logDEBUG || code == INTERNAL_ERROR || code == DECODE_FAILED || code 
== VERIFY_FAILED)
+            return super.fillInStackTrace();
+        return null;
+    }
+
 }

Modified: branches/db4o/freenet/src/freenet/node/Node.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Node.java    2009-03-17 23:32:40 UTC 
(rev 26081)
+++ branches/db4o/freenet/src/freenet/node/Node.java    2009-03-18 00:11:38 UTC 
(rev 26082)
@@ -68,9 +68,7 @@
 import freenet.io.comm.Peer;
 import freenet.io.comm.PeerParseException;
 import freenet.io.comm.ReferenceSignatureVerificationException;
-import freenet.io.comm.RetrievalException;
 import freenet.io.comm.UdpSocketHandler;
-import freenet.io.xfer.BlockReceiver;
 import freenet.io.xfer.PartiallyReceivedBlock;
 import freenet.keys.CHKBlock;
 import freenet.keys.CHKVerifyException;
@@ -121,6 +119,7 @@
 import freenet.support.HexUtil;
 import freenet.support.LRUHashtable;
 import freenet.support.LRUQueue;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;
 import freenet.support.NullObject;
 import freenet.support.OOMHandler;
@@ -144,8 +143,15 @@
  */
 public class Node implements TimeSkewDetectorCallback, GetPubkey {

-       private static boolean logMINOR;
-       
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
        private static MeaningfulNodeNameUserAlert nodeNameUserAlert;
        private static BuildOldAgeUserAlert buildOldAgeUserAlert;
        private static TimeSkewDetectedUserAlert timeSkewDetectedUserAlert;
@@ -660,7 +666,6 @@
         */
         Node(PersistentConfig config, RandomSource r, RandomSource weakRandom, 
LoggingConfigHandler lc, NodeStarter ns, Executor executor) throws 
NodeInitException {
                // Easy stuff
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                String tmp = "Initializing Node using Freenet Build 
#"+Version.buildNumber()+" r"+Version.cvsRevision+" and freenet-ext Build 
#"+NodeStarter.extBuildNumber+" r"+NodeStarter.extRevisionNumber+" with 
"+System.getProperty("java.vendor")+" JVM version 
"+System.getProperty("java.version")+" running on 
"+System.getProperty("os.arch")+' '+System.getProperty("os.name")+' 
'+System.getProperty("os.version");
                Logger.normal(this, tmp);
                System.out.println(tmp);
@@ -755,7 +760,7 @@
                        this.fastWeakRandom = weakRandom;

                nodeNameUserAlert = new MeaningfulNodeNameUserAlert(this);
-               recentlyCompletedIDs = new LRUQueue();
+               recentlyCompletedIDs = new LRUQueue<Long>();
                this.config = config;
                cachedPubKeys = new LRUHashtable<ByteArrayWrapper, 
DSAPublicKey>();
                lm = new LocationManager(random, this);
@@ -2041,6 +2046,14 @@
                registerNodeToNodeMessageListener(N2N_MESSAGE_TYPE_FPROXY, 
fproxyN2NMListener);
                
registerNodeToNodeMessageListener(Node.N2N_MESSAGE_TYPE_DIFFNODEREF, 
diffNoderefListener);

+               // FIXME this is a hack
+               // toadlet server should start after all initialized
+               // see NodeClientCore line 437
+               if (toadlets.isEnabled()) {
+                       toadlets.createFproxy();
+                       toadlets.removeStartupToadlet();
+               }
+
                Logger.normal(this, "Node constructor completed");
                System.out.println("Node constructor completed");
        }
@@ -2522,7 +2535,6 @@
         * RequestSender.
         */
        public Object makeRequestSender(Key key, short htl, long uid, PeerNode 
source, boolean localOnly, boolean cache, boolean ignoreStore, boolean 
offersOnly) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "makeRequestSender("+key+ ',' 
+htl+ ',' +uid+ ',' +source+") on "+getDarknetPortNumber());
                // In store?
                KeyBlock chk = null;
@@ -2950,7 +2962,6 @@
         */
        public CHKInsertSender makeInsertSender(NodeCHK key, short htl, long 
uid, PeerNode source,
                        byte[] headers, PartiallyReceivedBlock prb, boolean 
fromStore, boolean cache) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "makeInsertSender("+key+ ',' 
+htl+ ',' +uid+ ',' +source+",...,"+fromStore);
                KeyHTLPair kh = new KeyHTLPair(key, htl, uid);
                CHKInsertSender is = null;
@@ -3299,7 +3310,7 @@
                return sb.toString();
        }

-       final LRUQueue recentlyCompletedIDs;
+       final LRUQueue<Long> recentlyCompletedIDs;

        static final int MAX_RECENTLY_COMPLETED_IDS = 10*1000;
        /** Length of signature parameters R and S */
@@ -4164,7 +4175,7 @@
                Logger.normal(this, "TURTLING: "+sender.key+" for "+sender);
                // Do not transfer coalesce!!
                synchronized(transferringRequestSenders) {
-                       transferringRequestSenders.remove((NodeCHK)sender.key);
+                       transferringRequestSenders.remove(sender.key);
                }
                turtleCount++;


Modified: branches/db4o/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeClientCore.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/NodeClientCore.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -490,11 +490,6 @@
                toadletContainer = toadlets;
                toadletContainer.setCore(this);
                toadletContainer.setBucketFactory(tempBucketFactory);
-               if(toadletContainer.isEnabled()) {
-                       toadletContainer.createFproxy();
-                       toadletContainer.removeStartupToadlet();
-               }
-
                fecQueue.init(RequestStarter.NUMBER_OF_PRIORITY_CLASSES, 
FEC_QUEUE_CACHE_SIZE, clientContext.jobRunner, node.executor, clientContext);
                OOMHandler.addOOMHook(this);
        }
@@ -1296,6 +1291,10 @@
                }
                return false;
        }
+       
+       public File[] getAllowedUploadDirs() {
+               return uploadAllowedDirs;
+       }

        public SimpleFieldSet persistThrottlesToFieldSet() {
                return requestStarters.persistToFieldSet();

Modified: branches/db4o/freenet/src/freenet/node/NodeCryptoConfig.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeCryptoConfig.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/NodeCryptoConfig.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -24,9 +24,6 @@
  * @author toad
  */
 public class NodeCryptoConfig {
-
-       private final boolean isOpennet;
-       
        /** Port number. -1 = choose a random available port number at 
activation time. */
        private int portNumber;

@@ -59,8 +56,6 @@
        private boolean paddDataPackets;

        NodeCryptoConfig(SubConfig config, int sortOrder, boolean isOpennet, 
SecurityLevels securityLevels) throws NodeInitException {
-               this.isOpennet = isOpennet;
-               
                config.register("listenPort", -1 /* means random */, 
sortOrder++, true, true, "Node.port", "Node.portLong",     new IntCallback() {
                        @Override
                        public Integer get() {

Modified: branches/db4o/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeDispatcher.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/NodeDispatcher.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -19,6 +19,7 @@
 import freenet.keys.NodeSSK;
 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.ShortBuffer;

 /**
@@ -38,7 +39,18 @@
  */
 public class NodeDispatcher implements Dispatcher, Runnable {

-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
+
        final Node node;
        private NodeStats nodeStats;
        private NodeDispatcherCallback callback;
@@ -49,7 +61,6 @@
        NodeDispatcher(Node node) {
                this.node = node;
                this.nodeStats = node.nodeStats;
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                node.getTicker().queueTimedJob(this, STALE_CONTEXT_CHECK);
        }

@@ -74,7 +85,6 @@
        }

        public boolean handleMessage(Message m) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                PeerNode source = (PeerNode)m.getSource();
                if(source == null) {
                        // Node has been disconnected and garbage collected 
already! Ouch.
@@ -178,7 +188,7 @@
                }

                if(!source.isRoutable()) return false;
-               if(Logger.shouldLog(Logger.DEBUG, this)) Logger.debug(this, 
"Not routable");
+               if(logDEBUG) Logger.debug(this, "Not routable");

                if(spec == DMT.FNPNetworkID) {
                        source.handleFNPNetworkID(m);
@@ -825,4 +835,4 @@
        public void setHook(NodeDispatcherCallback cb) {
                this.callback = cb;
        }
-}
\ No newline at end of file
+}

Modified: branches/db4o/freenet/src/freenet/node/NodePinger.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodePinger.java      2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/NodePinger.java      2009-03-18 
00:11:38 UTC (rev 26082)
@@ -6,15 +6,28 @@
 import java.util.Arrays;

 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;

 /**
  * Track average round-trip time for each peer node, get a geometric mean.
  */
 public class NodePinger implements Runnable {
+    private static volatile boolean logMINOR;

-       private double meanPing = 0;
+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+            }
+        });
+    }
+
+       private final Node node;
+       private volatile double meanPing = 0;

-       static final double CRAZY_MAX_PING_TIME = 365.25*24*60*60*1000;
+       public static final double CRAZY_MAX_PING_TIME = 365.25*24*60*60*1000;

        NodePinger(Node n) {
                this.node = n;
@@ -24,35 +37,36 @@
                run();
        }

-       final Node node;
-       
        public void run() {
-           //freenet.support.OSThread.RealOSThread.logPID(this);
-               try {
-                       recalculateMean(node.peers.connectedPeers);
-               } finally {
-                       node.ps.queueTimedJob(this, 200);
-               }
+        // Requeue *before* so that it's accurate in any case
+        node.ps.queueTimedJob(this, 200);
+        
+        PeerNode[] peers = null;
+        synchronized(node.peers) {
+           if((node.peers.connectedPeers == null) || 
(node.peers.connectedPeers.length == 0)) return;
+           peers = new PeerNode[node.peers.connectedPeers.length];
+            System.arraycopy(node.peers.connectedPeers, 0, peers, 0, 
node.peers.connectedPeers.length);
+        }
+
+        // Now we don't have to care about synchronization anymore
+        recalculateMean(peers);
        }

        /** Recalculate the mean ping time */
-       void recalculateMean(PeerNode[] peers) {
+       private void recalculateMean(PeerNode[] peers) {
                if(peers.length == 0) return;
                meanPing = calculateMedianPing(peers);
-               if(Logger.shouldLog(Logger.MINOR, this))
+               if(logMINOR)
                        Logger.minor(this, "Median ping: "+meanPing);
        }

-       double calculateMedianPing(PeerNode[] peers) {
-               
+       private double calculateMedianPing(PeerNode[] peers) {
                double[] allPeers = new double[peers.length];
+        for(int i = 0; i < peers.length; i++) {
+            PeerNode peer = peers[i];
+            allPeers[i] = peer.averagePingTime();
+        }

-               for(int i=0;i<peers.length;i++) {
-                       PeerNode peer = peers[i];
-                       double pingTime = peer.averagePingTime();
-                       allPeers[i] = pingTime;
-               }
-               
                Arrays.sort(allPeers);
                return allPeers[peers.length / 2];
        }

Modified: branches/db4o/freenet/src/freenet/node/NodeStats.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/NodeStats.java       2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/NodeStats.java       2009-03-18 
00:11:38 UTC (rev 26082)
@@ -13,6 +13,7 @@
 import freenet.node.SecurityLevels.NETWORK_THREAT_LEVEL;
 import freenet.support.HTMLNode;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.SimpleFieldSet;
 import freenet.support.StringCounter;
 import freenet.support.TimeUtil;
@@ -67,7 +68,17 @@

        final RandomSource hardRandom;

-       private boolean logMINOR;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }

        /** first time bwlimitDelay was over PeerManagerUserAlert threshold */
        private long firstBwlimitDelayTimeThresholdBreak ;
@@ -192,7 +203,6 @@
        private static final long peerManagerUserAlertStatsUpdateInterval = 
1000;  // 1 second

        NodeStats(Node node, int sortOrder, SubConfig statsConfig, int 
obwLimit, int ibwLimit, File nodeDir) throws NodeInitException {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                this.node = node;
                this.peers = node.peers;
                this.hardRandom = node.random;
@@ -204,6 +214,8 @@
                ThreadGroup tg = Thread.currentThread().getThreadGroup();
                while(tg.getParent() != null) tg = tg.getParent();
                this.rootThreadGroup = tg;
+               this.activeThreadsByPriorities = new 
int[NativeThread.JAVA_PRIORITY_RANGE];
+               this.waitingThreadsByPriorities = new 
int[NativeThread.JAVA_PRIORITY_RANGE];
                throttledPacketSendAverage =
                        new TimeDecayingRunningAverage(1, 10*60*1000 /* should 
be significantly longer than a typical transfer */, 0, Long.MAX_VALUE, node);
                nodePinger = new NodePinger(node);
@@ -425,6 +437,10 @@
                                        long end = System.currentTimeMillis();
                                        if(logMINOR)
                                                Logger.minor(this, "Throttle 
check took "+TimeUtil.formatTime(end-now,2,true));
+
+                                       // Doesn't belong here... but anyway, 
should do the job.
+                                       activeThreadsByPriorities = 
node.executor.runningThreads();
+                                       waitingThreadsByPriorities = 
node.executor.waitingThreads();
                                }
                        }
        };
@@ -436,7 +452,6 @@

        /* return reject reason as string if should reject, otherwise return 
null */
        public String shouldRejectRequest(boolean canAcceptAnyway, boolean 
isInsert, boolean isSSK, boolean isLocal, boolean isOfferReply, PeerNode 
source) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) dumpByteCostAverages();

                int threadCount = getActiveThreadCount();
@@ -923,7 +938,7 @@
                        } else {
                                nodeAveragePingAlertRelevant = false;
                        }
-                       if(logMINOR && Logger.shouldLog(Logger.DEBUG, this)) 
Logger.debug(this, "mUPMUAS: "+now+": "+getBwlimitDelayTime()+" >? 
"+MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD+" since 
"+firstBwlimitDelayTimeThresholdBreak+" ("+bwlimitDelayAlertRelevant+") 
"+getNodeAveragePingTime()+" >? "+MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD+" 
since "+firstNodeAveragePingTimeThresholdBreak+" 
("+nodeAveragePingAlertRelevant+ ')');
+                       if(logDEBUG) Logger.debug(this, "mUPMUAS: "+now+": 
"+getBwlimitDelayTime()+" >? "+MAX_BWLIMIT_DELAY_TIME_ALERT_THRESHOLD+" since 
"+firstBwlimitDelayTimeThresholdBreak+" ("+bwlimitDelayAlertRelevant+") 
"+getNodeAveragePingTime()+" >? "+MAX_NODE_AVERAGE_PING_TIME_ALERT_THRESHOLD+" 
since "+firstNodeAveragePingTimeThresholdBreak+" 
("+nodeAveragePingAlertRelevant+ ')');
                        nextPeerManagerUserAlertStatsUpdateTime = now + 
peerManagerUserAlertStatsUpdateInterval;
                }
        }
@@ -1014,13 +1029,7 @@
        }

        public int getActiveThreadCount() {
-               int waitingThreads = 0;
-               waitingThreadsByPriorities = node.executor.waitingThreads();
-               activeThreadsByPriorities = node.executor.runningThreads();
-               for(int i=0; i<waitingThreadsByPriorities.length; i++)
-                       waitingThreads += waitingThreadsByPriorities[i];
-               
-               return rootThreadGroup.activeCount() - waitingThreads;
+               return rootThreadGroup.activeCount() - 
node.executor.getWaitingThreadsCount();
        }

        public int[] getActiveThreadsByPriority() {
@@ -1366,7 +1375,7 @@
        }

        public synchronized void insertSentBytes(boolean ssk, int x) {
-               if(Logger.shouldLog(Logger.DEBUG, this)) 
+               if(logDEBUG) 
                        Logger.debug(this, "insertSentBytes("+ssk+", "+x+")");
                if(ssk)
                        sskInsertSentBytes += x;

Modified: branches/db4o/freenet/src/freenet/node/OpennetManager.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/OpennetManager.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/OpennetManager.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -54,10 +54,10 @@

        /** Our peers. PeerNode's are promoted when they successfully fetch a 
key. Normally we take
         * the bottom peer, but if that isn't eligible to be dropped, we 
iterate up the list. */
-       private final LRUQueue peersLRU;
+       private final LRUQueue<PeerNode> peersLRU;
        /** Old peers. Opennet peers which we dropped but would still like to 
talk to
         * if we have no other option. */
-       private final LRUQueue oldPeers;
+       private final LRUQueue<PeerNode> oldPeers;
        /** Maximum number of old peers */
        static final int MAX_OLD_PEERS = 25;
        /** Time at which last dropped a peer */
@@ -127,8 +127,8 @@
                                crypto.initCrypto();
                        }
                }
-               peersLRU = new LRUQueue();
-               oldPeers = new LRUQueue();
+               peersLRU = new LRUQueue<PeerNode>();
+               oldPeers = new LRUQueue<PeerNode>();
                node.peers.tryReadPeers(new File(node.nodeDir, 
"openpeers-"+crypto.portNumber).toString(), crypto, this, true, false);
                OpennetPeerNode[] nodes = node.peers.getOpennetPeers();
                Arrays.sort(nodes, new Comparator<OpennetPeerNode>() {
@@ -426,8 +426,8 @@
         */
        synchronized public int getSize() {
                int x = 0;
-               for(Enumeration e = peersLRU.elements();e.hasMoreElements();) {
-                       PeerNode pn = (PeerNode) e.nextElement();
+               for (Enumeration<PeerNode> e = peersLRU.elements(); 
e.hasMoreElements();) {
+                       PeerNode pn = e.nextElement();
                        if(!(pn.isConnected() && 
pn.isUnroutableOlderVersion())) x++;
                }
                return x;
@@ -439,7 +439,7 @@
                        return null;
                } else {
                        // Do we want it?
-                       OpennetPeerNode[] peers = (OpennetPeerNode[]) 
peersLRU.toArrayOrdered(new OpennetPeerNode[peersLRU.size()]);
+                       OpennetPeerNode[] peers = peersLRU.toArrayOrdered(new 
OpennetPeerNode[peersLRU.size()]);
                        for(int i=0;i<peers.length;i++) {
                                OpennetPeerNode pn = peers[i];
                                if(pn.isConnected() && 
pn.isUnroutableOlderVersion()) {
@@ -506,11 +506,11 @@
        }

        synchronized PeerNode[] getOldPeers() {
-               return (PeerNode[]) oldPeers.toArrayOrdered(new 
PeerNode[oldPeers.size()]);
+               return oldPeers.toArrayOrdered(new PeerNode[oldPeers.size()]);
        }

        synchronized PeerNode[] getUnsortedOldPeers() {
-               return (PeerNode[]) oldPeers.toArray(new 
PeerNode[oldPeers.size()]);
+               return oldPeers.toArray(new PeerNode[oldPeers.size()]);
        }

        /**

Modified: branches/db4o/freenet/src/freenet/node/PacketSender.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/PacketSender.java    2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/PacketSender.java    2009-03-18 
00:11:38 UTC (rev 26082)
@@ -4,10 +4,8 @@
 package freenet.node;

 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.HashSet;
 import java.util.List;
-import java.util.TimeZone;
 import java.util.TreeMap;
 import java.util.Vector;

@@ -18,6 +16,7 @@
 import freenet.node.useralerts.UserAlert;
 import freenet.support.FileLoggerHook;
 import freenet.support.HTMLNode;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;
 import freenet.support.OOMHandler;
 import freenet.support.TimeUtil;
@@ -34,8 +33,18 @@
 // a generic task scheduler. Either rename this class, or create another 
tricker for non-Packet tasks
 public class PacketSender implements Runnable, Ticker {

-       private static boolean logMINOR;
-       private static boolean logDEBUG;
+       private static volatile boolean logMINOR;
+       private static volatile boolean logDEBUG;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+                       }
+               });
+       }
+
        /** Maximum time we will queue a message for in milliseconds */
        static final int MAX_COALESCING_DELAY = 100;
        /** If opennet is enabled, and there are fewer than this many 
connections,
@@ -60,7 +69,6 @@
        volatile int lastTimeInSeconds;
        private Vector<ResendPacketItem> rpiTemp;
        private int[] rpiIntTemp;
-       private boolean started = false;

        private final static class Job {
                final String name;
@@ -76,8 +84,6 @@
                this.node = node;
                myThread = new NativeThread(this, "PacketSender thread for " + 
node.getDarknetPortNumber(), NativeThread.MAX_PRIORITY, false);
                myThread.setDaemon(true);
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
-               logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
                rpiTemp = new Vector<ResendPacketItem>();
                rpiIntTemp = new int[64];
        }
@@ -161,7 +167,6 @@
                        t1.setDaemon(true);
                        t1.start();
                }
-               started = true;
                myThread.start();
        }

@@ -176,7 +181,6 @@
                while(true) {
                        lastReceivedPacketFromAnyNode = lastReportedNoPackets;
                        try {
-                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                                brokeAt = realRun(brokeAt);
                        } catch(OutOfMemoryError e) {
                                OOMHandler.handleOOM(e);
@@ -423,8 +427,6 @@

                if(sleepTime > 0) {
                        // Update logging only when have time to do so
-                       logMINOR = Logger.shouldLog(Logger.MINOR, this);
-                       logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
                        try {
                                synchronized(this) {
                                        if(logMINOR)

Modified: branches/db4o/freenet/src/freenet/node/PacketTracker.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/PacketTracker.java   2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/PacketTracker.java   2009-03-18 
00:11:38 UTC (rev 26082)
@@ -18,6 +18,7 @@
 import freenet.support.LimitedRangeIntByteArrayMap;
 import freenet.support.LimitedRangeIntByteArrayMapElement;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.ReceivedPacketNumbers;
 import freenet.support.TimeUtil;
 import freenet.support.UpdatableSortedLinkedListItem;
@@ -34,7 +35,16 @@
  */
 public class PacketTracker {

-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
+
        /** Parent PeerNode */
        public final PeerNode pn;
        /** Are we the secondary key? */
@@ -101,7 +111,6 @@
                isDeprecated = false;
                nextPacketNumber = pn.node.random.nextInt(100 * 1000);
                createdTime = System.currentTimeMillis();
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
        }

        /**
@@ -113,7 +122,6 @@
         * packet number. However, old resend requests etc may still be sent.
         */
        public void deprecated() {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Deprecated: "+this);
                isDeprecated = true;
                sentPacketsContents.interrupt();
@@ -361,7 +369,6 @@
         */
        public synchronized void receivedPacket(int seqNumber) {
                timeLastDecodedPacket = System.currentTimeMillis();
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, "Received packet " + seqNumber + " 
from " + pn.shortToString());
                if(seqNumber == -1)
@@ -548,7 +555,6 @@
         * @param realSeqNo
         */
        public void acknowledgedPacket(int realSeqNo) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                AsyncMessageCallback[] callbacks;
                if(logMINOR)
                        Logger.minor(this, "Acknowledged packet: " + realSeqNo);

Modified: branches/db4o/freenet/src/freenet/node/PeerNode.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/PeerNode.java        2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/PeerNode.java        2009-03-18 
00:11:38 UTC (rev 26082)
@@ -62,6 +62,7 @@
 import freenet.support.Fields;
 import freenet.support.HexUtil;
 import freenet.support.IllegalBase64Exception;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;
 import freenet.support.SimpleFieldSet;
 import freenet.support.TimeUtil;
@@ -348,7 +349,15 @@
         *  responder in message2 match what was chosen in message 1
         */
        protected final HashMap<Peer,byte[]> jfkNoncesSent = new 
HashMap<Peer,byte[]>();
-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }

        /**
         * If this returns true, we will generate the identity from the pubkey.
@@ -378,7 +387,6 @@
        public PeerNode(SimpleFieldSet fs, Node node2, NodeCrypto crypto, 
PeerManager peers, boolean fromLocal, boolean fromAnonymousInitiator, 
OutgoingPacketMangler mangler, boolean isOpennet) throws FSParseException, 
PeerParseException, ReferenceSignatureVerificationException {
                boolean noSig = false;
                if(fromLocal || fromAnonymousInitiator) noSig = true;
-               logMINOR = Logger.shouldLog(Logger.MINOR, PeerNode.class);
                myRef = new WeakReference<PeerNode>(this);
                this.outgoingMangler = mangler;
                this.node = node2;
@@ -1597,8 +1605,6 @@
        }

        public void updateLocation(double newLoc, double[] newLocs) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, PeerNode.class);
-               
                if(newLoc < 0.0 || newLoc > 1.0) {
                        Logger.error(this, "Invalid location update for " + 
this+ " ("+newLoc+')', new Exception("error"));
                        // Ignore it
@@ -1832,7 +1838,6 @@
        * it's a new tracker. -1 to indicate failure.
        */
        public long completedHandshake(long thisBootID, byte[] data, int 
offset, int length, BlockCipher encCipher, byte[] encKey, Peer replyTo, boolean 
unverified, int negType, long trackerID, boolean isJFK4, boolean jfk4SameAsOld) 
{
-               logMINOR = Logger.shouldLog(Logger.MINOR, PeerNode.class);
                long now = System.currentTimeMillis();
                if(logMINOR) Logger.minor(this, "Tracker ID "+trackerID+" 
isJFK4="+isJFK4+" jfk4SameAsOld="+jfk4SameAsOld);

@@ -2841,6 +2846,7 @@
         * Back off this node for a while.
         */
        public void localRejectedOverload(String reason) {
+               assert reason.indexOf(" ") == -1;
                pRejected.report(1.0);
                if(logMINOR)
                        Logger.minor(this, "Local rejected overload (" + reason 
+ ") on " + this + " : pRejected=" + pRejected.currentValue());
@@ -2902,6 +2908,7 @@
         * Back off this node for a while.
         */
        public void transferFailed(String reason) {
+               assert reason.indexOf(" ") == -1;
                pRejected.report(1.0);
                if(logMINOR)
                        Logger.minor(this, "Transfer failed (" + reason + ") on 
" + this + " : pRejected=" + pRejected.currentValue());
@@ -4067,7 +4074,7 @@
        }

        public short getUptime() {
-               return (short)(((int)uptime) & 0xFF);
+               return (short) (uptime & 0xFF);
        }

        public void incrementNumberOfSelections(long time) {

Modified: branches/db4o/freenet/src/freenet/node/PeerNodeStatus.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/PeerNodeStatus.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/PeerNodeStatus.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -8,7 +8,6 @@
 import freenet.clients.http.DarknetConnectionsToadlet;
 import freenet.io.comm.Peer;
 import freenet.io.xfer.PacketThrottle;
-import freenet.support.Logger;

 /**
  * Contains various status information for a {@link PeerNode}. Used e.g. in

Modified: branches/db4o/freenet/src/freenet/node/RequestSender.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestSender.java   2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/RequestSender.java   2009-03-18 
00:11:38 UTC (rev 26082)
@@ -31,6 +31,7 @@
 import freenet.node.FailureTable.OfferList;
 import freenet.store.KeyCollisionException;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.ShortBuffer;
 import freenet.support.SimpleFieldSet;
 import freenet.support.TimeUtil;
@@ -141,7 +142,14 @@
        return getStatusString(getStatus());
     }

-    private static boolean logMINOR;
+    private static volatile boolean logMINOR;
+    static {
+       Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+               public void shouldUpdate(){
+                       logMINOR = Logger.shouldLog(Logger.MINOR, this);
+               }
+       });
+    }

     @Override
        public String toString() {
@@ -166,7 +174,6 @@
         this.tryOffersOnly = offersOnly;
         target = key.toNormalizedDouble();
         node.addRequestSender(key, htl, this);
-        logMINOR = Logger.shouldLog(Logger.MINOR, this);
     }

     public void start() {
@@ -818,7 +825,7 @@
                                        else {
                                                Logger.error(this, "TURTLE 
SUCCEEDED: "+key+" for "+this+" in "+TimeUtil.formatTime(transferTime, 2, 
true));
                                                if(!turtleBackedOff)
-                                                       
next.transferFailed("Turtled transfer");
+                                                       
next.transferFailed("TurtledTransfer");
                                                
node.nodeStats.turtleSucceeded();
                                        }
                                next.successNotOverload();

Modified: branches/db4o/freenet/src/freenet/node/RequestStarter.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestStarter.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/RequestStarter.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -15,6 +15,7 @@
 import freenet.support.RandomGrabArrayItemExclusionList;
 import freenet.support.TokenBucket;
 import freenet.support.math.RunningAverage;
+import freenet.support.LogThresholdCallback;

 /**
  * Starts requests.
@@ -23,7 +24,16 @@
  * clients on the same priority level.
  */
 public class RequestStarter implements Runnable, 
RandomGrabArrayItemExclusionList {
+       private static volatile boolean logMINOR;

+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
+
        /*
         * Priority classes
         */
@@ -115,7 +125,6 @@
                                }
                                continue;
                        }
-                       boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        if(req == null) {
                                req = sched.grabRequest();
                        }
@@ -234,7 +243,7 @@
                                else
                                        Logger.normal(this, "run() not able to 
send a request on "+req+" - request was cancelled");
                        }
-                       if(Logger.shouldLog(Logger.MINOR, this)) 
+                       if(logMINOR) 
                                Logger.minor(this, "Finished "+req);
                        } finally {
                                if(key != null) sched.removeFetchingKey(key);

Modified: branches/db4o/freenet/src/freenet/node/RequestTag.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/RequestTag.java      2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/RequestTag.java      2009-03-18 
00:11:38 UTC (rev 26082)
@@ -2,12 +2,12 @@

 import java.lang.ref.WeakReference;

-import freenet.io.comm.NotConnectedException;
 import freenet.support.Logger;
 import freenet.support.TimeUtil;

 /**
  * Tag for a request.
+ * 
  * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450)
  */
 public class RequestTag extends UIDTag {

Modified: branches/db4o/freenet/src/freenet/node/SendableGetRequestSender.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGetRequestSender.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/SendableGetRequestSender.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -3,10 +3,23 @@
 import freenet.client.async.ChosenBlock;
 import freenet.client.async.ClientContext;
 import freenet.keys.ClientKey;
+import freenet.support.LogThresholdCallback;
 import freenet.support.Logger;

 public class SendableGetRequestSender implements SendableRequestSender {

+       private static volatile boolean logMINOR;
+       
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+                       
+                       @Override
+                       public void shouldUpdate() {
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
+       
        /** Do the request, blocking. Called by RequestStarter. 
         * Also responsible for deleting it.
         * @return True if a request was executed. False if caller should try 
to find another request, and remove
@@ -18,8 +31,7 @@
                        Logger.error(SendableGet.class, "Key is null in send(): 
keyNum = "+keyNum+" for "+req);
                        return false;
                }
-               boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
-               if(Logger.shouldLog(Logger.MINOR, SendableGet.class))
+               if(logMINOR)
                        Logger.minor(SendableGet.class, "Sending get for key 
"+keyNum+" : "+key);
                if(req.isCancelled()) {
                        if(logMINOR) Logger.minor(SendableGet.class, 
"Cancelled: "+req);

Modified: branches/db4o/freenet/src/freenet/node/StillNotAckedException.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/StillNotAckedException.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/StillNotAckedException.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -11,6 +11,7 @@
  * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450)
  */
 public class StillNotAckedException extends Exception {
+       private static final long serialVersionUID = 1L;

        public StillNotAckedException(PacketTracker tracker) {
                this.tracker = tracker;

Modified: 
branches/db4o/freenet/src/freenet/node/TextModeClientInterfaceServer.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/TextModeClientInterfaceServer.java   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -276,8 +276,10 @@
                        // Maybe something has changed?
                                if(port != curPort) break;
                                if(!(this.bindTo.equals(tempBindTo))) break;
-                       try {
+                try {
                                Socket s = networkInterface.accept();
+                    if(s == null)
+                        continue; // timeout
                                InputStream in = s.getInputStream();
                                OutputStream out = s.getOutputStream();

@@ -285,9 +287,6 @@
                                        new TextModeClientInterface(this, in, 
out);

                                n.executor.execute(tmci, "Text mode client 
interface handler for "+s.getPort());
-                               
-                       } catch (SocketTimeoutException e) {
-                               // Ignore and try again
                        } catch (SocketException e){
                                Logger.error(this, "Socket error : "+e, e);
                        } catch (IOException e) {

Modified: branches/db4o/freenet/src/freenet/node/Version.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Version.java 2009-03-17 23:32:40 UTC 
(rev 26081)
+++ branches/db4o/freenet/src/freenet/node/Version.java 2009-03-18 00:11:38 UTC 
(rev 26082)
@@ -24,7 +24,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 1204;
+       private static final int buildNumber = 1205;

        /** Oldest build of Fred we will talk to */
        private static final int oldLastGoodBuild = 1197;

Modified: branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -18,6 +18,7 @@
 import freenet.client.async.DBJob;
 import freenet.support.HexUtil;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.api.BucketFactory;
 import freenet.support.io.Closer;
 import freenet.support.io.FileUtil;
@@ -70,16 +71,22 @@
        final BucketFactory bf;
        final HashMap<String, ClientRequest> requestsByIdentifier;
        protected final String connectionIdentifier;
-       static boolean logMINOR;
+       private static volatile boolean logMINOR;
        private boolean killedDupe;

+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
        // We are confident that the given client can access those
        private final HashMap<String, DirectoryAccess> checkedDirectories = new 
HashMap<String, DirectoryAccess>();
        // DDACheckJobs in flight
        private final HashMap<File, DDACheckJob> inTestDirectories = new 
HashMap<File, DDACheckJob>();

        public FCPConnectionHandler(Socket s, FCPServer server) {
-               logMINOR = Logger.shouldLog(Logger.MINOR, this);
                this.sock = s;
                this.server = server;
                isClosed = false;
@@ -198,7 +205,7 @@
                        }

                }, NativeThread.NORM_PRIORITY, false);
-               if(Logger.shouldLog(Logger.MINOR, this))
+               if(logMINOR)
                        Logger.minor(this, "Set client name: "+name);
        }

@@ -281,7 +288,7 @@
        }

        public void startClientPut(final ClientPutMessage message) {
-               if(Logger.shouldLog(Logger.MINOR, this))
+               if(logMINOR)
                        Logger.minor(this, "Starting insert 
ID=\""+message.identifier+ '"');
                final String id = message.identifier;
                final boolean global = message.global;
@@ -364,7 +371,7 @@
        }

        public void startClientPutDir(ClientPutDirMessage message, 
HashMap<String, Object> buckets, boolean wasDiskPut) {
-               if(Logger.shouldLog(Logger.MINOR, this))
+               if(logMINOR)
                        Logger.minor(this, "Start ClientPutDir");
                final String id = message.identifier;
                final boolean global = message.global;
@@ -426,7 +433,7 @@
                                cp.cancel(null, server.core.clientContext);
                        return;
                } else {
-                       if(Logger.shouldLog(Logger.MINOR, this))
+                       if(logMINOR)
                                Logger.minor(this, "Starting "+cp);
                        cp.start(null, server.core.clientContext);
                }

Modified: 
branches/db4o/freenet/src/freenet/pluginmanager/RedirectPluginHTTPException.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/pluginmanager/RedirectPluginHTTPException.java
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/pluginmanager/RedirectPluginHTTPException.java
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -39,6 +39,7 @@
         * @deprecated use {@link #RedirectPluginHTTPException(String, String)}
         *             instead
         */
+       @Deprecated
        public RedirectPluginHTTPException(String message, String location, 
String newLocation) {
                super(message, location);
                this.newLocation = newLocation;

Modified: 
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java  
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java  
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -108,7 +108,7 @@
                fullKeyLength = callback.fullKeyLength();
                dataBlockLength = callback.dataLength();

-               hdPadding = (int) ((headerBlockLength + dataBlockLength) % 512 
== 0 ? 0
+               hdPadding = ((headerBlockLength + dataBlockLength) % 512 == 0 ? 0
                        : 512 - (headerBlockLength + dataBlockLength) % 512);

                this.random = random;


Property changes on: 
branches/db4o/freenet/src/freenet/support/BinaryBloomFilter.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/freenet/src/freenet/support/BinaryBloomFilter.java:22002-25209,25900
   + /trunk/freenet/src/freenet/support/BinaryBloomFilter.java:22002-25872,25900

Modified: branches/db4o/freenet/src/freenet/support/BloomFilter.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/BloomFilter.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/BloomFilter.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -136,7 +136,7 @@
                                filter.put(forkedFilter.filter);

                                filter.position(0);
-                               forkedFilter.finalize();
+                               forkedFilter.close();
                                forkedFilter = null;
                        } finally {
                                forkedLock.unlock();
@@ -151,7 +151,7 @@
                try {
                        if (forkedFilter == null)
                                return;
-                       forkedFilter.finalize();
+                       forkedFilter.close();
                        forkedFilter = null;
                } finally {
                        lock.writeLock().unlock();
@@ -196,15 +196,17 @@
                        ((MappedByteBuffer) filter).force();
                }
        }
-
-       @Override
-       protected void finalize() {
+       
+       public void close() {
                if (filter != null) {
                        force();
                }
-               // don't trust findbug, this is not a error
-               // sometimes, we call finalize() manually and this serve as a 
flag 
                filter = null;
                forkedFilter = null;
        }
+
+       @Override
+       protected void finalize() {
+               close();
+       }
 }


Property changes on: branches/db4o/freenet/src/freenet/support/BloomFilter.java
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/freenet/src/freenet/support/BloomFilter.java:22002-25209,25900
   + /trunk/freenet/src/freenet/support/BloomFilter.java:22002-25872,25900

Modified: branches/db4o/freenet/src/freenet/support/ByteBufferInputStream.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/ByteBufferInputStream.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/ByteBufferInputStream.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -175,6 +175,7 @@
        /**
         * @deprecated {@link DataInputStream#readLine()} is deprecated, so why 
not?
         */
+       @Deprecated
        public String readLine() throws IOException {
                // hmmmm bad
                return new DataInputStream(this).readLine();


Property changes on: 
branches/db4o/freenet/src/freenet/support/CountingBloomFilter.java
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk/freenet/src/freenet/support/CountingBloomFilter.java:22002-25209,25900
   + 
/trunk/freenet/src/freenet/support/CountingBloomFilter.java:22002-25872,25900

Copied: branches/db4o/freenet/src/freenet/support/CurrentTimeUTC.java (from rev 
25872, trunk/freenet/src/freenet/support/CurrentTimeUTC.java)
===================================================================
--- branches/db4o/freenet/src/freenet/support/CurrentTimeUTC.java               
                (rev 0)
+++ branches/db4o/freenet/src/freenet/support/CurrentTimeUTC.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -0,0 +1,53 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+
+/**
+ * A wrapper class around a GregorianCalendar which always returns the current 
time.
+ * This is useful for working around the pitfall of class Calendar: It only 
returns the current time when you first use a get*() function,
+ * in any get*() calls after the first call, the time value of the first call 
is returned. One would have to call Calendar.clear() before each
+ * get to obtain the current time and this class takes care of that for you.
+ * 
+ * Further, this class is synchronized so you do not need to worry about 
synchronization of a Calendar anymore.
+ */
+public class CurrentTimeUTC {
+
+       private static final GregorianCalendar mCalendar = new 
GregorianCalendar(TimeZone.getTimeZone("UTC"));
+
+       public static Date get() {
+               return new Date();
+       }
+
+       public static long getInMillis() {
+               return System.currentTimeMillis();
+       }
+
+       public static int getYear() {
+               synchronized(mCalendar) {
+                       mCalendar.setTimeInMillis(System.currentTimeMillis());
+                       return mCalendar.get(Calendar.YEAR);
+               }
+       }
+
+       public static int getMonth() {
+               synchronized(mCalendar) {
+                       mCalendar.setTimeInMillis(System.currentTimeMillis());
+                       return mCalendar.get(Calendar.MONTH);
+               }
+       }
+
+       public static int getDayOfMonth() {
+               synchronized(mCalendar) {
+                       mCalendar.setTimeInMillis(System.currentTimeMillis());
+                       return mCalendar.get(Calendar.DAY_OF_MONTH);
+               }
+       }
+
+}

Modified: branches/db4o/freenet/src/freenet/support/DoublyLinkedList.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/DoublyLinkedList.java     
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/DoublyLinkedList.java     
2009-03-18 00:11:38 UTC (rev 26082)
@@ -6,36 +6,36 @@
  * Framework for managing a doubly linked list.
  * @author tavin
  */
-public interface DoublyLinkedList<T> extends Iterable<T> {
-    public abstract DoublyLinkedList<T> clone();
+public interface DoublyLinkedList<T extends DoublyLinkedList.Item<?>> extends 
Iterable<T> {
+       // public abstract DoublyLinkedList<T> clone();

     /**
      * List element
      */
-    public interface Item<T> {
+       public interface Item<T extends DoublyLinkedList.Item<?>> {
                /**
                 * Get next {@link Item}. May or may not return
                 * <code>null</code> if this is the last <code>Item</code>.
                 * 
                 * @see DoublyLinkedList#hasNext()
                 */
-        DoublyLinkedList.Item<T> getNext();
+               T getNext();
         /** Set next {@link Item} */
-        DoublyLinkedList.Item<T> setNext(DoublyLinkedList.Item<T> i);
+               T setNext(Item<?> i);
         /**
         * Get previous {@link Item}. May or may not return <code>null</code>
         * if this is the first <code>Item</code>.
         * 
         * @see DoublyLinkedList#hasNext()
         */
-        Item<T> getPrev();
+               T getPrev();
         /** Get previous {@link Item} */
-        Item<T> setPrev(DoublyLinkedList.Item<T> i);
+               T setPrev(Item<?> i);

         /** Return the contained list. <strong>For sanity checking 
only.</strong> */
-        DoublyLinkedList<T> getParent();
+               DoublyLinkedList<? super T> getParent();
         /** Set the contained list. <strong>For sanity checking 
only.</strong>*/
-        DoublyLinkedList<T> setParent(DoublyLinkedList<T> l);
+               DoublyLinkedList<? super T> setParent(DoublyLinkedList<? super 
T> l);
     }

     /** Clear this list */
@@ -45,33 +45,32 @@
     /** Check if this list is empty. @return <code>true</code> if this list is 
empty, <code>false</code> otherwise. */
     boolean isEmpty();
     /** Get a {@link Enumeration} of {@link DoublyLinkedList.Item}. */
-    Enumeration elements();   // for consistency w/ typical Java API
+       Enumeration<T> elements(); // for consistency w/ typical Java API

-    
     /**
      * Returns true if the passed item is contained in the list.
      */
-    public boolean contains(DoublyLinkedList.Item<T> item);
+       public boolean contains(T item);

     /**
      * Returns the first item.
      * @return  the item at the head of the list, or <code>null</code> if empty
      */
-    Item head();
+       T head();
     /**
      * Returns the last item.
      * @return  the item at the tail of the list, or <code>null</code> if empty
      */
-    Item tail();
+       T tail();

     /**
      * Puts the item before the first item.
      */
-    void unshift(DoublyLinkedList.Item<T> i);
+       void unshift(T i);
     /**
      * Removes and returns the first item.
      */
-    Item shift();
+       T shift();
     /**
      * Remove <tt>n</tt> elements from head and return them as a 
<code>DoublyLinkedList</code>.
      */
@@ -80,37 +79,37 @@
     /**
      * Puts the item after the last item.
      */
-    void push(DoublyLinkedList.Item<T> i);
+       void push(T i);
     /**
      * Removes and returns the last item.
      */
-    Item pop();
+       T pop();
     /**
      * Remove <tt>n</tt> elements from tail and return them as a 
<code>DoublyLinkedList</code>.
      */
-    DoublyLinkedList pop(int n);
+       DoublyLinkedList<T> pop(int n);

     /** @return <code>true</code> if <code>i</code> has next item. (ie. not 
the last item); <code>false</code> otherwise */ 
-    boolean hasNext(DoublyLinkedList.Item<T> i);
+       boolean hasNext(T i);
     /** @return <code>true</code> if <code>i</code> has previous item. (ie. 
not the first item); <code>false</code> otherwise */
-    boolean hasPrev(DoublyLinkedList.Item<T> i);
+       boolean hasPrev(T i);

     /** @return next item of <code>i</code>. If this is the last element, 
return <code>null</code> */
-    Item next(DoublyLinkedList.Item<T> i);
+       T next(T i);
     /** @return previous item of <code>i</code>. If this is the first element, 
return <code>null</code> */
-    Item prev(DoublyLinkedList.Item<T> i);
+       T prev(T i);
     /** Remove and return a element 
      * @return  this item, or <code>null</code> if the item was not in the list
      */
-    Item remove(DoublyLinkedList.Item<T> i);
+       T remove(T i);
     /**
      * Inserts item <code>j</code> before item <code>i</code>.
      */
-    void insertPrev(DoublyLinkedList.Item<T> i, DoublyLinkedList.Item<T> j);
+       void insertPrev(T i, T j);
     /**
      * Inserts item <code>j</code> after item <code>i</code.
      */
-    void insertNext(DoublyLinkedList.Item<T> i, DoublyLinkedList.Item<T> j); 
+       void insertNext(T i, T j);
 }



Modified: branches/db4o/freenet/src/freenet/support/DoublyLinkedListImpl.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/DoublyLinkedListImpl.java 
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/DoublyLinkedListImpl.java 
2009-03-18 00:11:38 UTC (rev 26082)
@@ -11,64 +11,60 @@
  * TODO: there are still some unimplemented methods
  *       -- it remains to be seen if they are needed at all
  */
-public class DoublyLinkedListImpl<T> implements DoublyLinkedList<T>{
+public class DoublyLinkedListImpl<T extends DoublyLinkedList.Item<? extends 
T>> implements DoublyLinkedList<T> {

     protected int size;
-    protected DoublyLinkedListImpl.Item<T> _headptr, _tailptr;
+       protected T _firstItem, _lastItem;

-       @Override
-    public final DoublyLinkedListImpl<T> clone() {
-        return new DoublyLinkedListImpl<T>(this);
-    }
+       //@Override
+       //public final DoublyLinkedListImpl<T> clone() {
+       //    return new DoublyLinkedListImpl<T>(this);
+       //}

     /**
      * A new list with no items.
      */
     public DoublyLinkedListImpl() {
-        _headptr = new Item<T>();
-        _tailptr = new Item<T>();
-        _headptr.setParent(this);
-        _tailptr.setParent(this);
         clear();
     }

-    protected DoublyLinkedListImpl(DoublyLinkedListImpl.Item<T> _h, 
DoublyLinkedListImpl.Item<T> _t, int size) {
-        _headptr  = _h;
-        _tailptr  = _t;
-        _headptr.setParent(this);
-        _tailptr.setParent(this);
+       protected DoublyLinkedListImpl(T _h, T _t, int size) {
+               _firstItem = _h;
+               _lastItem = _t;

-        DoublyLinkedList.Item i = _headptr;
+        T i = _firstItem;
         while (i != null ) {
                i.setParent(this);
-               i = i.getNext();
+                       i = i.getNext();
         }

         this.size = size;
     }

+       //      /**
+       //       * 
+       //       * XXX: FIXME this doesn't really work. it use .clone() method
+       //       * 
+       //       * @param impl
+       //       */
+       //    protected DoublyLinkedListImpl(DoublyLinkedListImpl<T> impl) {
+       //        this();
+       //        Enumeration<T> e = impl.forwardElements();
+       //        boolean checked = false;
+       //        for(;e.hasMoreElements();) {
+       //                      DoublyLinkedListImpl.Item oi = 
(DoublyLinkedListImpl.Item) e.nextElement();
+       //                      T i = (T) oi.clone();
+       //            if(!checked) {
+       //                checked = true;
+       //                
if(!i.getClass().getName().equals(oi.getClass().getName())) {
+       //                    System.err.println("Clone constructor failed for 
"+oi+": "+i);
+       //                    new Exception("error").printStackTrace();
+       //                }
+       //            }
+       //            this.push(i);
+       //        }
+       //    }

-    /**
-     * @param impl
-     */
-    protected DoublyLinkedListImpl(DoublyLinkedListImpl impl) {
-        this();
-        Enumeration<DoublyLinkedListImpl.Item<T>> e = impl.forwardElements();
-        boolean checked = false;
-        for(;e.hasMoreElements();) {
-            DoublyLinkedListImpl.Item<T> oi = e.nextElement();
-            DoublyLinkedList.Item<T> i = oi.clone();
-            if(!checked) {
-                checked = true;
-                if(!i.getClass().getName().equals(oi.getClass().getName())) {
-                    System.err.println("Clone constructor failed for "+oi+": 
"+i);
-                    new Exception("error").printStackTrace();
-                }
-            }
-            this.push(i);
-        }
-    }
-
     //=== DoublyLinkedList implementation 
======================================

     /**
@@ -78,19 +74,22 @@
        // Help to detect removal after clear().
        // The check in remove() is enough, strictly,
        // as long as people don't add elements afterwards.
-       DoublyLinkedList.Item<T> pos = _headptr.next;
-       DoublyLinkedList.Item<T> opos = _headptr;
+               if (_firstItem == null)
+                       return;
+
+               T pos = _firstItem;
+               T opos;
+
        while(true) {
-               if(pos == _tailptr) break;
                if(pos == null) break;
                pos.setParent(null);
                pos.setPrev(null);
                opos = pos;
-               pos = pos.getNext();
+                       pos = pos.getNext();
                opos.setNext(null);
        }
-        _headptr.next = _tailptr;
-        _tailptr.prev = _headptr;
+
+               _firstItem = _lastItem = null;
         size = 0;
     }

@@ -98,6 +97,7 @@
      * {@inheritDoc}
      */
     public final int size() {
+               assert size != 0 || (_firstItem == null && _lastItem == null);
         return size;
     }

@@ -105,6 +105,7 @@
      * {@inheritDoc}
      */
     public final boolean isEmpty() {
+               assert size != 0 || (_firstItem == null && _lastItem == null);
         return size == 0;
     }

@@ -116,7 +117,7 @@
         return forwardElements();
     }

-    public boolean contains(DoublyLinkedList.Item<T> item) {
+       public boolean contains(T item) {
        for(T i : this) {
                if(i == item)
                        return true;
@@ -127,15 +128,15 @@
     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> head() {
-        return size == 0 ? null : _headptr.next;
+       public final T head() {
+               return size == 0 ? null : _firstItem;
     }

     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> tail() {
-        return size == 0 ? null : _tailptr.prev;
+       public final T tail() {
+               return size == 0 ? null : _lastItem;
     }


@@ -143,41 +144,39 @@
     /**
      * {@inheritDoc}
      */
-    public final void unshift(DoublyLinkedList.Item<T> i) {
-        insertNext(_headptr, i);
+       public final void unshift(T i) {
+               insertNext(null, i);
     }

     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> shift() {
-        return size == 0 ? null : remove(_headptr.next);
+       public final T shift() {
+               return size == 0 ? null : remove(_firstItem);
     }
     /**
      * {@inheritDoc}
      */
     public DoublyLinkedList<T> shift(int n) {
-
         if (n > size) n = size;
         if (n < 1) return new DoublyLinkedListImpl<T>();

-        DoublyLinkedList.Item<T> i = _headptr;
-        for (int m=0; m<n; ++m)
-            i = i.getNext();
+               T i = _firstItem;
+               for (int m = 0; m < n - 1; ++m)
+                       i = i.getNext();

-        DoublyLinkedList.Item<T> j = i.getNext();
-        Item<T> newheadptr = new Item<T>();
-        Item<T> newtailptr = new Item<T>();
+               T newTailItem = i;
+               T newFirstItem = newTailItem.getNext();
+               newTailItem.setNext(null);

-        j.setPrev(newheadptr);
-        newheadptr.setNext(j);
+               DoublyLinkedList<T> newlist = new 
DoublyLinkedListImpl<T>(_firstItem, newTailItem, n);

-        i.setNext(newtailptr);
-        newtailptr.setPrev(i);
-
-        DoublyLinkedList<T> newlist = new DoublyLinkedListImpl<T>(_headptr, 
newtailptr, n);
-        _headptr = newheadptr;
-        _headptr.setParent(this);
+               if (newFirstItem != null) {
+                       newFirstItem.setPrev(null);
+                       _firstItem = newFirstItem;
+               } else {
+                       _firstItem = _lastItem = null;
+               }
         size -= n;

         return newlist;
@@ -188,41 +187,39 @@
     /**
      * {@inheritDoc}
      */
-    public final void push(DoublyLinkedList.Item<T> i) {
-        insertPrev(_tailptr, i);
+       public final void push(T i) {
+               insertPrev(null, i);
     }

     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> pop() {
-        return size == 0 ? null : remove(_tailptr.prev);
+       public final T pop() {
+               return size == 0 ? null : remove(_lastItem);
     }
+
     /**
      * {@inheritDoc}
      */
     public DoublyLinkedList<T> pop(int n) {
-
         if (n > size) n = size;
         if (n < 1) return new DoublyLinkedListImpl<T>();

-        DoublyLinkedList.Item<T> i = _tailptr;
-        for (int m=0; m<n; ++m)
-            i = i.getPrev();
+               T i = _lastItem;
+               for (int m = 0; m < n - 1; ++m)
+                       i = i.getPrev();

-        DoublyLinkedList.Item<T> j = i.getPrev();
-        DoublyLinkedListImpl.Item<T> newtailptr = new Item<T>();
-        DoublyLinkedListImpl.Item<T> newheadptr = new Item<T>();
+               T newFirstItem = i;
+               T newLastItem = newFirstItem.getPrev();
+               newFirstItem.setPrev(null);

-        j.setNext(newtailptr);
-        newtailptr.setPrev(j);
-        newtailptr.setParent(this);
+               DoublyLinkedList<T> newlist = new 
DoublyLinkedListImpl<T>(newFirstItem, _lastItem, n);

-        i.setPrev(newheadptr);
-        newheadptr.setNext(i);
-
-        DoublyLinkedList<T> newlist = new DoublyLinkedListImpl<T>(newheadptr, 
_tailptr, n);
-        _tailptr = newtailptr;
+               if (newLastItem != null) {
+                       newLastItem.setNext(null);
+                       _lastItem = newLastItem;
+               } else
+                       _firstItem = _lastItem = null;
         size -= n;

         return newlist;
@@ -233,30 +230,30 @@
     /**
      * {@inheritDoc}
      */
-    public final boolean hasNext(DoublyLinkedList.Item<T> i) {
-        DoublyLinkedList.Item<T> next = i.getNext();
-        return (next != null) && (next != _tailptr);
+       public final boolean hasNext(T i) {
+               T next = i.getNext();
+               return next != null;
     }
     /**
      * {@inheritDoc}
      */
-    public final boolean hasPrev(DoublyLinkedList.Item<T> i) {
-        DoublyLinkedList.Item<T> prev = i.getPrev();
-        return (prev != null) && (prev != _headptr);
+       public final boolean hasPrev(T i) {
+               T prev = i.getPrev();
+               return prev != null;
     }
     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> next(DoublyLinkedList.Item<T> i) {
-        DoublyLinkedList.Item<T> next = i.getNext();
-        return next == _tailptr ? null : next;
+       public final T next(T i) {
+               T next = i.getNext();
+               return next;
     }
     /**
      * {@inheritDoc}
      */
-    public final DoublyLinkedList.Item<T> prev(DoublyLinkedList.Item<T> i) {
-        DoublyLinkedList.Item<T> prev = i.getPrev();
-        return prev == _headptr ? null : prev;
+       public final T prev(T i) {
+               T prev = i.getPrev();
+               return prev;
     }


@@ -265,22 +262,34 @@
     /**
      * {@inheritDoc}
      */
-    public DoublyLinkedList.Item<T> remove(DoublyLinkedList.Item<T> i) {
+       public T remove(T i) {
        if (i.getParent() == null || isEmpty())
                        return null; // not in list
        if (i.getParent() != this)
                throw new PromiscuousItemException(i, i.getParent());
-        DoublyLinkedList.Item<T> next = i.getNext(), prev = i.getPrev();
-        if ((next == null) && (prev == null)) return null;  // not in the list
-        if ((next == null) || (prev == null))
-               throw new NullPointerException("next="+next+", prev="+prev); // 
partially in the list?!
-        if((next.getPrev() != i) || (prev.getNext() != i)) {
-               String msg = "Illegal ERROR: i="+i+", next="+next+", 
next.prev="+next.getPrev()+", prev="+prev+", prev.next="+prev.getNext();
-               Logger.error(this, msg);
-               throw new IllegalStateException(msg);
+
+               T next = i.getNext();
+               T prev = i.getPrev();
+
+               if ((next == null) && (prev == null)) // only item in list
+                       assert size == 1;
+
+               if (next == null) { // last item
+                       assert _lastItem == i;
+                       _lastItem = prev;
+               } else {
+                       assert next.getPrev() == i;
+                       next.setPrev(prev);
+               }
+
+               if (prev == null) { // first item
+                       assert _firstItem == i;
+                       _firstItem = next;
+               } else {
+                       assert prev.getNext() == i;
+                       prev.setNext(next);
         }
-        prev.setNext(next);
-        next.setPrev(prev);
+
         i.setNext(null);
         i.setPrev(null);
         --size;
@@ -291,45 +300,87 @@
     /**
      * {@inheritDoc}
      */
-    public void insertPrev(DoublyLinkedList.Item<T> i, 
DoublyLinkedList.Item<T> j) {
-       if (i.getParent() == null)
-               throw new PromiscuousItemException(i, i.getParent()); // 
different trace to make easier debugging
-       if (i.getParent() != this)
-               throw new PromiscuousItemException(i, i.getParent());
+       public void insertPrev(T i, T j) {
        if (j.getParent() != null)
                throw new PromiscuousItemException(j, j.getParent());
         if ((j.getNext() != null) || (j.getPrev() != null))
             throw new PromiscuousItemException(j);
-        DoublyLinkedList.Item<T> prev = i.getPrev();
-        if (prev == null)
-            throw new VirginItemException(i);
-        prev.setNext(j);
-        j.setPrev(prev);
-        i.setPrev(j);
-        j.setNext(i);
-        j.setParent(this);
-        ++size;
+
+               if (i == null) {
+                       // insert as tail
+                       j.setPrev(_lastItem);
+                       j.setNext(null);
+                       j.setParent(this);
+                       if (_lastItem != null) {
+                               _lastItem.setNext(j);
+                               _lastItem = j;
+                       } else {
+                               _firstItem = _lastItem = j;
+                       }
+
+                       ++size;
+               } else {
+                       // insert in middle
+                       if (i.getParent() == null)
+                               throw new PromiscuousItemException(i, 
i.getParent()); // different trace to make easier debugging
+                       if (i.getParent() != this)
+                               throw new PromiscuousItemException(i, 
i.getParent());
+                       T prev = i.getPrev();
+                       if (prev == null) {
+                               if (i != _firstItem)
+                                       throw new VirginItemException(i);
+                               _firstItem = j;
+                       } else
+                               prev.setNext(j);
+                       j.setPrev(prev);
+                       i.setPrev(j);
+                       j.setNext(i);
+                       j.setParent(this);
+
+                       ++size;
+               }
     }

     /**
      * {@inheritDoc}
      */
-    public void insertNext(DoublyLinkedList.Item<T> i, 
DoublyLinkedList.Item<T> j) {
-       if (i.getParent() != this)
-               throw new PromiscuousItemException(i, i.getParent());
+       public void insertNext(T i, T j) {
        if (j.getParent() != null)
                throw new PromiscuousItemException(j, i.getParent());
         if ((j.getNext() != null) || (j.getPrev() != null))
             throw new PromiscuousItemException(j);
-        DoublyLinkedList.Item next = i.getNext();
-        if (next == null)
-            throw new VirginItemException(i);
-        next.setPrev(j);
-        j.setNext(next);
-        i.setNext(j);
-        j.setPrev(i);
-        j.setParent(this);
-        ++size;
+
+               if (i == null) {
+                       // insert as head
+                       j.setPrev(null);
+                       j.setNext(_firstItem);
+                       j.setParent(this);
+
+                       if (_firstItem != null) {
+                               _firstItem.setPrev(j);
+                               _firstItem = j;
+                       } else {
+                               _firstItem = _lastItem = j;
+                       }
+
+                       ++size;
+               } else {
+                       if (i.getParent() != this)
+                               throw new PromiscuousItemException(i, 
i.getParent());
+                       T next = i.getNext();
+                       if (next == null) {
+                               if (i != _lastItem)
+                                       throw new VirginItemException(i);
+                               _lastItem = j;
+                       } else
+                               next.setPrev(j);
+                       j.setNext(next);
+                       i.setNext(j);
+                       j.setPrev(i);
+                       j.setParent(this);
+
+                       ++size;
+               }
     }

     //=== Walkable implementation 
==============================================
@@ -348,83 +399,84 @@
         return new ReverseWalker();
     }

-    private class ForwardWalker<T extends DoublyLinkedListImpl.Item<T>> 
implements Enumeration<DoublyLinkedList.Item<T>> {
-        protected DoublyLinkedList.Item<T> next;
+       private class ForwardWalker implements Enumeration<T> {
+               protected T next;
         protected ForwardWalker() {
-            next = _headptr.getNext();
+                       next = _firstItem;
         }
-        protected ForwardWalker(DoublyLinkedList.Item<T> startAt,
-                                boolean inclusive) {
-            next = (inclusive ? startAt : startAt.getNext());
-        }
         public final boolean hasMoreElements() {
-            return next != _tailptr;
+                       return next != null;
         }
-        public DoublyLinkedList.Item<T> nextElement() {
-            if (next == _tailptr)
+
+               public T nextElement() {
+                       if (next == null)
                 throw new NoSuchElementException();
-            DoublyLinkedList.Item<T> result = next;
+                       T result = next;
             next = next.getNext();
-            return result;
+                       return result;
         }
     }

-    private class ReverseWalker<T extends DoublyLinkedList.Item<T>> implements 
Enumeration<DoublyLinkedList.Item<T>> {
-        protected DoublyLinkedList.Item<T> next;
+       private class ReverseWalker implements Enumeration<T> {
+               protected T next;
         protected ReverseWalker() {
-            next = _tailptr.getPrev();
+                       next = _lastItem;
         }
-        protected ReverseWalker(DoublyLinkedList.Item<T> startAt,
-                                boolean inclusive) {
-            next = (inclusive ? startAt : startAt.getPrev());
-        }
         public final boolean hasMoreElements() {
-            return next != _headptr;
+                       return next != null;
         }
-        public DoublyLinkedList.Item<T> nextElement() {
-            if (next == _headptr)
+
+               public T nextElement() {
+                       if (next == null)
                 throw new NoSuchElementException();
-            DoublyLinkedList.Item<T> result = next;
+                       T result = next;
            if(next == null) throw new IllegalStateException("next==null");
             next = next.getPrev();
-            return result;
+                       return result;
         }
     }


     //=== list element ====================================================

-    public static class Item<T> implements DoublyLinkedList.Item<T> {
-        private DoublyLinkedList.Item<T> prev;
-        private DoublyLinkedList.Item<T> next;
-        private DoublyLinkedList list;
-               @Override
-        public DoublyLinkedList.Item<T> clone() {
-            if(getClass() != Item.class)
-                throw new RuntimeException("Must implement clone() for 
"+getClass());
-            return new Item<T>();
-        }
-        public final DoublyLinkedList.Item getNext() {
+       public static class Item<T extends DoublyLinkedListImpl.Item<?>> 
implements DoublyLinkedList.Item<T> {
+               private T prev;
+               private T next;
+               private DoublyLinkedList<? super T> list;
+
+               //              @Override
+               //              public T clone() {
+               //            if(getClass() != Item.class)
+               //                throw new RuntimeException("Must implement 
clone() for "+getClass());
+               //                      return (T) new Item<T>();
+               //        }
+
+               public final T getNext() {
             return next;
         }
-        public final DoublyLinkedList.Item setNext(DoublyLinkedList.Item<T> i) 
{
-            DoublyLinkedList.Item<T> old = next;
-            next = i;
+
+               public final T setNext(DoublyLinkedList.Item<?> i) {
+                       T old = next;
+                       next = (T) i;
             return old;
         }
-        public final DoublyLinkedList.Item getPrev() {
+
+               public final T getPrev() {
             return prev;
         }
-        public final DoublyLinkedList.Item setPrev(DoublyLinkedList.Item<T> i) 
{
-            DoublyLinkedList.Item<T> old = prev;
-            prev = i;
+
+               public final T setPrev(DoublyLinkedList.Item<?> i) {
+                       T old = prev;
+                       prev = (T) i;
             return old;
         }
-               public DoublyLinkedList getParent() {
+
+               public DoublyLinkedList<? super T> getParent() {
                        return list;
                }
-               public DoublyLinkedList setParent(DoublyLinkedList<T> l) {
-                       DoublyLinkedList old = list;
+
+               public DoublyLinkedList<? super T> setParent(DoublyLinkedList<? 
super T> l) {
+                       DoublyLinkedList<? super T> old = list;
                        list = l;
                        return old;
                }

Modified: branches/db4o/freenet/src/freenet/support/Executor.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/Executor.java     2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/Executor.java     2009-03-18 
00:11:38 UTC (rev 26082)
@@ -16,4 +16,7 @@
        public int[] waitingThreads();
        /** Count the number of threads running at each priority level */
        public int[] runningThreads();
+
+       /** Fast method returning how many threads are waiting */
+       public int getWaitingThreadsCount();
 }

Modified: branches/db4o/freenet/src/freenet/support/LRUHashtable.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/LRUHashtable.java 2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/LRUHashtable.java 2009-03-18 
00:11:38 UTC (rev 26082)
@@ -12,7 +12,7 @@
      * push is by far the most done operation, this should be an
      * overall improvement.
      */
-    private final DoublyLinkedListImpl<V> list = new DoublyLinkedListImpl<V>();
+       private final DoublyLinkedListImpl<QItem<K, V>> list = new 
DoublyLinkedListImpl<QItem<K, V>>();
     private final Hashtable<K, QItem<K, V>> hash = new Hashtable<K, QItem<K, 
V>>();

     /**
@@ -41,7 +41,7 @@
      */
     public final synchronized Object popKey() {
         if ( list.size() > 0 ) {
-            return (   hash.remove(((QItem) list.pop()).obj)).obj;
+                       return hash.remove(list.pop().obj).obj;
         } else {
             return null;
         }
@@ -52,7 +52,7 @@
      */
     public final synchronized Object popValue() {
         if ( list.size() > 0 ) {
-            return (   hash.remove(((QItem) list.pop()).obj)).value;
+                       return hash.remove(list.pop().obj).value;
         } else {
             return null;
         }
@@ -60,22 +60,7 @@

        public final synchronized Object peekValue() {
         if ( list.size() > 0 ) {
-               if(hash == null) throw new NullPointerException();
-               QItem<K,V> tail = (QItem<K,V>) list.tail();
-               Object object = tail.obj;
-               QItem<K,V> i = (QItem<K,V>) hash.get(object);
-               if(i == null) {
-                       String obToString = "(toString() threw)";
-                       try {
-                               obToString = object.toString();
-                       } catch (Throwable t) {
-                               // Ignore
-                       }
-                       Logger.error(this, "Lookup failed in LRUHashtable for 
"+obToString+" in LRUHashtable - maybe an object was deactivated or its hash 
code changed some other way????");
-                       return null;
-               }
-               return i.value;
-            //return ((QItem)hash.get(((QItem)list.tail()).obj)).value;
+                       return hash.get(list.tail().obj).value;
         } else {
             return null;
         }
@@ -114,39 +99,39 @@
        return q.value;
     }

-    public Enumeration keys() {
+       public Enumeration<K> keys() {
         return new ItemEnumeration();
     }

-    public Enumeration values() {
+       public Enumeration<V> values() {
        return new ValuesEnumeration();
     }

-    private class ItemEnumeration implements Enumeration {
-        private Enumeration source = list.reverseElements();
+       private class ItemEnumeration implements Enumeration<K> {
+               private Enumeration<QItem<K, V>> source = 
list.reverseElements();

         public boolean hasMoreElements() {
             return source.hasMoreElements();
         }

-        public Object nextElement() {
-            return ((QItem) source.nextElement()).obj;
+               public K nextElement() {
+                       return source.nextElement().obj;
         }
     }

-    private class ValuesEnumeration implements Enumeration {
-        private Enumeration source = list.reverseElements();
+       private class ValuesEnumeration implements Enumeration<V> {
+               private Enumeration<QItem<K, V>> source = 
list.reverseElements();

         public boolean hasMoreElements() {
             return source.hasMoreElements();
         }

-        public Object nextElement() {
-            return ((QItem) source.nextElement()).value;
+               public V nextElement() {
+                       return source.nextElement().value;
         }
     }

-    public static class QItem<K, V> extends DoublyLinkedListImpl.Item<V> {
+       public static class QItem<K, V> extends 
DoublyLinkedListImpl.Item<QItem<K, V>> {
         public K obj;
         public V value;


Modified: branches/db4o/freenet/src/freenet/support/LRUQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/LRUQueue.java     2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/LRUQueue.java     2009-03-18 
00:11:38 UTC (rev 26082)
@@ -1,9 +1,15 @@
 package freenet.support;

 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;

-public class LRUQueue {
+/**
+ * LRU Queue
+ * 
+ * push()'ing an existing object move it to tail, no duplicated object are 
ever added.
+ */
+public class LRUQueue<T> {

     /*
      * I've just converted this to using the DLList and Hashtable
@@ -12,32 +18,26 @@
      * push is by far the most done operation, this should be an
      * overall improvement.
      */
-    private final DoublyLinkedListImpl list = new DoublyLinkedListImpl();
-    private final Hashtable hash = new Hashtable();
-    private final int sizeLimit;
+       private final DoublyLinkedListImpl<QItem<T>> list = new 
DoublyLinkedListImpl<QItem<T>>();
+       private final Map<T, QItem<T>> hash = new HashMap<T, QItem<T>>();

     public LRUQueue() {
-       sizeLimit = -1;
     }

-    public LRUQueue(int mySizeLimit) {
-       sizeLimit = mySizeLimit;
-    }
-    
     /**
      *       push()ing an object that is already in
      *       the queue moves that object to the most
      *       recently used position, but doesn't add
      *       a duplicate entry in the queue.
      */
-    public final synchronized void push(Object obj) {
-        QItem insert = (QItem)hash.get(obj);        
+       public final synchronized void push(T obj) {
+               if (obj == null)
+                       throw new NullPointerException();
+
+               QItem<T> insert = hash.get(obj);
         if (insert == null) {
-            insert = new QItem(obj);
+                       insert = new QItem<T>(obj);
             hash.put(obj,insert);
-            
-            if(sizeLimit!=-1 && list.size() > sizeLimit)
-               pop();
         } else {
             list.remove(insert);
         }
@@ -48,14 +48,14 @@
     /**
      * push to bottom (least recently used position)
      */
-       public synchronized void pushLeast(Object obj) {
-        QItem insert = (QItem)hash.get(obj);        
+       public synchronized void pushLeast(T obj) {
+               if (obj == null)
+                       throw new NullPointerException();
+
+               QItem<T> insert = hash.get(obj);
         if (insert == null) {
-            insert = new QItem(obj);
+                       insert = new QItem<T>(obj);
             hash.put(obj,insert);
-            if(sizeLimit!=-1 && list.size() > sizeLimit) {
-               hash.remove(((QItem)list.shift()).obj);
-            }
         } else {
             list.remove(insert);
         }
@@ -66,9 +66,9 @@
     /**
      *  @return Least recently pushed Object.
      */
-    public final synchronized Object pop() {
+       public final synchronized T pop() {
         if ( list.size() > 0 ) {
-            return ((QItem)hash.remove(((QItem)list.pop()).obj)).obj;
+                       return hash.remove(list.pop().obj).obj;
         } else {
             return null;
         }
@@ -79,7 +79,10 @@
     }

     public final synchronized boolean remove(Object obj) {
-       QItem i = (QItem)(hash.remove(obj));
+               if (obj == null)
+                       throw new NullPointerException();
+
+               QItem<T> i = hash.remove(obj);
        if(i != null) {
            list.remove(i);
            return true;
@@ -97,26 +100,27 @@
         return hash.containsKey(obj);
     }

-    public Enumeration elements() {
+       public Enumeration<T> elements() {
         return new ItemEnumeration();
     }

-    private class ItemEnumeration implements Enumeration {
-        private Enumeration source = list.reverseElements();
+       private class ItemEnumeration implements Enumeration<T> {
+
+               private Enumeration<QItem<T>> source = list.reverseElements();

         public boolean hasMoreElements() {
             return source.hasMoreElements();
         }

-        public Object nextElement() {
-            return ((QItem) source.nextElement()).obj;
+               public T nextElement() {
+                       return source.nextElement().obj;
         }
     }

-    private static class QItem extends DoublyLinkedListImpl.Item {
-        public Object obj;
+       private static class QItem<T> extends 
DoublyLinkedListImpl.Item<QItem<T>> {
+               public T obj;

-        public QItem(Object obj) {
+        public QItem(T obj) {
             this.obj = obj;
         }
     }
@@ -134,7 +138,7 @@
      * order.
         * @param array The array to fill in. If it is too small a new array of 
the same type will be allocated.
      */
-       public synchronized Object[] toArray(Object[] array) {
+       public synchronized <E> E[] toArray(E[] array) {
                return hash.keySet().toArray(array);
        }

@@ -143,11 +147,12 @@
         * recently used object is in <tt>[0]</tt>, the <strong>most</strong>
         * recently used object is in <tt>[array.length-1]</tt>.
         */
+
        public synchronized Object[] toArrayOrdered() {
                Object[] array = new Object[list.size()];
                int x = 0;
-               for(Enumeration e = 
list.reverseElements();e.hasMoreElements();) {
-                       array[x++] = ((QItem)e.nextElement()).obj;
+               for (Enumeration<QItem<T>> e = list.reverseElements(); 
e.hasMoreElements();) {
+                       array[x++] = e.nextElement().obj;
                }
                return array;
        }
@@ -161,14 +166,15 @@
         *            The array to fill in. If it is too small a new array of 
the
         *            same type will be allocated.
         */
-       public synchronized Object[] toArrayOrdered(Object[] array) {
+
+       public synchronized <E> E[] toArrayOrdered(E[] array) {
                array = toArray(array);
                int listSize = list.size();
                if(array.length != listSize)
                        throw new 
IllegalStateException("array.length="+array.length+" but list.size="+listSize);
                int x = 0;
-               for(Enumeration e = 
list.reverseElements();e.hasMoreElements();) {
-                       array[x++] = ((QItem)e.nextElement()).obj;
+               for (Enumeration<QItem<T>> e = list.reverseElements(); 
e.hasMoreElements();) {
+                       array[x++] = (E) e.nextElement().obj;
                }
                return array;
        }

Modified: 
branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/LimitedRangeIntByteArrayMap.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -3,6 +3,7 @@
 import java.util.HashMap;
 import java.util.Iterator;

+import freenet.support.LogThresholdCallback;
 import freenet.io.comm.AsyncMessageCallback;

 /**
@@ -17,7 +18,15 @@
  */
 public class LimitedRangeIntByteArrayMap {

-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }
     private final HashMap<Integer, LimitedRangeIntByteArrayMapElement> 
contents;
     private int minValue;
     private int maxValue;
@@ -31,7 +40,6 @@
         minValue = -1;
         maxValue = -1;
         flag = false;
-        logMINOR = Logger.shouldLog(Logger.MINOR, this);
     }

     public synchronized int minValue() {
@@ -87,7 +95,6 @@
      * of range.
      */
     public synchronized boolean add(int index, byte[] data, 
AsyncMessageCallback[] callbacks, short priority) {
-       logMINOR = Logger.shouldLog(Logger.MINOR, this);
        if(logMINOR) Logger.minor(this, toString()+" add "+index);
         if(maxValue == -1) {
             minValue = index;

Copied: branches/db4o/freenet/src/freenet/support/LogThresholdCallback.java 
(from rev 25872, trunk/freenet/src/freenet/support/LogThresholdCallback.java)
===================================================================
--- branches/db4o/freenet/src/freenet/support/LogThresholdCallback.java         
                (rev 0)
+++ branches/db4o/freenet/src/freenet/support/LogThresholdCallback.java 
2009-03-18 00:11:38 UTC (rev 26082)
@@ -0,0 +1,12 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ *  * Public License, version 2 (or at your option any later version). See
+ *   * http://www.gnu.org/ for further details of the GPL. */
+package freenet.support;
+
+public class LogThresholdCallback {
+
+       public LogThresholdCallback() {
+       }
+
+       public void shouldUpdate(){}; 
+}

Modified: branches/db4o/freenet/src/freenet/support/Logger.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/Logger.java       2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/Logger.java       2009-03-18 
00:11:38 UTC (rev 26082)
@@ -15,7 +15,6 @@

 */
 public abstract class Logger {
-
        public final static class OSThread {

                private static boolean getPIDEnabled = false;
@@ -385,6 +384,15 @@
        public abstract void setDetailedThresholds(String details) throws 
InvalidThresholdException;

        /**
+        * Register a LogThresholdCallback; this callback will be called after 
registration
+        */
+       public static void registerLogThresholdCallback(LogThresholdCallback 
ltc) {
+               logger.instanceRegisterLogThresholdCallback(ltc);
+       }
+
+       public abstract void 
instanceRegisterLogThresholdCallback(LogThresholdCallback ltc);
+
+       /**
         * Report a fatal error and exit.
         * @param cause the object or class involved
         * @param retcode the return code

Modified: branches/db4o/freenet/src/freenet/support/LoggerHook.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/LoggerHook.java   2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/LoggerHook.java   2009-03-18 
00:11:38 UTC (rev 26082)
@@ -27,6 +27,7 @@
        }

        public DetailedThreshold[] detailedThresholds = new 
DetailedThreshold[0];
+       private LogThresholdCallback[] thresholdsCallbacks = new 
LogThresholdCallback[0];

        /**
         * Log a message
@@ -109,6 +110,7 @@
        @Override
        public void setThreshold(int thresh) {
                this.threshold = thresh;
+               notifyLogThresholdCallbacks();
        }

        @Override
@@ -145,6 +147,7 @@
                stuff.toArray(newThresholds);
                synchronized(this) {
                        detailedThresholds = newThresholds;
+                       notifyLogThresholdCallbacks();
                }
        }

@@ -231,7 +234,22 @@
                return instanceShouldLog(prio, o == null ? null : o.getClass());
        }

+       @Override
+       public synchronized final void 
instanceRegisterLogThresholdCallback(LogThresholdCallback ltc) {
+               LogThresholdCallback[] newLTC = new 
LogThresholdCallback[thresholdsCallbacks.length+1];
+               newLTC[0] = ltc;
+               System.arraycopy(thresholdsCallbacks, 0, newLTC, 1, 
thresholdsCallbacks.length);
+               thresholdsCallbacks = newLTC;

+               // Call the new callback to avoid code duplication
+               ltc.shouldUpdate();
+       }
+
+       private synchronized final void notifyLogThresholdCallbacks() {
+               for(LogThresholdCallback ltc : thresholdsCallbacks)
+                       ltc.shouldUpdate();
+       }
+
        public abstract long minFlags(); // ignore unless all these bits set

        public abstract long notFlags(); // reject if any of these bits set

Modified: branches/db4o/freenet/src/freenet/support/PooledExecutor.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/PooledExecutor.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/PooledExecutor.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -22,6 +22,7 @@
        /** Threads waiting for a job */
        @SuppressWarnings("unchecked")
        private final ArrayList<MyThread>[] waitingThreads = new 
ArrayList[runningThreads.length];
+       private volatile int waitingThreadsCount;
        long[] threadCounter = new long[runningThreads.length];
        private long jobCount;
        private long jobMisses;
@@ -39,6 +40,7 @@
                        waitingThreads[i] = new ArrayList<MyThread>();
                        threadCounter[i] = 0;
                }
+               waitingThreadsCount = 0;
        }
        /** Maximum time a thread will wait for a job */
        static final int TIMEOUT = 5 * 60 * 1000;
@@ -131,6 +133,10 @@
                return result;
        }

+       public int getWaitingThreadsCount() {
+               return waitingThreadsCount;
+       }
+
        class MyThread extends NativeThread {

                final String defaultName;
@@ -160,6 +166,7 @@
                                if(job == null) {
                                        synchronized(PooledExecutor.this) {
                                                waitingThreads[nativePriority - 
1].add(this);
+                                               waitingThreadsCount++;
                                        }
                                        synchronized(this) {
                                                if(nextJob == null) {
@@ -177,6 +184,7 @@
                                        }
                                        synchronized(PooledExecutor.this) {
                                                waitingThreads[nativePriority - 
1].remove(this);
+                                               waitingThreadsCount--;
                                                if(!alive) {
                                                        
runningThreads[nativePriority - 1].remove(this);
                                                        if(logMINOR)

Modified: 
branches/db4o/freenet/src/freenet/support/PrioritizedSerialExecutor.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/PrioritizedSerialExecutor.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/PrioritizedSerialExecutor.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -259,4 +259,10 @@
                }
        }

+       public int getWaitingThreadsCount() {
+               synchronized(jobs) {
+                       return (waiting ? 1 : 0);
+               }
+       }
+
 }

Modified: branches/db4o/freenet/src/freenet/support/SerialExecutor.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/SerialExecutor.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/SerialExecutor.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -113,4 +113,9 @@
                return retval;
        }

+       public int getWaitingThreadsCount() {
+               synchronized(jobs) {
+                       return (waiting ? 1 : 0);
+               }
+       }
 }

Modified: branches/db4o/freenet/src/freenet/support/TransferThread.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/TransferThread.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/TransferThread.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -82,6 +82,9 @@
                                catch(InterruptedException e) {
                                        mThread.interrupt();
                                }
+                               catch(Exception e) {
+                                       Logger.error(this, "Error in iterate 
probably()", e);
+                               }
                        }
                }


Modified: 
branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedList.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedList.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedList.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -14,17 +14,23 @@
 public class UpdatableSortedLinkedList implements Iterable {
        boolean debug = false;
        protected boolean killed = false;
-       private static boolean logMINOR;
+       private static volatile boolean logMINOR;
+
+       static {
+               Logger.registerLogThresholdCallback(new LogThresholdCallback(){
+                       public void shouldUpdate(){
+                               logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                       }
+               });
+       }

     public UpdatableSortedLinkedList() {
         list = new DoublyLinkedListImpl();
-        logMINOR = Logger.shouldLog(Logger.MINOR, this);
     }

     private final DoublyLinkedList list;

     public synchronized void add(UpdatableSortedLinkedListItem i) throws 
UpdatableSortedLinkedListKilledException {
-        logMINOR = Logger.shouldLog(Logger.MINOR, this);
        if(killed) throw new UpdatableSortedLinkedListKilledException();
         if(logMINOR) Logger.minor(this, "Add("+i+") on "+this);
         if(list.isEmpty()) {
@@ -84,7 +90,6 @@
        }

        public synchronized UpdatableSortedLinkedListItem 
remove(UpdatableSortedLinkedListItem i) throws 
UpdatableSortedLinkedListKilledException {
-        logMINOR = Logger.shouldLog(Logger.MINOR, this);
        if(killed) throw new UpdatableSortedLinkedListKilledException();
        if(logMINOR) Logger.minor(this, "Remove("+i+") on "+this);
         checkList();
@@ -104,7 +109,6 @@
        }

     public synchronized void update(UpdatableSortedLinkedListItem i) throws 
UpdatableSortedLinkedListKilledException {
-       logMINOR = Logger.shouldLog(Logger.MINOR, this);
        if(killed) throw new UpdatableSortedLinkedListKilledException();
        if(logMINOR) Logger.minor(this, "Update("+i+") on "+this);
         checkList();

Modified: 
branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedListWithForeignIndex.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedListWithForeignIndex.java
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/support/UpdatableSortedLinkedListWithForeignIndex.java
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -1,7 +1,6 @@
 package freenet.support;

 import java.util.HashMap;
-import java.util.Iterator;

 /**
  * UpdatableSortedLinkedList plus a hashtable. Each item has

Modified: branches/db4o/freenet/src/freenet/support/VoidLogger.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/VoidLogger.java   2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/VoidLogger.java   2009-03-18 
00:11:38 UTC (rev 26082)
@@ -68,5 +68,7 @@
        @Override
        public void setDetailedThresholds(String details) {
        }
-       
-}
\ No newline at end of file
+
+       @Override
+       public final void 
instanceRegisterLogThresholdCallback(LogThresholdCallback ltc) {}
+}

Modified: branches/db4o/freenet/src/freenet/support/WouldBlockException.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/WouldBlockException.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/WouldBlockException.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -6,14 +6,34 @@
  * Thrown when we would have to block but have been told not to.
  */
 public class WouldBlockException extends IncomingPacketFilterException {
-       private static final long serialVersionUID = -1;

-       public WouldBlockException(String string) {
-               super(string);
-       }
+    private static final long serialVersionUID = -1;
+    private static volatile boolean logDEBUG;

-       public WouldBlockException() {
-               super();
-       }
+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {

+            @Override
+            public void shouldUpdate() {
+                logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+            }
+        });
+    }
+
+    public WouldBlockException(String string) {
+        super(string);
+    }
+
+    public WouldBlockException() {
+        super();
+    }
+
+    // Optimization :
+    // 
http://blogs.sun.com/jrose/entry/longjumps_considered_inexpensive?resubmit=damnit
+    @Override
+    public final synchronized Throwable fillInStackTrace() {
+        if(logDEBUG)
+            return super.fillInStackTrace();
+        return null;
+    }
 }

Modified: branches/db4o/freenet/src/freenet/support/io/BaseFileBucket.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/BaseFileBucket.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/io/BaseFileBucket.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -14,11 +14,25 @@

 import freenet.support.Fields;
 import freenet.support.Logger;
+import freenet.support.LogThresholdCallback;
 import freenet.support.SimpleFieldSet;
 import freenet.support.api.Bucket;

 public abstract class BaseFileBucket implements Bucket, 
SerializableToFieldSetBucket {
+    private static volatile boolean logMINOR;
+    private static volatile boolean logDEBUG;

+    static {
+        Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+
+            @Override
+            public void shouldUpdate() {
+                logMINOR = Logger.shouldLog(Logger.MINOR, this);
+                logDEBUG = Logger.shouldLog(Logger.DEBUG, this);
+            }
+        });
+    }
+
        // JVM caches File.size() and there is no way to flush the cache, so we
        // need to track it ourselves
        protected long length;
@@ -69,7 +83,7 @@
                        FileBucketOutputStream os = 
                                new FileBucketOutputStream(tempfile, 
streamNumber);

-                       if(Logger.shouldLog(Logger.DEBUG, this))
+                       if(logDEBUG)
                                Logger.debug(this, "Creating "+os, new 
Exception("debug"));

                        addStream(os);
@@ -132,7 +146,7 @@
                        File tempfile, long restartCount)
                        throws FileNotFoundException {
                        super(tempfile, false);
-                       if(Logger.shouldLog(Logger.MINOR, this))
+                       if(logMINOR)
                                Logger.minor(this, "Writing to "+tempfile+" for 
"+getFile()+" : "+this);
                        this.tempfile = tempfile;
                        resetLength();
@@ -188,7 +202,6 @@
                                file = getFile();
                        }
                        removeStream(this);
-                       boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                        if(logMINOR)
                                Logger.minor(this, "Closing 
"+BaseFileBucket.this);
                        try {
@@ -258,7 +271,7 @@
                        FileBucketInputStream is =
                                new FileBucketInputStream(file);
                        addStream(is);
-                       if(Logger.shouldLog(Logger.DEBUG, this))
+                       if(logDEBUG)
                                Logger.debug(this, "Creating "+is, new 
Exception("debug"));
                        return is;
                }
@@ -280,7 +293,7 @@
         * called twice. But length must still be valid when calling it.
         */
        protected synchronized void deleteFile() {
-               if(Logger.shouldLog(Logger.MINOR, this))
+               if(logMINOR)
                        Logger.minor(this, "Deleting "+getFile()+" for "+this, 
new Exception("debug"));
                getFile().delete();
        }

Modified: 
branches/db4o/freenet/src/freenet/support/io/LineReadingInputStream.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/io/LineReadingInputStream.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/src/freenet/support/io/LineReadingInputStream.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -25,6 +25,8 @@
         * @param utf If true, read as UTF-8, if false, read as ISO-8859-1.
         */
        public String readLine(int maxLength, int bufferSize, boolean utf) 
throws IOException {
+               if(maxLength < 1)
+                       return null;
                if(maxLength <= bufferSize)
                        bufferSize = maxLength + 1; // Buffer too big, shrink 
it (add 1 for the optional \r)

@@ -57,7 +59,7 @@
                                if(ctr >= maxLength)
                                        throw new TooLongException("We reached 
maxLength="+maxLength+ " parsing\n "+HexUtil.bytesToHex(buf, 0, ctr) + "\n" + 
new String(buf, 0, ctr, utf ? "UTF-8" : "ISO-8859-1"));
                        }
-                       if((buf.length != maxLength) && (buf.length - ctr < 
bufferSize)) {
+                       if((buf.length < maxLength) && (buf.length - ctr < 
bufferSize)) {
                                byte[] newBuf = new byte[Math.min(buf.length * 
2, maxLength)];
                                System.arraycopy(buf, 0, newBuf, 0, ctr);
                                buf = newBuf;

Modified: 
branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java    
    2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/src/freenet/support/math/MedianMeanRunningAverage.java    
    2009-03-18 00:11:38 UTC (rev 26082)
@@ -9,7 +9,8 @@
  * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450)
  */
 public class MedianMeanRunningAverage implements RunningAverage {
-       
+       private static final long serialVersionUID = 1L;
+
        final ArrayList<Double> reports;
        final TrivialRunningAverage mean;

@@ -25,7 +26,9 @@
        }

        public Object clone() {
-               return new MedianMeanRunningAverage(this);
+               synchronized (this) {
+                       return new MedianMeanRunningAverage(this);
+               }
        }

        public synchronized long countReports() {

Modified: branches/db4o/freenet/src/freenet/tools/AddRef.java
===================================================================
--- branches/db4o/freenet/src/freenet/tools/AddRef.java 2009-03-17 23:32:40 UTC 
(rev 26081)
+++ branches/db4o/freenet/src/freenet/tools/AddRef.java 2009-03-18 00:11:38 UTC 
(rev 26082)
@@ -66,8 +66,6 @@
                                if((fcpm == null) || !(fcpm instanceof 
NodeHelloMessage)){
                                        System.err.println("Not a valid FRED 
node!");
                                        System.exit(1);
-                               }else{
-                                       fcpm = (NodeHelloMessage) fcpm;
                                }
                        } catch(MessageInvalidException me){
                                me.printStackTrace();

Modified: branches/db4o/freenet/test/freenet/io/Inet4AddressMatcherTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/io/Inet4AddressMatcherTest.java  
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/io/Inet4AddressMatcherTest.java  
2009-03-18 00:11:38 UTC (rev 26082)
@@ -16,11 +16,8 @@

 package freenet.io;

-import java.net.Inet4Address;
 import java.net.InetAddress;

-import freenet.io.Inet4AddressMatcher;
-
 import junit.framework.TestCase;

 /**
@@ -31,44 +28,44 @@

        public void test() throws Exception {
                Inet4AddressMatcher matcher = new 
Inet4AddressMatcher("192.168.1.2");
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.2")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("0.0.0.0")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("192.168.1.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.1.2")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("127.0.0.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("0.0.0.0")));

                matcher = new Inet4AddressMatcher("192.168.1.2/8");
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.2")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.2.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.16.81.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.255.255.255")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("172.16.1.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("0.0.0.0")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.0.0.0")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.1.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.1.2")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.2.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.16.81.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.255.255.255")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("172.16.1.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("127.0.0.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("0.0.0.0")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.0.0.0")));

                /* some fancy matching */
                matcher = new Inet4AddressMatcher("192.168.1.1/255.0.255.0");
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.16.1.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.2.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("192.16.2.1")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.1.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.16.1.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("192.168.2.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("192.16.2.1")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("127.0.0.1")));

                matcher = new Inet4AddressMatcher("127.0.0.1/8");
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("127.23.42.64")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.0")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("127.255.255.255")));
-               assertEquals(false, matcher.matches((Inet4Address) 
InetAddress.getByName("28.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("127.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("127.23.42.64")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("127.0.0.0")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("127.255.255.255")));
+               assertEquals(false, 
matcher.matches(InetAddress.getByName("28.0.0.1")));

                matcher = new Inet4AddressMatcher("0.0.0.0/0");
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("127.0.0.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.1.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("192.168.2.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("172.16.42.23")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("10.0.0.1")));
-               assertEquals(true, matcher.matches((Inet4Address) 
InetAddress.getByName("224.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("127.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.1.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("192.168.2.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("172.16.42.23")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("10.0.0.1")));
+               assertEquals(true, 
matcher.matches(InetAddress.getByName("224.0.0.1")));
        }

 }

Modified: 
branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/DoublyLinkedListImplTest.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -66,22 +66,22 @@
                list.push(new T(3));

                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.pop()).assertV(3);
+               list.pop().assertV(3);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.pop()).assertV(2);
+               list.pop().assertV(2);
                assertFalse("isEmpty()", list.isEmpty());

                // add again
                list.push(new T(4));
                list.push(new T(5));

-               ((T) list.pop()).assertV(5);
+               list.pop().assertV(5);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.pop()).assertV(4);
+               list.pop().assertV(4);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.pop()).assertV(1);
+               list.pop().assertV(1);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.pop()).assertV(0);
+               list.pop().assertV(0);

                assertTrue("isEmpty()", list.isEmpty());
                assertNull("pop()", list.pop());
@@ -95,22 +95,22 @@
                list.unshift(new T(3));

                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(3);
+               list.shift().assertV(3);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(2);
+               list.shift().assertV(2);
                assertFalse("isEmpty()", list.isEmpty());

                // add again
                list.unshift(new T(4));
                list.unshift(new T(5));

-               ((T) list.shift()).assertV(5);
+               list.shift().assertV(5);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(4);
+               list.shift().assertV(4);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(1);
+               list.shift().assertV(1);
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(0);
+               list.shift().assertV(0);

                assertTrue("isEmpty()", list.isEmpty());
                assertNull("shift()", list.shift());
@@ -125,10 +125,10 @@

                assertEquals("size()", 4, list.size());
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(3);
+               list.shift().assertV(3);
                assertEquals("size()", 3, list.size());
                assertFalse("isEmpty()", list.isEmpty());
-               ((T) list.shift()).assertV(2);
+               list.shift().assertV(2);
                assertEquals("size()", 2, list.size());
                assertFalse("isEmpty()", list.isEmpty());

@@ -143,32 +143,32 @@
                assertEquals("size()", 2, list.size());
                assertFalse("isEmpty()", list.isEmpty());

-               ((T) list.shift()).assertV(5);
-               ((T) list.shift()).assertV(4);
+               list.shift().assertV(5);
+               list.shift().assertV(4);

                assertEquals("size()", 0, list.size());
                assertTrue("isEmpty()", list.isEmpty());
        }

-       public void testClone() {
-               DoublyLinkedList<T> list = new DoublyLinkedListImpl<T>();
-               for (int i = 0; i < 3; i++) {
-                       list.unshift(new T(i));
-               }
+       //      public void testClone() {
+       //              DoublyLinkedList<T> list = new 
DoublyLinkedListImpl<T>();
+       //              for (int i = 0; i < 3; i++) {
+       //                      list.unshift(new T(i));
+       //              }
+       //
+       //              DoublyLinkedList<T> listClone = list.clone();
+       //
+       //              for (int i = 2; i >= 0; i--) {
+       //                      T t = (T) list.shift();
+       //                      t.assertV(i);
+       //                      t.assertIsNotClone();
+       //
+       //                      T tc = (T) listClone.shift();
+       //                      tc.assertV(i);
+       //                      tc.assertIsClone();
+       //              }
+       //      }

-               DoublyLinkedList<T> listClone = list.clone();
-
-               for (int i = 2; i >= 0; i--) {
-                       T t = (T) list.shift();
-                       t.assertV(i);
-                       t.assertIsNotClone();
-
-                       T tc = (T) listClone.shift();
-                       tc.assertV(i);
-                       tc.assertIsClone();
-               }
-       }
-
        public void testShiftN() {
                DoublyLinkedList<T> list = new DoublyLinkedListImpl<T>();

@@ -178,17 +178,17 @@

                DoublyLinkedList<T> list2 = list.shift(2);
                assertEquals("list2.size()", 2, list2.size());
-               ((T) list2.shift()).assertV(0);
-               ((T) list2.shift()).assertV(1);
+               list2.shift().assertV(0);
+               list2.shift().assertV(1);
                assertTrue("list2.isEmpty()", list2.isEmpty());

                assertEquals("list.size()", 3, list.size());
-               ((T) list.shift()).assertV(2);
+               list.shift().assertV(2);

                list2 = list.shift(20);
                assertTrue("list.isEmpty()", list.isEmpty());
-               ((T) list2.shift()).assertV(3);
-               ((T) list2.shift()).assertV(4);
+               list2.shift().assertV(3);
+               list2.shift().assertV(4);
                assertTrue("list2.isEmpty()", list2.isEmpty());

                list2 = list.shift(20);
@@ -204,17 +204,17 @@

                DoublyLinkedList<T> list2 = list.pop(2);
                assertEquals("list2.size()", 2, list2.size());
-               ((T) list2.pop()).assertV(0);
-               ((T) list2.pop()).assertV(1);
+               list2.pop().assertV(0);
+               list2.pop().assertV(1);
                assertTrue("list2.isEmpty()", list2.isEmpty());

                assertEquals("list.size()", 3, list.size());
-               ((T) list.pop()).assertV(2);
+               list.pop().assertV(2);

                list2 = list.pop(20);
                assertTrue("list.isEmpty()", list.isEmpty());
-               ((T) list2.pop()).assertV(3);
-               ((T) list2.pop()).assertV(4);
+               list2.pop().assertV(3);
+               list2.pop().assertV(4);
                assertTrue("list2.isEmpty()", list2.isEmpty());

                list2 = list.pop(20);
@@ -260,7 +260,7 @@
                }

                // manual, forward
-               T h = (T) list.head();
+               T h = list.head();
                for (int i = 0; i < 5; i++) {
                        assertEquals("manual iternate, forward", array[i], h);
                        //assertEquals("DoublyLinkedList.next() == 
Item.next()", h.getNext(), list.next(h));
@@ -269,12 +269,12 @@

                        h.assertV(i);

-                       h = (T) list.next(h);
+                       h = list.next(h);
                }
                assertEquals("h==null", null, h);

                // manual, reverse
-               T t = (T) list.tail();
+               T t = list.tail();
                for (int i = 4; i >= 0; i--) {
                        assertEquals("manual iternate, reverse", array[i], t);
                        //assertEquals("DoublyLinkedList.prev() == 
Item.getPrev()", tail.getPrev(), list.prev(tail));
@@ -283,7 +283,7 @@

                        t.assertV(i);

-                       t = (T) list.prev(t);
+                       t = list.prev(t);
                }
                assertNull("t==null", t);

@@ -321,11 +321,11 @@
                // Remove non-identical (but equal) item -> give null
                assertNull(list.remove(new T(2)));

-               ((T) list.shift()).assertV(0);
-               ((T) list.shift()).assertV(1);
-               ((T) list.shift()).assertV(2);
-               ((T) list.shift()).assertV(4);
-               ((T) list.shift()).assertV(3);
+               list.shift().assertV(0);
+               list.shift().assertV(1);
+               list.shift().assertV(2);
+               list.shift().assertV(4);
+               list.shift().assertV(3);

                assertNull(list.remove(new T(-1)));
        }
@@ -339,12 +339,12 @@
                list.unshift(new T(4));
                list.unshift(new T(5));

-               ((T) list.shift()).assertV(5);
-               ((T) list.pop()).assertV(3);
-               ((T) list.pop()).assertV(1);
-               ((T) list.pop()).assertV(0);
-               ((T) list.shift()).assertV(4);
-               ((T) list.shift()).assertV(2);
+               list.shift().assertV(5);
+               list.pop().assertV(3);
+               list.pop().assertV(1);
+               list.pop().assertV(0);
+               list.shift().assertV(4);
+               list.shift().assertV(2);
        }

        public void testRandomInsert() {
@@ -388,6 +388,7 @@
                        fail("PromiscuousItemException");
                } catch (PromiscuousItemException pie) {
                }
+
                try {
                        // item in other list
                        list2.insertPrev(l2, array[3]);
@@ -400,28 +401,33 @@
                        fail("PromiscuousItemException");
                } catch (PromiscuousItemException pie) {
                }
+
+               T l3 = new T(9999);
+               list2.push(l3);
                try {
                        // VirginItemException
-                       list2.insertPrev(l2.getPrev(), new T(8888));
-                       fail("PromiscuousItemException");
+                       l3.setPrev(null); // corrupt it
+                       list2.insertPrev(l3, new T(8888));
+                       fail("VirginItemException");
                } catch (VirginItemException vie) {
                }
                try {
                        // VirginItemException
-                       list2.insertNext(l2.getNext(), new T(8888));
+                       l2.setNext(null); // corrupt it
+                       list2.insertNext(l2, new T(8888));
                        fail("VirginItemException");
                } catch (VirginItemException vie) {
                }

-               ((T) list.shift()).assertV(100);
-               ((T) list.shift()).assertV(0);
-               ((T) list.shift()).assertV(1);
-               ((T) list.shift()).assertV(102);
-               ((T) list.shift()).assertV(2);
-               ((T) list.shift()).assertV(3);
-               ((T) list.shift()).assertV(4);
-               ((T) list.shift()).assertV(105);
-               ((T) list.shift()).assertV(104);
+               list.shift().assertV(100);
+               list.shift().assertV(0);
+               list.shift().assertV(1);
+               list.shift().assertV(102);
+               list.shift().assertV(2);
+               list.shift().assertV(3);
+               list.shift().assertV(4);
+               list.shift().assertV(105);
+               list.shift().assertV(104);

        }
 }

Modified: branches/db4o/freenet/test/freenet/support/FieldsTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/FieldsTest.java  2009-03-17 
23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/FieldsTest.java  2009-03-18 
00:11:38 UTC (rev 26082)
@@ -1,383 +1,383 @@
-/* This code is part of Freenet. It is distributed under the GNU General
- * Public License, version 2 (or at your option any later version). See
- * http://www.gnu.org/ for further details of the GPL. */
-
-package freenet.support;
-
-import freenet.node.ExtVersion;
-import junit.framework.TestCase;
-import org.spaceroots.mantissa.random.MersenneTwister;
-
-/**
- * Test case for {@link freenet.support.Fields} class.
- * 
- *  @author stuart martin &lt;wavey at freenetproject.org&gt;
- */
-public class FieldsTest extends TestCase {
-
-       public void testHexToLong(){
-               
-               long l1 = Fields.hexToLong("0");
-               assertEquals(l1, 0);
-               
-               l1 = Fields.hexToLong("000000");
-               assertEquals(l1, 0);
-               
-               l1 = Fields.hexToLong("1");
-               assertEquals(l1, 1);
-               
-               l1 = Fields.hexToLong("a");
-               assertEquals(l1, 10);
-               
-               l1 = Fields.hexToLong("ff");
-               assertEquals(l1, 255);
-               
-               l1 = Fields.hexToLong("ffffffff");
-               assertEquals(l1, 4294967295L);
-               
-               l1 = Fields.hexToLong("7fffffffffffffff");
-               assertEquals(l1, Long.MAX_VALUE); 
-               
-               l1 = Fields.hexToLong("8000000000000000");
-               assertEquals(l1, Long.MIN_VALUE); 
-               
-               l1 = Fields.hexToLong("FFfffFfF"); // mix case
-               assertEquals(l1, 4294967295L);
-
-               try {
-                       l1 = Fields.hexToLong("abcdef123456789aa"); // 17 chars
-                       fail();
-               }
-               catch(NumberFormatException e){
-                       // expect this
-               }
-               
-               try {
-                       l1 = Fields.hexToLong("DeADC0dER"); // invalid char
-                       fail();
-               }
-               catch(NumberFormatException e){
-                       // expect this
-               }
-               
-               // see javadoc
-               l1 = Fields.hexToLong(Long.toHexString(20));
-               assertEquals(20, l1);
-
-               l1 = Fields.hexToLong(Long.toHexString(Long.MIN_VALUE));
-               assertEquals(Long.MIN_VALUE, l1);
-
-               // see javadoc
-               try {
-                       String longAsString = Long.toString(-1, 16);
-                       l1 = Fields.hexToLong(longAsString);
-                       fail();
-               }
-               catch(NumberFormatException e) {
-                       // expect this
-               }
-       }
-       
-       public void testHexToInt() {
-               
-               int i1 = Fields.hexToInt("0");
-               assertEquals(i1, 0);
-               
-               i1 = Fields.hexToInt("000000");
-               assertEquals(i1, 0);
-               
-               i1 = Fields.hexToInt("1");
-               assertEquals(i1, 1);
-               
-               i1 = Fields.hexToInt("a");
-               assertEquals(i1, 10);
-               
-               i1 = Fields.hexToInt("ff");
-               assertEquals(i1, 255);
-               
-               i1 = Fields.hexToInt("80000000");
-               assertEquals(i1, Integer.MIN_VALUE);
-               
-               i1 = Fields.hexToInt("0000000080000000"); // 16 chars
-               assertEquals(i1, Integer.MIN_VALUE);
-               
-               i1 = Fields.hexToInt("7fffffff");
-               assertEquals(i1, Integer.MAX_VALUE);
-               
-               try {
-                       i1 = Fields.hexToInt("0123456789abcdef0"); // 17 chars
-                       fail();
-               }
-               catch(NumberFormatException e){
-                       // expect this
-               }
-               
-               try {
-                       i1 = Fields.hexToInt("C0dER"); // invalid char
-                       fail();
-               }
-               catch(NumberFormatException e){
-                       // expect this
-               }
-               
-               // see javadoc
-               i1 = Fields.hexToInt(Integer.toHexString(20));
-               assertEquals(20, i1);
-
-               i1 = Fields.hexToInt(Long.toHexString(Integer.MIN_VALUE));
-               assertEquals(Integer.MIN_VALUE, i1);
-
-               // see javadoc
-               try {
-                       String integerAsString = Integer.toString(-1, 16);
-                       i1 = Fields.hexToInt(integerAsString);
-                       fail();
-               }
-               catch(NumberFormatException e) {
-                       // expect this
-               }
-       }
-       
-       public void testStringToBool() {
-               assertTrue(Fields.stringToBool("true"));
-               assertTrue(Fields.stringToBool("TRUE"));
-               assertFalse(Fields.stringToBool("false"));
-               assertFalse(Fields.stringToBool("FALSE"));
-               
-               try {
-                       Fields.stringToBool("Free Tibet");
-                       fail();
-               }
-               catch(NumberFormatException e) {
-                       // expect this
-               }
-               
-               try {
-                       Fields.stringToBool(null);
-                       fail();
-               }
-               catch(NumberFormatException e) {
-                       // expect this
-               }
-       }
-       
-       public void testStringToBoolWithDefault() {
-               assertTrue(Fields.stringToBool("true", false));
-               assertFalse(Fields.stringToBool("false", true));
-               assertTrue(Fields.stringToBool("TruE", false));
-               assertFalse(Fields.stringToBool("faLSE", true));
-               assertTrue(Fields.stringToBool("trueXXX", true));
-               assertFalse(Fields.stringToBool("XXXFalse", false));
-               assertTrue(Fields.stringToBool(null, true));
-       }
-       
-       public void testBoolToString() {
-               assertEquals(Fields.boolToString(true), "true");
-               assertEquals(Fields.boolToString(false), "false");
-       }
-       
-       public void testCommaListFromString() {
-               String[] expected = new String[] {"one", "two", "three", 
"four"};
-               String[] actual = Fields.commaList("one,two,     three    ,  
four");
-               
-               for(int i = 0; i < expected.length; i++) {
-                       assertEquals(expected[i], actual[i]);
-               }
-               
-               // null
-               assertNull(Fields.commaList((String)null));
-               
-               // no items
-               expected = new String[] {};
-               actual = Fields.commaList("");
-               
-               assertTrue(expected.length == actual.length);
-       }
-       
-       public void testStringArrayToCommaList() {
-               
-               String[] input = new String[] { "one", "two", "three", "four" };
-               
-               String expected = "one,two,three,four";
-               String actual = Fields.commaList(input);
-               
-               assertEquals(expected, actual);
-               
-               // empty
-               input = new String[] {};
-               
-               expected = "";
-               actual = Fields.commaList(input);
-               
-               assertEquals(expected, actual);
-       }
-       
-       public void testHashcodeForByteArray() {
-               byte[] input = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
-               
-               assertEquals(67372036, Fields.hashCode(input));
-               
-               // empty
-               input = new byte[] {};
-               
-               assertEquals(0, Fields.hashCode(input));
-       }
-       
-       public void testLongHashcode() {
-               
-               byte[] b1 = new byte[] { 1, 1, 2, 2, 3, 3 };
-               byte[] b2 = new byte[] { 2, 2, 3, 3, 4, 4 };
-               byte[] b3 = new byte[] { 1, 1, 2, 2, 3, 3 };
-               
-               Long l1 = new Long(Fields.longHashCode(b1));
-               Long l2 = new Long(Fields.longHashCode(b2));
-               Long l3 = new Long(Fields.longHashCode(b3));
-
-               assertFalse(l1.equals(l2));
-               assertFalse(l2.equals(l3));
-               assertTrue(l3.equals(l1)); // should be same due to 
Fields.longHashcode
-       }       
-       
-       public void testIntsToBytes() {
-               int[] longs = new int[] {};
-               doRoundTripIntsArrayToBytesArray(longs);
-               
-               longs = new int[] {Integer.MIN_VALUE};
-               doRoundTripIntsArrayToBytesArray(longs);
-               
-               longs = new int[] {0, Integer.MAX_VALUE, Integer.MIN_VALUE};
-               doRoundTripIntsArrayToBytesArray(longs);
-               
-               longs = new int[] {33685760, 51511577};
-               doRoundTripIntsArrayToBytesArray(longs);                
-       }
-
-       private void doRoundTripIntsArrayToBytesArray(int[] ints) {
-               byte[] bytes = Fields.intsToBytes(ints);
-               assert(bytes.length == ints.length * 8);
-               
-               int[] outLongs = Fields.bytesToInts(bytes);
-               for(int i = 0; i < ints.length; i++) {
-                       assertTrue(outLongs[i] == ints[i]);
-               }
-               assertEquals(outLongs.length, ints.length);
-       }
-       
-       public void testBytesToLongsException() {
-               byte[] bytes = new byte[3];
-               try {
-                       Fields.bytesToLongs(bytes, 0, bytes.length);
-                       fail();
-               }
-               catch(IllegalArgumentException e){
-                       // expect this
-               }               
-       }
-       
-       public void testBytesToInt() {
-               
-               byte[] bytes = new byte[] { 0, 1, 2, 2 };
-               
-               int outLong = Fields.bytesToInt(bytes, 0);
-               // We did dupplicate the code to avoid cross-dependancies
-               // TODO: Will need to be updated when next -ext is released
-               int outLongMT = MersenneTwister.bytesToInt(bytes, 0);
-               assertEquals(outLong, outLongMT);
-               assertEquals(outLong, 33685760);
-               
-               doTestRoundTripBytesArrayToInt(bytes);
-               
-               bytes = new byte[] {};
-               try{
-                       doTestRoundTripBytesArrayToInt(bytes);
-                       fail();
-               }
-               catch(IllegalArgumentException e) {
-                       //expect this
-               }
-               
-               bytes = new byte[] {1, 1, 1, 1};
-               doTestRoundTripBytesArrayToInt(bytes);
-       }
-       
-       private void doTestRoundTripBytesArrayToInt(byte[] inBytes) {
-
-               int outLong = Fields.bytesToInt(inBytes, 0);
-               assertEquals(outLong, MersenneTwister.bytesToInt(inBytes, 0));
-               byte[] outBytes = Fields.intToBytes(outLong);
-               for(int i = 0; i < inBytes.length; i++) {
-                       assertEquals(outBytes[i], inBytes[i]);
-               }
-               assertEquals(outBytes.length, inBytes.length);
-       }
-       
-       public void testLongsToBytes() {
-               long[] longs = new long[] {};
-               doRoundTripLongsArrayToBytesArray(longs);
-               
-               longs = new long[] {Long.MIN_VALUE};
-               doRoundTripLongsArrayToBytesArray(longs);
-               
-               longs = new long[] {0L, Long.MAX_VALUE, Long.MIN_VALUE};
-               doRoundTripLongsArrayToBytesArray(longs);
-               
-               longs = new long[] {3733393793879837L};
-               doRoundTripLongsArrayToBytesArray(longs);               
-       }
-
-       private void doRoundTripLongsArrayToBytesArray(long[] longs) {
-               byte[] bytes = Fields.longsToBytes(longs);
-               assert(bytes.length == longs.length * 8);
-               
-               long[] outLongs = Fields.bytesToLongs(bytes);
-               for(int i = 0; i < longs.length; i++) {
-                       assertTrue(outLongs[i] == longs[i]);
-               }
-               assertEquals(outLongs.length, longs.length);
-       }
-       
-       public void testBytesToLongException() {
-               byte[] bytes = new byte[3];
-               try {
-                       Fields.bytesToLongs(bytes, 0, bytes.length);
-                       fail();
-               }
-               catch(IllegalArgumentException e){
-                       // expect this
-               }
-       }
-       
-       public void testBytesToLong() {
-               
-               byte[] bytes = new byte[] { 0, 1, 2, 2, 1, 3, 6, 7 };
-               
-               long outLong = Fields.bytesToLong(bytes);
-               assertEquals(outLong, 506095310989295872L);
-                               
-               doTestRoundTripBytesArrayToLong(bytes);
-               
-               bytes = new byte[] {};
-               try{
-                       doTestRoundTripBytesArrayToLong(bytes);
-                       fail();
-               }
-               catch(IllegalArgumentException e) {
-                       //expect this
-               }
-               
-               bytes = new byte[] {1, 1, 1, 1, 1, 1, 1, 1};
-               doTestRoundTripBytesArrayToLong(bytes);
-               
-       }
-       
-       private void doTestRoundTripBytesArrayToLong(byte[] inBytes) {
-
-               long outLong = Fields.bytesToLong(inBytes);
-               byte[] outBytes = Fields.longToBytes(outLong);
-               for(int i = 0; i < inBytes.length; i++) {
-                       assertEquals(outBytes[i], inBytes[i]);
-               }
-               assertEquals(outBytes.length, inBytes.length);
-       }
-
-}
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package freenet.support;
+
+import junit.framework.TestCase;
+
+import org.spaceroots.mantissa.random.MersenneTwister;
+
+/**
+ * Test case for {@link freenet.support.Fields} class.
+ * 
+ * @author stuart martin &lt;wavey at freenetproject.org&gt;
+ */
+public class FieldsTest extends TestCase {
+
+       public void testHexToLong(){
+               
+               long l1 = Fields.hexToLong("0");
+               assertEquals(l1, 0);
+               
+               l1 = Fields.hexToLong("000000");
+               assertEquals(l1, 0);
+               
+               l1 = Fields.hexToLong("1");
+               assertEquals(l1, 1);
+               
+               l1 = Fields.hexToLong("a");
+               assertEquals(l1, 10);
+               
+               l1 = Fields.hexToLong("ff");
+               assertEquals(l1, 255);
+               
+               l1 = Fields.hexToLong("ffffffff");
+               assertEquals(l1, 4294967295L);
+               
+               l1 = Fields.hexToLong("7fffffffffffffff");
+               assertEquals(l1, Long.MAX_VALUE); 
+               
+               l1 = Fields.hexToLong("8000000000000000");
+               assertEquals(l1, Long.MIN_VALUE); 
+               
+               l1 = Fields.hexToLong("FFfffFfF"); // mix case
+               assertEquals(l1, 4294967295L);
+
+               try {
+                       l1 = Fields.hexToLong("abcdef123456789aa"); // 17 chars
+                       fail();
+               }
+               catch(NumberFormatException e){
+                       // expect this
+               }
+               
+               try {
+                       l1 = Fields.hexToLong("DeADC0dER"); // invalid char
+                       fail();
+               }
+               catch(NumberFormatException e){
+                       // expect this
+               }
+               
+               // see javadoc
+               l1 = Fields.hexToLong(Long.toHexString(20));
+               assertEquals(20, l1);
+
+               l1 = Fields.hexToLong(Long.toHexString(Long.MIN_VALUE));
+               assertEquals(Long.MIN_VALUE, l1);
+
+               // see javadoc
+               try {
+                       String longAsString = Long.toString(-1, 16);
+                       l1 = Fields.hexToLong(longAsString);
+                       fail();
+               }
+               catch(NumberFormatException e) {
+                       // expect this
+               }
+       }
+       
+       public void testHexToInt() {
+               
+               int i1 = Fields.hexToInt("0");
+               assertEquals(i1, 0);
+               
+               i1 = Fields.hexToInt("000000");
+               assertEquals(i1, 0);
+               
+               i1 = Fields.hexToInt("1");
+               assertEquals(i1, 1);
+               
+               i1 = Fields.hexToInt("a");
+               assertEquals(i1, 10);
+               
+               i1 = Fields.hexToInt("ff");
+               assertEquals(i1, 255);
+               
+               i1 = Fields.hexToInt("80000000");
+               assertEquals(i1, Integer.MIN_VALUE);
+               
+               i1 = Fields.hexToInt("0000000080000000"); // 16 chars
+               assertEquals(i1, Integer.MIN_VALUE);
+               
+               i1 = Fields.hexToInt("7fffffff");
+               assertEquals(i1, Integer.MAX_VALUE);
+               
+               try {
+                       i1 = Fields.hexToInt("0123456789abcdef0"); // 17 chars
+                       fail();
+               }
+               catch(NumberFormatException e){
+                       // expect this
+               }
+               
+               try {
+                       i1 = Fields.hexToInt("C0dER"); // invalid char
+                       fail();
+               }
+               catch(NumberFormatException e){
+                       // expect this
+               }
+               
+               // see javadoc
+               i1 = Fields.hexToInt(Integer.toHexString(20));
+               assertEquals(20, i1);
+
+               i1 = Fields.hexToInt(Long.toHexString(Integer.MIN_VALUE));
+               assertEquals(Integer.MIN_VALUE, i1);
+
+               // see javadoc
+               try {
+                       String integerAsString = Integer.toString(-1, 16);
+                       i1 = Fields.hexToInt(integerAsString);
+                       fail();
+               }
+               catch(NumberFormatException e) {
+                       // expect this
+               }
+       }
+       
+       public void testStringToBool() {
+               assertTrue(Fields.stringToBool("true"));
+               assertTrue(Fields.stringToBool("TRUE"));
+               assertFalse(Fields.stringToBool("false"));
+               assertFalse(Fields.stringToBool("FALSE"));
+               
+               try {
+                       Fields.stringToBool("Free Tibet");
+                       fail();
+               }
+               catch(NumberFormatException e) {
+                       // expect this
+               }
+               
+               try {
+                       Fields.stringToBool(null);
+                       fail();
+               }
+               catch(NumberFormatException e) {
+                       // expect this
+               }
+       }
+       
+       public void testStringToBoolWithDefault() {
+               assertTrue(Fields.stringToBool("true", false));
+               assertFalse(Fields.stringToBool("false", true));
+               assertTrue(Fields.stringToBool("TruE", false));
+               assertFalse(Fields.stringToBool("faLSE", true));
+               assertTrue(Fields.stringToBool("trueXXX", true));
+               assertFalse(Fields.stringToBool("XXXFalse", false));
+               assertTrue(Fields.stringToBool(null, true));
+       }
+       
+       public void testBoolToString() {
+               assertEquals(Fields.boolToString(true), "true");
+               assertEquals(Fields.boolToString(false), "false");
+       }
+       
+       public void testCommaListFromString() {
+               String[] expected = new String[] {"one", "two", "three", 
"four"};
+               String[] actual = Fields.commaList("one,two,     three    ,  
four");
+               
+               for(int i = 0; i < expected.length; i++) {
+                       assertEquals(expected[i], actual[i]);
+               }
+               
+               // null
+               assertNull(Fields.commaList((String)null));
+               
+               // no items
+               expected = new String[] {};
+               actual = Fields.commaList("");
+               
+               assertTrue(expected.length == actual.length);
+       }
+       
+       public void testStringArrayToCommaList() {
+               
+               String[] input = new String[] { "one", "two", "three", "four" };
+               
+               String expected = "one,two,three,four";
+               String actual = Fields.commaList(input);
+               
+               assertEquals(expected, actual);
+               
+               // empty
+               input = new String[] {};
+               
+               expected = "";
+               actual = Fields.commaList(input);
+               
+               assertEquals(expected, actual);
+       }
+       
+       public void testHashcodeForByteArray() {
+               byte[] input = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
+               
+               assertEquals(67372036, Fields.hashCode(input));
+               
+               // empty
+               input = new byte[] {};
+               
+               assertEquals(0, Fields.hashCode(input));
+       }
+       
+       public void testLongHashcode() {
+               
+               byte[] b1 = new byte[] { 1, 1, 2, 2, 3, 3 };
+               byte[] b2 = new byte[] { 2, 2, 3, 3, 4, 4 };
+               byte[] b3 = new byte[] { 1, 1, 2, 2, 3, 3 };
+               
+               Long l1 = new Long(Fields.longHashCode(b1));
+               Long l2 = new Long(Fields.longHashCode(b2));
+               Long l3 = new Long(Fields.longHashCode(b3));
+
+               assertFalse(l1.equals(l2));
+               assertFalse(l2.equals(l3));
+               assertTrue(l3.equals(l1)); // should be same due to 
Fields.longHashcode
+       }       
+       
+       public void testIntsToBytes() {
+               int[] longs = new int[] {};
+               doRoundTripIntsArrayToBytesArray(longs);
+               
+               longs = new int[] {Integer.MIN_VALUE};
+               doRoundTripIntsArrayToBytesArray(longs);
+               
+               longs = new int[] {0, Integer.MAX_VALUE, Integer.MIN_VALUE};
+               doRoundTripIntsArrayToBytesArray(longs);
+               
+               longs = new int[] {33685760, 51511577};
+               doRoundTripIntsArrayToBytesArray(longs);                
+       }
+
+       private void doRoundTripIntsArrayToBytesArray(int[] ints) {
+               byte[] bytes = Fields.intsToBytes(ints);
+               assert(bytes.length == ints.length * 8);
+               
+               int[] outLongs = Fields.bytesToInts(bytes);
+               for(int i = 0; i < ints.length; i++) {
+                       assertTrue(outLongs[i] == ints[i]);
+               }
+               assertEquals(outLongs.length, ints.length);
+       }
+       
+       public void testBytesToLongsException() {
+               byte[] bytes = new byte[3];
+               try {
+                       Fields.bytesToLongs(bytes, 0, bytes.length);
+                       fail();
+               }
+               catch(IllegalArgumentException e){
+                       // expect this
+               }               
+       }
+       
+       public void testBytesToInt() {
+               
+               byte[] bytes = new byte[] { 0, 1, 2, 2 };
+               
+               int outLong = Fields.bytesToInt(bytes, 0);
+               // We did dupplicate the code to avoid cross-dependancies
+               // TODO: Will need to be updated when next -ext is released
+               int outLongMT = MersenneTwister.bytesToInt(bytes, 0);
+               assertEquals(outLong, outLongMT);
+               assertEquals(outLong, 33685760);
+               
+               doTestRoundTripBytesArrayToInt(bytes);
+               
+               bytes = new byte[] {};
+               try{
+                       doTestRoundTripBytesArrayToInt(bytes);
+                       fail();
+               }
+               catch(IllegalArgumentException e) {
+                       //expect this
+               }
+               
+               bytes = new byte[] {1, 1, 1, 1};
+               doTestRoundTripBytesArrayToInt(bytes);
+       }
+       
+       private void doTestRoundTripBytesArrayToInt(byte[] inBytes) {
+
+               int outLong = Fields.bytesToInt(inBytes, 0);
+               assertEquals(outLong, MersenneTwister.bytesToInt(inBytes, 0));
+               byte[] outBytes = Fields.intToBytes(outLong);
+               for(int i = 0; i < inBytes.length; i++) {
+                       assertEquals(outBytes[i], inBytes[i]);
+               }
+               assertEquals(outBytes.length, inBytes.length);
+       }
+       
+       public void testLongsToBytes() {
+               long[] longs = new long[] {};
+               doRoundTripLongsArrayToBytesArray(longs);
+               
+               longs = new long[] {Long.MIN_VALUE};
+               doRoundTripLongsArrayToBytesArray(longs);
+               
+               longs = new long[] {0L, Long.MAX_VALUE, Long.MIN_VALUE};
+               doRoundTripLongsArrayToBytesArray(longs);
+               
+               longs = new long[] {3733393793879837L};
+               doRoundTripLongsArrayToBytesArray(longs);               
+       }
+
+       private void doRoundTripLongsArrayToBytesArray(long[] longs) {
+               byte[] bytes = Fields.longsToBytes(longs);
+               assert(bytes.length == longs.length * 8);
+               
+               long[] outLongs = Fields.bytesToLongs(bytes);
+               for(int i = 0; i < longs.length; i++) {
+                       assertTrue(outLongs[i] == longs[i]);
+               }
+               assertEquals(outLongs.length, longs.length);
+       }
+       
+       public void testBytesToLongException() {
+               byte[] bytes = new byte[3];
+               try {
+                       Fields.bytesToLongs(bytes, 0, bytes.length);
+                       fail();
+               }
+               catch(IllegalArgumentException e){
+                       // expect this
+               }
+       }
+       
+       public void testBytesToLong() {
+               
+               byte[] bytes = new byte[] { 0, 1, 2, 2, 1, 3, 6, 7 };
+               
+               long outLong = Fields.bytesToLong(bytes);
+               assertEquals(outLong, 506095310989295872L);
+                               
+               doTestRoundTripBytesArrayToLong(bytes);
+               
+               bytes = new byte[] {};
+               try{
+                       doTestRoundTripBytesArrayToLong(bytes);
+                       fail();
+               }
+               catch(IllegalArgumentException e) {
+                       //expect this
+               }
+               
+               bytes = new byte[] {1, 1, 1, 1, 1, 1, 1, 1};
+               doTestRoundTripBytesArrayToLong(bytes);
+               
+       }
+       
+       private void doTestRoundTripBytesArrayToLong(byte[] inBytes) {
+
+               long outLong = Fields.bytesToLong(inBytes);
+               byte[] outBytes = Fields.longToBytes(outLong);
+               for(int i = 0; i < inBytes.length; i++) {
+                       assertEquals(outBytes[i], inBytes[i]);
+               }
+               assertEquals(outBytes.length, inBytes.length);
+       }
+
+}

Modified: branches/db4o/freenet/test/freenet/support/LRUHashtableTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/LRUHashtableTest.java    
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/LRUHashtableTest.java    
2009-03-18 00:11:38 UTC (rev 26082)
@@ -200,7 +200,7 @@
         * LRUHashtable.
         */
        public void testPopValueFromEmpty() {
-               LRUHashtable methodLRUht = new LRUHashtable();
+               LRUHashtable<?, ?> methodLRUht = new LRUHashtable<Object, 
Object>();
                assertNull(methodLRUht.popValue());
        }

@@ -342,7 +342,7 @@
                //pushing objects
                for (int i=0; i<sampleObjects.length; i++)
                        
methodLRUht.push(sampleObjects[i][0],sampleObjects[i][1]);
-               Enumeration methodEnumeration = methodLRUht.keys();
+               Enumeration<Object> methodEnumeration = methodLRUht.keys();
                int j=0;
                while(methodEnumeration.hasMoreElements()) {                    
                        
assertEquals(methodEnumeration.nextElement(),sampleObjects[j][0]);

Modified: branches/db4o/freenet/test/freenet/support/LRUQueueTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/LRUQueueTest.java        
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/LRUQueueTest.java        
2009-03-18 00:11:38 UTC (rev 26082)
@@ -16,6 +16,7 @@
 package freenet.support;

 import java.util.Enumeration;
+
 import junit.framework.TestCase;

 /**
@@ -44,8 +45,8 @@
         * @param size queue size
         * @return the created LRUQueue
         */
-       private LRUQueue createSampleQueue(int size) {
-               LRUQueue methodLRUQueue = new LRUQueue();
+       private LRUQueue<Object> createSampleQueue(int size) {
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(size);
                for (int i=0;i<sampleObjects.length;i++)
                        methodLRUQueue.push(sampleObjects[i]);
@@ -73,10 +74,10 @@
         * @param last the last element expected
         * @return true if the order is correct
         */
-       private boolean verifyLastElemsOrder(LRUQueue aLRUQueue, Object 
nextToLast, Object last ) {
+       private boolean verifyLastElemsOrder(LRUQueue<Object> aLRUQueue, Object 
nextToLast, Object last ) {
                boolean retVal = true;
                int size = aLRUQueue.size();
-               Enumeration methodEnum = aLRUQueue.elements();
+               Enumeration<Object> methodEnum = aLRUQueue.elements();
                int counter = 0;
                while (methodEnum.hasMoreElements()) {
                        //next-to-last object
@@ -97,12 +98,19 @@
         * exception is raised
         */
        public void testPushNull() {
-               LRUQueue methodLRUQueue = 
this.createSampleQueue(sampleElemsNumber);
+               LRUQueue<Object> methodLRUQueue = 
this.createSampleQueue(sampleElemsNumber);
                try {
                        methodLRUQueue.push(null);
                        fail("Expected Exception Error Not Thrown!"); }
                catch (NullPointerException anException) {
                        assertNotNull(anException);     }
+
+               try {
+                       methodLRUQueue.pushLeast(null);
+                       fail("Expected Exception Error Not Thrown!");
+               } catch (NullPointerException anException) {
+                       assertNotNull(anException);
+               }
        }

        /**
@@ -110,7 +118,7 @@
         * when pushing the same object more than one time.
         */
        public void testPushSameObjTwice() {
-               LRUQueue methodLRUQueue = 
this.createSampleQueue(sampleElemsNumber);
+               LRUQueue<Object> methodLRUQueue = 
this.createSampleQueue(sampleElemsNumber);
                Object[] sampleObj = {new Object(), new Object()};

                methodLRUQueue.push(sampleObj[0]);
@@ -132,7 +140,7 @@
         * Tests {@link LRUQueue#pushLeast(Object)} method
         */
        public void testPushLeast() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObj = { new Object(), new Object() };

                methodLRUQueue.push(sampleObj[0]);
@@ -153,7 +161,7 @@
         * verifying if they are correctly (in a FIFO manner) fetched and 
deleted
         */
        public void testPop() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);
                //pushing objects
                for (int i=0; i<sampleObjects.length; i++)              
@@ -171,7 +179,7 @@
         */
        public void testSize() {
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                assertEquals(0, methodLRUQueue.size());
                //pushing objects
                for (int i=0; i<sampleObjects.length; i++) {
@@ -192,7 +200,7 @@
         * still contained and the queue size.
         */
        public void testRemove() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);
                for (int i=0;i<sampleObjects.length;i++)
                        methodLRUQueue.push(sampleObjects[i]);
@@ -209,7 +217,7 @@
         * trying to remove it after setting up a sample queue.
         */
        public void testRemoveNull() {
-               LRUQueue methodLRUQueue = createSampleQueue(sampleElemsNumber);
+               LRUQueue<Object> methodLRUQueue = 
createSampleQueue(sampleElemsNumber);
                try {
                        methodLRUQueue.remove(null);
                        fail("Expected Exception Error Not Thrown!"); }
@@ -222,7 +230,7 @@
         * present object after setting up a sample queue.
         */
        public void testRemoveNotPresent() {
-               LRUQueue methodLRUQueue = createSampleQueue(sampleElemsNumber);
+               LRUQueue<Object> methodLRUQueue = 
createSampleQueue(sampleElemsNumber);
                assertFalse(methodLRUQueue.remove(new Object()));
        }

@@ -232,7 +240,7 @@
         * object.
         */
        public void testContains() {
-               LRUQueue methodLRUQueue = createSampleQueue(sampleElemsNumber);
+               LRUQueue<Object> methodLRUQueue = 
createSampleQueue(sampleElemsNumber);
                assertFalse(methodLRUQueue.contains(new Object()));
                Object methodSampleObj = new Object();
                methodLRUQueue.push(methodSampleObj);
@@ -246,11 +254,11 @@
         */
        public void testElements() {
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                //pushing objects
                for (int i=0; i<sampleObjects.length; i++)
                        methodLRUQueue.push(sampleObjects[i]);
-               Enumeration methodEnumeration = methodLRUQueue.elements();
+               Enumeration<Object> methodEnumeration = 
methodLRUQueue.elements();
                int j=0;
                while(methodEnumeration.hasMoreElements()) {                    
                        assertEquals(sampleObjects[j], 
methodEnumeration.nextElement());
@@ -263,7 +271,7 @@
         * has the same object that are put into the created LRUQueue
         */
        public void testToArray() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);

                //pushing objects
@@ -281,7 +289,7 @@
         * Tests {@link LRUQueue#toArray(Object[])} method
         */
        public void testToArray2() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);

                // pushing objects
@@ -300,7 +308,7 @@
         * Tests {@link LRUQueue#toArrayOrdered()} method
         */
        public void testToArrayOrdered() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);

                // pushing objects
@@ -318,7 +326,7 @@
         * Tests <code>toArrayOrdered(Object[])</code> method
         */
        public void testToArrayOrdered2() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                Object[] sampleObjects = createSampleObjects(sampleElemsNumber);

                // pushing objects
@@ -339,7 +347,7 @@
         * when the queue is empty
         */
        public void testToArrayEmptyQueue() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                assertEquals(0, methodLRUQueue.toArray().length);
        }

@@ -349,7 +357,7 @@
         * and then with a sample queue.
         */
        public void testIsEmpty() {
-               LRUQueue methodLRUQueue = new LRUQueue();
+               LRUQueue<Object> methodLRUQueue = new LRUQueue<Object>();
                assertTrue(methodLRUQueue.isEmpty());
                methodLRUQueue = createSampleQueue(sampleElemsNumber);
                assertFalse(methodLRUQueue.isEmpty());

Modified: branches/db4o/freenet/test/freenet/support/SortedLongSetTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/SortedLongSetTest.java   
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/SortedLongSetTest.java   
2009-03-18 00:11:38 UTC (rev 26082)
@@ -161,25 +161,25 @@
        public void testGrownAndScale() {
                SortedLongSet set = new SortedLongSet();

-               for (int i = 1; i < 512; i++) {
-                       set.add((long) i);
-                       set.add((long) -i);
+               for (long i = 1; i < 512; i++) {
+                       set.add(i);
+                       set.add(-i);
                }

-               for (int i = 1; i < 512; i++) {
-                       assertTrue(set.contains((long) i));
-                       assertTrue(set.contains((long) -i));
+               for (long i = 1; i < 512; i++) {
+                       assertTrue(set.contains(i));
+                       assertTrue(set.contains(-i));
                }

                // remove and shink
-               for (int i = 1; i < 512; i++) {
+               for (long i = 1; i < 512; i++) {
                        set.remove(i);

-                       assertFalse(set.contains((long) i));
-                       assertTrue(set.contains((long) -i));
+                       assertFalse(set.contains(i));
+                       assertTrue(set.contains(-i));

                        set.remove(-i);
-                       assertFalse(set.contains((long) -i));
+                       assertFalse(set.contains(-i));
                }
        }
 }


Property changes on: 
branches/db4o/freenet/test/freenet/support/io/MockInputStream.java
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk/freenet/test/freenet/support/io/MockInputStream.java:22002-25209,25900
   + 
/trunk/freenet/test/freenet/support/io/MockInputStream.java:22002-25872,25900

Modified: 
branches/db4o/freenet/test/freenet/support/io/PaddedEphemerallyEncryptedBucketTest.java
===================================================================
--- 
branches/db4o/freenet/test/freenet/support/io/PaddedEphemerallyEncryptedBucketTest.java
     2009-03-17 23:32:40 UTC (rev 26081)
+++ 
branches/db4o/freenet/test/freenet/support/io/PaddedEphemerallyEncryptedBucketTest.java
     2009-03-18 00:11:38 UTC (rev 26082)
@@ -17,7 +17,7 @@
        @Override
        protected Bucket makeBucket(long size) throws IOException {
                FilenameGenerator filenameGenerator = new 
FilenameGenerator(weakPRNG, false, null, "junit");
-               TempFileBucket fileBucket = new 
TempFileBucket(filenameGenerator.makeRandomFilename(), filenameGenerator);
+               TempFileBucket fileBucket = new 
TempFileBucket(filenameGenerator.makeRandomFilename(), filenameGenerator, true);
                return new PaddedEphemerallyEncryptedBucket(fileBucket, 1024, 
strongPRNG, weakPRNG);
        }


Modified: branches/db4o/freenet/test/freenet/support/io/TempFileBucketTest.java
===================================================================
--- branches/db4o/freenet/test/freenet/support/io/TempFileBucketTest.java       
2009-03-17 23:32:40 UTC (rev 26081)
+++ branches/db4o/freenet/test/freenet/support/io/TempFileBucketTest.java       
2009-03-18 00:11:38 UTC (rev 26082)
@@ -15,7 +15,7 @@
        @Override
        protected Bucket makeBucket(long size) throws IOException {
                FilenameGenerator filenameGenerator = new 
FilenameGenerator(weakPRNG, false, null, "junit");
-               BaseFileBucket bfb = new 
TempFileBucket(filenameGenerator.makeRandomFilename(), filenameGenerator);
+               BaseFileBucket bfb = new 
TempFileBucket(filenameGenerator.makeRandomFilename(), filenameGenerator, true);

                assertTrue("deleteOnExit", bfb.deleteOnExit());
                assertTrue("deleteOnFree", bfb.deleteOnFree());


Reply via email to