Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2364 http.agent.rotate: IllegalArgumentException / last element of agent names ignored

Sebastian Nagele5e67028251e
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 eb3eb60ad..156929dd5 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
@@ -386,7 +386,7 @@ public abstract class HttpBase implements Protocol {
public String getUserAgent() {
if (userAgentNames!=null) {
- return userAgentNames.get(ThreadLocalRandom.current().nextInt(userAgentNames.size()-1));
+ return userAgentNames.get(ThreadLocalRandom.current().nextInt(userAgentNames.size()));
}
return userAgent;
}