Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Move toLowerCase where it actually matters. Fix some whitespace.

Andrzej Bialecki03dd102fb8d4
diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
index 0f8fb4c79..17dbc5e4c 100644
--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
@@ -327,8 +327,8 @@ public abstract class HttpBase implements Protocol {
host = url.getHost();
if (host == null)
throw new HttpException("Unknown host for url: " + url);
+ host = host.toLowerCase();
}
- host = host.toLowerCase();
int delays = 0;
while (true) {
@@ -389,8 +389,8 @@ public abstract class HttpBase implements Protocol {
private static void cleanExpiredServerBlocks() {
synchronized (BLOCKED_ADDR_TO_TIME) {
- for(int i = BLOCKED_ADDR_QUEUE.size()-1; i >= 0; i--){
- String host = (String) BLOCKED_ADDR_QUEUE.get(i);
+ for (int i = BLOCKED_ADDR_QUEUE.size() - 1; i >= 0; i--) {
+ String host = (String) BLOCKED_ADDR_QUEUE.get(i);
long time = ((Long) BLOCKED_ADDR_TO_TIME.get(host)).longValue();
if (time <= System.currentTimeMillis()) {
BLOCKED_ADDR_TO_TIME.remove(host);