Author: zothar
Date: 2006-05-29 14:08:49 +0000 (Mon, 29 May 2006)
New Revision: 8917

Modified:
   trunk/freenet/src/freenet/client/async/ClientRequester.java
   trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
Log:
Spare mere mortals (and their logs) the details of a couple of common errors 
(but still give them the 'summary')

Modified: trunk/freenet/src/freenet/client/async/ClientRequester.java
===================================================================
--- trunk/freenet/src/freenet/client/async/ClientRequester.java 2006-05-29 
13:31:38 UTC (rev 8916)
+++ trunk/freenet/src/freenet/client/async/ClientRequester.java 2006-05-29 
14:08:49 UTC (rev 8917)
@@ -64,13 +64,19 @@

        public synchronized void addBlock() {
                if(blockSetFinalized)
-                       Logger.error(this, "addBlock() but set finalized! on 
"+this, new Exception("error"));
+                       if(Logger.globalGetThreshold() > Logger.MINOR)
+                               Logger.error(this, "addBlock() but set 
finalized! on "+this);
+                       else
+                               Logger.error(this, "addBlock() but set 
finalized! on "+this, new Exception("error"));
                totalBlocks++;
        }

        public synchronized void addBlocks(int num) {
                if(blockSetFinalized)
-                       Logger.error(this, "addBlock() but set finalized! on 
"+this, new Exception("error"));
+                       if(Logger.globalGetThreshold() > Logger.MINOR)
+                               Logger.error(this, "addBlocks() but set 
finalized! on "+this);
+                       else
+                               Logger.error(this, "addBlocks() but set 
finalized! on "+this, new Exception("error"));
                totalBlocks+=num;
        }


Modified: trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java
===================================================================
--- trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java 
2006-05-29 13:31:38 UTC (rev 8916)
+++ trunk/freenet/src/freenet/client/events/SplitfileProgressEvent.java 
2006-05-29 14:08:49 UTC (rev 8917)
@@ -29,8 +29,12 @@
                if(minSuccessfulBlocks == 0 && fetchedBlocks == 0)
                        minSuccessfulBlocks = 1;
                if(minSuccessfulBlocks == 0) {
-                       Logger.error(this, "minSuccessfulBlocks=0, 
fetchedBlocks="+fetchedBlocks+", totalBlocks="+totalBlocks+
-                                       ", failedBlocks="+failedBlocks+", 
fatallyFailedBlocks="+fatallyFailedBlocks+", finalizedTotal="+finalizedTotal, 
new Exception("debug"));
+                       if(Logger.globalGetThreshold() > Logger.MINOR)
+                               Logger.error(this, "minSuccessfulBlocks=0, 
fetchedBlocks="+fetchedBlocks+", totalBlocks="+totalBlocks+
+                                               ", 
failedBlocks="+failedBlocks+", fatallyFailedBlocks="+fatallyFailedBlocks+", 
finalizedTotal="+finalizedTotal);
+                       else
+                               Logger.error(this, "minSuccessfulBlocks=0, 
fetchedBlocks="+fetchedBlocks+", totalBlocks="+totalBlocks+
+                                               ", 
failedBlocks="+failedBlocks+", fatallyFailedBlocks="+fatallyFailedBlocks+", 
finalizedTotal="+finalizedTotal, new Exception("debug"));
                } else {
                        sb.append((100*(fetchedBlocks)/minSuccessfulBlocks));
                        sb.append('%');


Reply via email to