Author: j16sdiz
Date: 2009-04-17 11:43:25 +0000 (Fri, 17 Apr 2009)
New Revision: 26929
Modified:
trunk/freenet/src/freenet/client/FetchException.java
Log:
Logging
Modified: trunk/freenet/src/freenet/client/FetchException.java
===================================================================
--- trunk/freenet/src/freenet/client/FetchException.java 2009-04-17
11:12:27 UTC (rev 26928)
+++ trunk/freenet/src/freenet/client/FetchException.java 2009-04-17
11:43:25 UTC (rev 26929)
@@ -7,6 +7,7 @@
import freenet.keys.FreenetURI;
import freenet.l10n.L10n;
+import freenet.support.LogThresholdCallback;
import freenet.support.Logger;
/**
@@ -14,6 +15,16 @@
* these to tell the client.
*/
public class FetchException extends Exception {
+ private static volatile boolean logMINOR;
+
+ static {
+ Logger.registerLogThresholdCallback(new LogThresholdCallback() {
+ @Override
+ public void shouldUpdate() {
+ logMINOR = Logger.shouldLog(Logger.MINOR, this);
+ }
+ });
+ }
private static final long serialVersionUID = -1106716067841151962L;
@@ -54,7 +65,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -69,7 +80,7 @@
this.expectedMimeType = expectedMimeType;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -84,7 +95,7 @@
this.expectedMimeType = expectedMimeType;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -98,7 +109,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -112,7 +123,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -126,7 +137,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -140,7 +151,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -154,7 +165,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -167,7 +178,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -180,7 +191,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -193,7 +204,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -206,7 +217,7 @@
expectedSize = -1;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -221,7 +232,7 @@
this.finalizedSizeAndMimeType = e.finalizedSizeAndMimeType;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -238,7 +249,7 @@
this.finalizedSizeAndMimeType = e.finalizedSizeAndMimeType;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
@@ -254,7 +265,7 @@
this.finalizedSizeAndMimeType = e.finalizedSizeAndMimeType;
if(mode == INTERNAL_ERROR)
Logger.error(this, "Internal error: "+this);
- else if(Logger.shouldLog(Logger.MINOR, this))
+ else if(logMINOR)
Logger.minor(this, "FetchException("+getMessage(mode)+
')', this);
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs