Various little cleanups including several discovered by Aaron using an automated tool.

* WorkQueueFrontier.java
   (HER-1925) avoid 2 possible null pointer dereferences
* CrawlController.java
    getState() - change declared return type from Object to State
* CrawlerLoggerModule.java
    (HER-1932) remove unused, unset field "reports"
* BdbCookieStorage.java
    elide pointless extra variable
* FetchHTTP.java, DownloadURLConnection.java, ProcessUtils.java
   (HER-1933) use Arrays.toString() for logged arrays
* CrawlServer.java
    - remove unused field robotstxtChecksum
    - updateRobots() - avoid reinventing existing utility class InstanceofPredicate
* ExternalGeoLookupInterface.java
    (HER-1938) extend Serializable, since ExternalGeoLocationDecideRule is declared Serializable and has a ExternalGeoLookupInterface field
* DecideRuleSequence.java
    (HER-1937) make field fileLogger transient
* PersistLogProcessor.java
    (HER-1924) remove field recoveryCheckpoint shadowing same field in superclass Processor
* ExtractorUniversal.java
    (HER-1920) use return value of potentialTLD.toLowerCase() as it appears was intended
* ARCWriterProcessor.java
    (HER-1928) avoid possible null pointer dereference
* S3URLConnection.java
    (HER-1933) set S3ServiceException as cause of rethrown IOException, and do not put stacktrace array in message
* ObjectIdentityMemCache.java
    (HER-1929) avoid possible null pointer dereference
* .classpath
    more source jar references, other cleanup
This commit is contained in:
nlevitt committed 2011-09-12 02:12:44 +00:00
1 parent e38f0a73ba
commit 24f4b715ec
16 files changed
+56 -82

No files matched your search

@@ -581,7 +581,7 @@ implements Serializable,
/**
* @return CrawlController state.
*/
public Object getState() {
public State getState() {
return this.state;
}
@@ -36,10 +36,10 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Set;
import java.util.SortedMap;
import java.util.Map.Entry;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.DelayQueue;
@@ -1289,15 +1289,16 @@ implements Closeable,
q = null;
}
}
if(q == null) {
if(q != null) {
if(!legendWritten) {
writer.println(q.shortReportLegend());
legendWritten = true;
}
q.shortReportLineTo(writer);
} else {
writer.print(" ERROR: "+obj);
}
if(!legendWritten) {
writer.println(q.shortReportLegend());
legendWritten = true;
}
q.shortReportLineTo(writer);
}
}
@@ -1459,7 +1460,7 @@ implements Closeable,
* @param total
* @param max
*/
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
protected void appendQueueReports(PrintWriter w, String label, Iterator<?> iterator,
int total, int max) {
Object obj;
@@ -1479,11 +1480,12 @@ implements Closeable,
} else {
q = this.allQueues.get((String)obj);
}
if(q == null) {
if(q != null) {
w.println(label+"#"+count+":");
q.reportTo(w);
} else {
w.print("WARNING: No report for queue "+obj);
}
w.println(label+"#"+count+":");
q.reportTo(w);
}
count++;
if(count < total) {
@@ -191,14 +191,6 @@ public class CrawlerLoggerModule
*/
private transient Logger progressStats;
/**
* Logger to hold job summary report.
*
* Large state reports made at infrequent intervals (e.g. job ending) go
* here.
*/
private transient Logger reports;
/**
* Record of fileHandlers established for loggers,
* assisting file rotation.
@@ -402,12 +394,6 @@ public class CrawlerLoggerModule
return progressStats;
}
public Logger getReports() {
return reports;
}
public Logger getRuntimeErrors() {
return runtimeErrors;
}