You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by te...@apache.org on 2013/05/22 11:07:54 UTC
svn commit: r1485125 - in /nutch/branches/2.x: ./
src/java/org/apache/nutch/api/ src/java/org/apache/nutch/api/impl/
src/java/org/apache/nutch/crawl/ src/java/org/apache/nutch/metadata/
src/java/org/apache/nutch/net/ src/java/org/apache/nutch/plugin/ s...
Author: tejasp
Date: Wed May 22 09:07:53 2013
New Revision: 1485125
URL: http://svn.apache.org/r1485125
Log:
NUTCH-1249 and NUTCH-1275 : Resolve all issues flagged up by adding javac -Xlint argument
Modified:
nutch/branches/2.x/CHANGES.txt
nutch/branches/2.x/build.xml
nutch/branches/2.x/src/java/org/apache/nutch/api/ConfResource.java
nutch/branches/2.x/src/java/org/apache/nutch/api/DbReader.java
nutch/branches/2.x/src/java/org/apache/nutch/api/JobResource.java
nutch/branches/2.x/src/java/org/apache/nutch/api/impl/RAMJobManager.java
nutch/branches/2.x/src/java/org/apache/nutch/crawl/NutchWritable.java
nutch/branches/2.x/src/java/org/apache/nutch/metadata/Metadata.java
nutch/branches/2.x/src/java/org/apache/nutch/metadata/SpellCheckedMetadata.java
nutch/branches/2.x/src/java/org/apache/nutch/net/URLNormalizers.java
nutch/branches/2.x/src/java/org/apache/nutch/plugin/Extension.java
nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginDescriptor.java
nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginRepository.java
nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java
nutch/branches/2.x/src/java/org/apache/nutch/storage/ParseStatus.java
nutch/branches/2.x/src/java/org/apache/nutch/storage/ProtocolStatus.java
nutch/branches/2.x/src/java/org/apache/nutch/storage/WebPage.java
nutch/branches/2.x/src/java/org/apache/nutch/tools/ResolveUrls.java
nutch/branches/2.x/src/java/org/apache/nutch/util/GenericWritableConfigurable.java
nutch/branches/2.x/src/java/org/apache/nutch/util/PrefixStringMatcher.java
nutch/branches/2.x/src/java/org/apache/nutch/util/SuffixStringMatcher.java
nutch/branches/2.x/src/java/org/apache/nutch/util/ToolUtil.java
nutch/branches/2.x/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java
nutch/branches/2.x/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java
nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java
nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMContentUtils.java
nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Client.java
nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java
nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java
nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationException.java
nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java
nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java
nutch/branches/2.x/src/plugin/protocol-sftp/src/java/org/apache/nutch/protocol/sftp/Sftp.java
nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java
nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java
nutch/branches/2.x/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java
nutch/branches/2.x/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java
nutch/branches/2.x/src/plugin/urlnormalizer-regex/src/test/org/apache/nutch/net/urlnormalizer/regex/TestRegexURLNormalizer.java
Modified: nutch/branches/2.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/CHANGES.txt?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/CHANGES.txt (original)
+++ nutch/branches/2.x/CHANGES.txt Wed May 22 09:07:53 2013
@@ -2,6 +2,8 @@ Nutch Change Log
Release 2.2 - Current Development
+* NUTCH-1249 and NUTCH-1275 : Resolve all issues flagged up by adding javac -Xlint argument (tejasp)
+
* NUTCH-1569 Upgrade 2.x to Gora 0.3 (lewismc)
* NUTCH-1513 Support Robots.txt for Ftp urls (tejasp)
Modified: nutch/branches/2.x/build.xml
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/build.xml?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/build.xml (original)
+++ nutch/branches/2.x/build.xml Wed May 22 09:07:53 2013
@@ -44,6 +44,10 @@
</fileset>
</path>
+ <presetdef name="javac">
+ <javac includeantruntime="false" />
+ </presetdef>
+
<!-- the unit test classpath -->
<dirname property="plugins.classpath.dir" file="${build.plugins}" />
<path id="test.classpath">
@@ -95,7 +99,7 @@
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
- <compilerarg value="-Xlint"/>
+ <compilerarg value="-Xlint:-path"/>
<classpath refid="classpath" />
</javac>
</target>
@@ -332,7 +336,7 @@
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
- <compilerarg value="-Xlint"/>
+ <compilerarg value="-Xlint:-path"/>
<classpath refid="test.classpath" />
</javac>
</target>
Modified: nutch/branches/2.x/src/java/org/apache/nutch/api/ConfResource.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/api/ConfResource.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/api/ConfResource.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/api/ConfResource.java Wed May 22 09:07:53 2013
@@ -19,7 +19,6 @@ package org.apache.nutch.api;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
-import org.restlet.data.Form;
import org.restlet.resource.Delete;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
@@ -54,6 +53,7 @@ public class ConfResource extends Server
}
}
+ @SuppressWarnings("unchecked")
@Put("json")
public String create(Map<String,Object> args) throws Exception {
System.out.println("args=" + args);
@@ -61,7 +61,11 @@ public class ConfResource extends Server
if (id == null) {
id = String.valueOf(seqId.incrementAndGet());
}
- Map<String,String> props = (Map<String,String>)args.get(Params.PROPS);
+ Object temp = args.get(Params.PROPS);
+ Map<String,String> props = null;
+ if(temp instanceof Map<?, ?>)
+ props = (Map<String,String>) temp;
+
Boolean force = (Boolean)args.get(Params.FORCE);
boolean f = force != null ? force : false;
NutchApp.confMgr.create(id, props, f);
Modified: nutch/branches/2.x/src/java/org/apache/nutch/api/DbReader.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/api/DbReader.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/api/DbReader.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/api/DbReader.java Wed May 22 09:07:53 2013
@@ -163,6 +163,7 @@ public class DbReader {
return pageAsMap(url, page);
}
+ @SuppressWarnings("unchecked")
private Map<String,Object> pageAsMap(String url, WebPage page) {
HashMap<String,Object> res = new HashMap<String,Object>();
if (fields == null || fields.contains("url")) {
@@ -228,10 +229,10 @@ public class DbReader {
return res;
}
- private Map<String,String> convertMap(Map map) {
+ private Map<String,String> convertMap(Map<?,?> map) {
Map<String,String> res = new HashMap<String,String>();
for (Object o : map.entrySet()) {
- Entry e = (Entry)o;
+ Entry<?, ?> e = (Entry<?, ?>)o;
res.put(e.getKey().toString(), e.getValue().toString());
}
return res;
Modified: nutch/branches/2.x/src/java/org/apache/nutch/api/JobResource.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/api/JobResource.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/api/JobResource.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/api/JobResource.java Wed May 22 09:07:53 2013
@@ -16,7 +16,6 @@
******************************************************************************/
package org.apache.nutch.api;
-import java.util.List;
import java.util.Map;
import org.apache.nutch.api.JobManager.JobType;
@@ -73,12 +72,17 @@ public class JobResource extends ServerR
* Object[] args
*/
@Put("json")
+ @SuppressWarnings("unchecked")
public Object create(Map<String,Object> args) throws Exception {
String cid = (String)args.get(Params.CRAWL_ID);
String typeString = (String)args.get(Params.JOB_TYPE);
JobType type = JobType.valueOf(typeString.toUpperCase());
String confId = (String)args.get(Params.CONF_ID);
- Map<String,Object> cmdArgs = (Map<String,Object>)args.get(Params.ARGS);
+ Object map = args.get(Params.ARGS);
+ Map<String,Object> cmdArgs = null;
+ if(map instanceof Map<?,?>)
+ cmdArgs = (Map<String,Object>)map;
+
String jobId = NutchApp.jobMgr.create(cid, type, confId, cmdArgs);
return jobId;
}
Modified: nutch/branches/2.x/src/java/org/apache/nutch/api/impl/RAMJobManager.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/api/impl/RAMJobManager.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/api/impl/RAMJobManager.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/api/impl/RAMJobManager.java Wed May 22 09:07:53 2013
@@ -16,20 +16,17 @@
******************************************************************************/
package org.apache.nutch.api.impl;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.nutch.api.ConfResource;
import org.apache.nutch.api.JobManager;
@@ -189,6 +186,7 @@ public class RAMJobManager implements Jo
Map<String,Object> args;
JobStatus jobStatus;
+ @SuppressWarnings("unchecked")
JobWorker(String crawlId, JobType type, String confId, Map<String,Object> args) throws Exception {
if (confId == null) {
confId = ConfResource.DEFAULT_CONF;
@@ -209,7 +207,10 @@ public class RAMJobManager implements Jo
}
Class<? extends NutchTool> clz = typeToClass.get(type);
if (clz == null) {
- clz = (Class<? extends NutchTool>)Class.forName((String)args.get(Nutch.ARG_CLASS));
+ Class<?> c = Class.forName((String)args.get(Nutch.ARG_CLASS));
+ if(c instanceof Class) {
+ clz = (Class<? extends NutchTool>) c;
+ }
}
tool = ReflectionUtils.newInstance(clz, conf);
jobStatus = new JobStatus(id, type, confId, args, State.IDLE, "idle");
Modified: nutch/branches/2.x/src/java/org/apache/nutch/crawl/NutchWritable.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/crawl/NutchWritable.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/crawl/NutchWritable.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/crawl/NutchWritable.java Wed May 22 09:07:53 2013
@@ -19,12 +19,13 @@ package org.apache.nutch.crawl;
import org.apache.hadoop.io.Writable;
import org.apache.nutch.util.GenericWritableConfigurable;
+@SuppressWarnings("unchecked")
public class NutchWritable extends GenericWritableConfigurable {
private static Class<? extends Writable>[] CLASSES = null;
static {
- CLASSES = new Class[] {
+ CLASSES = (Class<? extends Writable>[]) new Class<?>[] {
org.apache.nutch.scoring.ScoreDatum.class,
org.apache.nutch.util.WebPageWritable.class
};
Modified: nutch/branches/2.x/src/java/org/apache/nutch/metadata/Metadata.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/metadata/Metadata.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/metadata/Metadata.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/metadata/Metadata.java Wed May 22 09:07:53 2013
@@ -128,7 +128,7 @@ DublinCore, HttpHeaders, Nutch, Feed {
* @param properties properties to copy from
*/
public void setAll(Properties properties) {
- Enumeration names = properties.propertyNames();
+ Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
metadata.put(name, new String[]{properties.getProperty(name)});
Modified: nutch/branches/2.x/src/java/org/apache/nutch/metadata/SpellCheckedMetadata.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/metadata/SpellCheckedMetadata.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/metadata/SpellCheckedMetadata.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/metadata/SpellCheckedMetadata.java Wed May 22 09:07:53 2013
@@ -52,9 +52,9 @@ public class SpellCheckedMetadata extend
// Uses following array to fill the metanames index and the
// metanames list.
- Class[] spellthese = {HttpHeaders.class};
+ Class<?>[] spellthese = {HttpHeaders.class};
- for (Class spellCheckedNames : spellthese) {
+ for (Class<?> spellCheckedNames : spellthese) {
for (Field field : spellCheckedNames.getFields()) {
int mods = field.getModifiers();
if (Modifier.isFinal(mods) && Modifier.isPublic(mods)
Modified: nutch/branches/2.x/src/java/org/apache/nutch/net/URLNormalizers.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/net/URLNormalizers.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/net/URLNormalizers.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/net/URLNormalizers.java Wed May 22 09:07:53 2013
@@ -100,7 +100,7 @@ public final class URLNormalizers {
public static final Logger LOG = LoggerFactory.getLogger(URLNormalizers.class);
/* Empty extension list for caching purposes. */
- private final List<Extension> EMPTY_EXTENSION_LIST = Collections.EMPTY_LIST;
+ private final List<Extension> EMPTY_EXTENSION_LIST = Collections.emptyList();
private final URLNormalizer[] EMPTY_NORMALIZERS = new URLNormalizer[0];
@@ -193,6 +193,7 @@ public final class URLNormalizers {
* empty list.
* @throws PluginRuntimeException
*/
+ @SuppressWarnings("unchecked")
private List<Extension> getExtensions(String scope) {
ObjectCache objectCache = ObjectCache.get(conf);
List<Extension> extensions =
Modified: nutch/branches/2.x/src/java/org/apache/nutch/plugin/Extension.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/plugin/Extension.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/plugin/Extension.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/plugin/Extension.java Wed May 22 09:07:53 2013
@@ -25,8 +25,6 @@ import org.apache.hadoop.conf.Configurab
* An <code>Extension</code> is a kind of listener descriptor that will be
* installed on a concrete <code>ExtensionPoint</code> that acts as kind of
* Publisher.
- *
- * @author joa23
*/
public class Extension {
private PluginDescriptor fDescriptor;
@@ -153,7 +151,7 @@ public class Extension {
synchronized (getId()) {
try {
PluginClassLoader loader = fDescriptor.getClassLoader();
- Class extensionClazz = loader.loadClass(getClazz());
+ Class<?> extensionClazz = loader.loadClass(getClazz());
// lazy loading of Plugin in case there is no instance of the plugin
// already.
this.pluginRepository.getPluginInstance(getDescriptor());
Modified: nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginDescriptor.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginDescriptor.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginDescriptor.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginDescriptor.java Wed May 22 09:07:53 2013
@@ -36,8 +36,6 @@ import org.apache.hadoop.conf.Configurat
* <code>ExtensionPoint</code> and <code>Extension</code>. To provide
* access to the meta data of a plugin via a descriptor allow a lazy loading
* mechanism.
- *
- * @author joa23
*/
public class PluginDescriptor {
private String fPluginPath;
@@ -46,7 +44,7 @@ public class PluginDescriptor {
private String fVersion;
private String fName;
private String fProviderName;
- private HashMap fMessages = new HashMap();
+ private HashMap<String, ResourceBundle> fMessages = new HashMap<String, ResourceBundle>();
private ArrayList<ExtensionPoint> fExtensionPoints = new ArrayList<ExtensionPoint>();
private ArrayList<String> fDependencies = new ArrayList<String>();
private ArrayList<URL> fExportedLibs = new ArrayList<URL>();
@@ -327,8 +325,7 @@ public class PluginDescriptor {
public String getResourceString(String pKey, Locale pLocale)
throws IOException {
if (fMessages.containsKey(pLocale.toString())) {
- ResourceBundle bundle = (ResourceBundle) fMessages
- .get(pLocale.toString());
+ ResourceBundle bundle = fMessages.get(pLocale.toString());
try {
return bundle.getString(pKey);
} catch (MissingResourceException e) {
Modified: nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginRepository.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginRepository.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginRepository.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/plugin/PluginRepository.java Wed May 22 09:07:53 2013
@@ -39,8 +39,6 @@ import org.apache.nutch.util.NutchConfig
* descriptor represents all meta information about a plugin. So a plugin
* instance will be created later when it is required, this allow lazy plugin
* loading.
- *
- * @author joa23
*/
public class PluginRepository {
private static final WeakHashMap<String, PluginRepository> CACHE = new WeakHashMap<String, PluginRepository>();
@@ -267,8 +265,8 @@ public class PluginRepository {
// Suggested by Stefan Groschupf <sg...@media-style.com>
synchronized (pDescriptor) {
PluginClassLoader loader = pDescriptor.getClassLoader();
- Class pluginClass = loader.loadClass(pDescriptor.getPluginClass());
- Constructor constructor = pluginClass.getConstructor(new Class[] {
+ Class<?> pluginClass = loader.loadClass(pDescriptor.getPluginClass());
+ Constructor<?> constructor = pluginClass.getConstructor(new Class<?>[] {
PluginDescriptor.class, Configuration.class });
Plugin plugin = (Plugin) constructor.newInstance(new Object[] {
pDescriptor, this.conf });
@@ -400,7 +398,7 @@ public class PluginRepository {
}
ClassLoader cl = d.getClassLoader();
// args[1] - class name
- Class clazz = null;
+ Class<?> clazz = null;
try {
clazz = Class.forName(args[1], true, cl);
} catch (Exception e) {
@@ -410,7 +408,7 @@ public class PluginRepository {
}
Method m = null;
try {
- m = clazz.getMethod("main", new Class[] { args.getClass() });
+ m = clazz.getMethod("main", new Class<?>[] { args.getClass() });
} catch (Exception e) {
System.err.println("Could not find the 'main(String[])' method in class "
+ args[1] + ": " + e.getMessage());
Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java Wed May 22 09:07:53 2013
@@ -93,7 +93,7 @@ public class Host extends PersistentBase
default: throw new AvroRuntimeException("Bad index");
}
}
-
+ @SuppressWarnings("unchecked")
public Map<Utf8, ByteBuffer> getMetadata() {
return (Map<Utf8, ByteBuffer>) get(0);
}
@@ -111,6 +111,7 @@ public class Host extends PersistentBase
getStateManager().setDirty(this, 0);
return metadata.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getOutlinks() {
return (Map<Utf8, Utf8>) get(1);
}
@@ -127,6 +128,7 @@ public class Host extends PersistentBase
getStateManager().setDirty(this, 1);
return outlinks.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getInlinks() {
return (Map<Utf8, Utf8>) get(2);
}
@@ -144,9 +146,6 @@ public class Host extends PersistentBase
return inlinks.remove(key);
}
-
-
-
public boolean contains(String key) {
return metadata.containsKey(new Utf8(key));
}
Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/ParseStatus.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/ParseStatus.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/storage/ParseStatus.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/storage/ParseStatus.java Wed May 22 09:07:53 2013
@@ -102,6 +102,7 @@ public class ParseStatus extends Persist
public void setMinorCode(int value) {
put(1, value);
}
+ @SuppressWarnings("unchecked")
public GenericArray<Utf8> getArgs() {
return (GenericArray<Utf8>) get(2);
}
Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/ProtocolStatus.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/ProtocolStatus.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/storage/ProtocolStatus.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/storage/ProtocolStatus.java Wed May 22 09:07:53 2013
@@ -97,6 +97,7 @@ public class ProtocolStatus extends Pers
public void setCode(int value) {
put(0, value);
}
+ @SuppressWarnings("unchecked")
public GenericArray<Utf8> getArgs() {
return (GenericArray<Utf8>) get(1);
}
Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/WebPage.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/WebPage.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/storage/WebPage.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/storage/WebPage.java Wed May 22 09:07:53 2013
@@ -286,6 +286,7 @@ public class WebPage extends PersistentB
public void setReprUrl(Utf8 value) {
put(17, value);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getHeaders() {
return (Map<Utf8, Utf8>) get(18);
}
@@ -302,6 +303,7 @@ public class WebPage extends PersistentB
getStateManager().setDirty(this, 18);
return headers.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getOutlinks() {
return (Map<Utf8, Utf8>) get(19);
}
@@ -318,6 +320,7 @@ public class WebPage extends PersistentB
getStateManager().setDirty(this, 19);
return outlinks.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getInlinks() {
return (Map<Utf8, Utf8>) get(20);
}
@@ -334,6 +337,7 @@ public class WebPage extends PersistentB
getStateManager().setDirty(this, 20);
return inlinks.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, Utf8> getMarkers() {
return (Map<Utf8, Utf8>) get(21);
}
@@ -350,6 +354,7 @@ public class WebPage extends PersistentB
getStateManager().setDirty(this, 21);
return markers.remove(key);
}
+ @SuppressWarnings("unchecked")
public Map<Utf8, ByteBuffer> getMetadata() {
return (Map<Utf8, ByteBuffer>) get(22);
}
Modified: nutch/branches/2.x/src/java/org/apache/nutch/tools/ResolveUrls.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/tools/ResolveUrls.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/tools/ResolveUrls.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/tools/ResolveUrls.java Wed May 22 09:07:53 2013
@@ -74,10 +74,9 @@ public class ResolveUrls {
String host = URLUtil.getHost(url);
long start = System.currentTimeMillis();
try {
-
// get the address by name and if no error is thrown then it
// is resolved successfully
- InetAddress ia = InetAddress.getByName(host);
+ InetAddress.getByName(host);
LOG.info("Resolved: " + host);
numResolved.incrementAndGet();
}
@@ -161,12 +160,20 @@ public class ResolveUrls {
public static void main(String[] args) {
Options options = new Options();
- Option helpOpts = OptionBuilder.withArgName("help").withDescription(
- "show this help message").create("help");
- Option urlOpts = OptionBuilder.withArgName("urls").hasArg().withDescription(
- "the urls file to check").create("urls");
- Option numThreadOpts = OptionBuilder.withArgName("numThreads").hasArgs().withDescription(
- "the number of threads to use").create("numThreads");
+ OptionBuilder.withArgName("help");
+ OptionBuilder.withDescription("show this help message");
+ Option helpOpts = OptionBuilder.create("help");
+
+ OptionBuilder.withArgName("urls");
+ OptionBuilder.hasArg();
+ OptionBuilder.withDescription("the urls file to check");
+ Option urlOpts = OptionBuilder.create("urls");
+
+ OptionBuilder.withArgName("numThreads");
+ OptionBuilder.hasArgs();
+ OptionBuilder.withDescription("the number of threads to use");
+ Option numThreadOpts = OptionBuilder.create("numThreads");
+
options.addOption(helpOpts);
options.addOption(urlOpts);
options.addOption(numThreadOpts);
Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/GenericWritableConfigurable.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/GenericWritableConfigurable.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/util/GenericWritableConfigurable.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/util/GenericWritableConfigurable.java Wed May 22 09:07:53 2013
@@ -41,7 +41,7 @@ public abstract class GenericWritableCon
@Override
public void readFields(DataInput in) throws IOException {
byte type = in.readByte();
- Class clazz = getTypes()[type];
+ Class<?> clazz = getTypes()[type];
try {
set((Writable) clazz.newInstance());
} catch (Exception e) {
Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/PrefixStringMatcher.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/PrefixStringMatcher.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/util/PrefixStringMatcher.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/util/PrefixStringMatcher.java Wed May 22 09:07:53 2013
@@ -45,11 +45,11 @@ public class PrefixStringMatcher extends
* @throws ClassCastException if any <code>Object</code>s in the
* collection are not <code>String</code>s
*/
- public PrefixStringMatcher(Collection prefixes) {
+ public PrefixStringMatcher(Collection<String> prefixes) {
super();
- Iterator iter= prefixes.iterator();
+ Iterator<String> iter= prefixes.iterator();
while (iter.hasNext())
- addPatternForward((String)iter.next());
+ addPatternForward(iter.next());
}
/**
Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/SuffixStringMatcher.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/SuffixStringMatcher.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/util/SuffixStringMatcher.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/util/SuffixStringMatcher.java Wed May 22 09:07:53 2013
@@ -41,11 +41,11 @@ public class SuffixStringMatcher extends
* <code>String</code>s with any suffix in the supplied
* <code>Collection</code>
*/
- public SuffixStringMatcher(Collection suffixes) {
+ public SuffixStringMatcher(Collection<String> suffixes) {
super();
- Iterator iter= suffixes.iterator();
+ Iterator<String> iter = suffixes.iterator();
while (iter.hasNext())
- addPatternBackward((String)iter.next());
+ addPatternBackward(iter.next());
}
/**
Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/ToolUtil.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/ToolUtil.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/java/org/apache/nutch/util/ToolUtil.java (original)
+++ nutch/branches/2.x/src/java/org/apache/nutch/util/ToolUtil.java Wed May 22 09:07:53 2013
@@ -44,6 +44,7 @@ public class ToolUtil {
return res;
}
+ @SuppressWarnings("unchecked")
public static final void recordJobStatus(String label, Job job, Map<String,Object> results) {
Map<String,Object> jobs = (Map<String,Object>)results.get(Nutch.STAT_JOBS);
if (jobs == null) {
Modified: nutch/branches/2.x/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java (original)
+++ nutch/branches/2.x/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java Wed May 22 09:07:53 2013
@@ -52,8 +52,7 @@ import org.apache.nutch.net.*;
* </code><br/>
* where plus (<code>+</code>)means go ahead and index it and minus
* (<code>-</code>)means no.</p>
- *
- * @author Jérôme Charron
+
*/
public abstract class RegexURLFilterBase implements URLFilter {
@@ -230,5 +229,4 @@ public abstract class RegexURLFilterBase
}
}
}
-
}
Modified: nutch/branches/2.x/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java (original)
+++ nutch/branches/2.x/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java Wed May 22 09:07:53 2013
@@ -40,11 +40,8 @@ import org.apache.nutch.net.URLFilter;
/**
* JUnit based test of class <code>RegexURLFilterBase</code>.
- *
- * @author Jérôme Charron
*/
-
//@RunWith(Suite.class)
//@Suite.SuiteClasses({TestAutomatonURLFilter.class, TestRegexURLFilter.class})
public abstract class RegexURLFilterBaseTest {
@@ -112,7 +109,7 @@ public abstract class RegexURLFilterBase
private static FilteredURL[] readURLFile(Reader reader) throws IOException {
BufferedReader in = new BufferedReader(reader);
- List list = new ArrayList();
+ List<FilteredURL> list = new ArrayList<FilteredURL>();
String line;
while((line=in.readLine()) != null) {
if (line.length() != 0) {
Modified: nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java (original)
+++ nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMBuilder.java Wed May 22 09:07:53 2013
@@ -58,7 +58,7 @@ class DOMBuilder
public DocumentFragment m_docFrag = null;
/** Vector of element nodes */
- protected Stack m_elemStack = new Stack();
+ protected Stack<Element> m_elemStack = new Stack<Element>();
/**
* DOMBuilder instance constructor... it will add the DOM nodes
Modified: nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMContentUtils.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMContentUtils.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMContentUtils.java (original)
+++ nutch/branches/2.x/src/plugin/parse-tika/src/java/org/apache/nutch/parse/tika/DOMContentUtils.java Wed May 22 09:07:53 2013
@@ -55,8 +55,7 @@ public class DOMContentUtils {
}
}
- private HashMap linkParams = new HashMap();
- private Configuration conf;
+ private HashMap<String, LinkParams> linkParams = new HashMap<String, LinkParams>();
public DOMContentUtils(Configuration conf) {
setConf(conf);
@@ -66,7 +65,6 @@ public class DOMContentUtils {
// forceTags is used to override configurable tag ignoring, later on
Collection<String> forceTags = new ArrayList<String>(1);
- this.conf = conf;
linkParams.clear();
linkParams.put("a", new LinkParams("a", "href", 1));
linkParams.put("area", new LinkParams("area", "href", 0));
@@ -358,7 +356,7 @@ public class DOMContentUtils {
* nodes (this is a common DOM-fixup artifact, at least with
* nekohtml).
*/
- public void getOutlinks(URL base, ArrayList outlinks,
+ public void getOutlinks(URL base, ArrayList<Outlink> outlinks,
Node node) {
NodeWalker walker = new NodeWalker(node);
Modified: nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Client.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Client.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Client.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Client.java Wed May 22 09:07:53 2013
@@ -77,9 +77,9 @@ public class Client extends FTP
private int __dataTimeout;
private int __passivePort;
private String __passiveHost;
- private int __fileType, __fileFormat;
+// private int __fileType, __fileFormat;
private boolean __remoteVerificationEnabled;
- private FTPFileEntryParser __entryParser;
+// private FTPFileEntryParser __entryParser;
private String __systemName;
// constructor
@@ -95,11 +95,11 @@ public class Client extends FTP
{
__passiveHost = null;
__passivePort = -1;
- __fileType = FTP.ASCII_FILE_TYPE;
- __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
__systemName = null;
+/* __fileType = FTP.ASCII_FILE_TYPE;
+ __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
__entryParser = null;
- }
+*/ }
// parse reply for pass()
private void __parsePassiveModeReply(String reply)
@@ -315,7 +315,7 @@ public class Client extends FTP
}
// retrieve list reply for path
- public void retrieveList(String path, List entries, int limit,
+ public void retrieveList(String path, List<FTPFile> entries, int limit,
FTPFileEntryParser parser)
throws IOException,
FtpExceptionCanNotHaveDataConnection,
@@ -331,7 +331,7 @@ public class Client extends FTP
new BufferedReader(new InputStreamReader(socket.getInputStream()));
// force-close data channel socket, when download limit is reached
- boolean mandatory_close = false;
+// boolean mandatory_close = false;
//List entries = new LinkedList();
int count = 0;
@@ -348,7 +348,7 @@ public class Client extends FTP
// impose download limit if limit >= 0, otherwise no limit
// here, cut off is up to the line when total bytes is just over limit
if (limit >= 0 && count > limit) {
- mandatory_close = true;
+// mandatory_close = true;
break;
}
line = parser.readNextEntry(reader);
@@ -403,7 +403,7 @@ public class Client extends FTP
// fixme, should we instruct server here for binary file type?
// force-close data channel socket
- boolean mandatory_close = false;
+// boolean mandatory_close = false;
int len; int count = 0;
byte[] buf =
@@ -414,7 +414,7 @@ public class Client extends FTP
// here, cut off is exactly of limit bytes
if (limit >= 0 && count > limit) {
os.write(buf,0,len-(count-limit));
- mandatory_close = true;
+ // mandatory_close = true;
break;
}
os.write(buf,0,len);
@@ -502,8 +502,8 @@ public class Client extends FTP
{
if (FTPReply.isPositiveCompletion(type(fileType)))
{
- __fileType = fileType;
- __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
+/* __fileType = fileType;
+ __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;*/
return true;
}
return false;
Modified: nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java Wed May 22 09:07:53 2013
@@ -141,7 +141,7 @@ public class FtpResponse {
// follow ftp talk?
if (ftp.followTalk)
ftp.client.addProtocolCommandListener(
- new PrintCommandListener(ftp.LOG));
+ new PrintCommandListener(Ftp.LOG));
}
// quit from previous site if at a different site now
@@ -279,8 +279,8 @@ public class FtpResponse {
}
} catch (Exception e) {
- if (ftp.LOG.isWarnEnabled()) {
- ftp.LOG.warn(""+e);
+ if (Ftp.LOG.isWarnEnabled()) {
+ Ftp.LOG.warn(""+e);
}
// for any un-foreseen exception (run time exception or not),
// do ultimate clean and leave ftp.client for garbage collection
@@ -307,11 +307,11 @@ public class FtpResponse {
throws IOException {
ByteArrayOutputStream os = null;
- List list = null;
+ List<FTPFile> list = null;
try {
// first get its possible attributes
- list = new LinkedList();
+ list = new LinkedList<FTPFile>();
ftp.client.retrieveList(path, list, ftp.maxContentLength, ftp.parser);
FTPFile ftpFile = (FTPFile) list.get(0);
@@ -324,7 +324,7 @@ public class FtpResponse {
code = 304;
return;
}
- os = new ByteArrayOutputStream(ftp.BUFFER_SIZE);
+ os = new ByteArrayOutputStream(Ftp.BUFFER_SIZE);
ftp.client.retrieveFile(path, os, ftp.maxContentLength);
this.content = os.toByteArray();
@@ -409,7 +409,7 @@ public class FtpResponse {
// get ftp dir list as http response
private void getDirAsHttpResponse(String path, long lastModified)
throws IOException {
- List list = new LinkedList();
+ List<FTPFile> list = new LinkedList<FTPFile>();
try {
@@ -477,7 +477,7 @@ public class FtpResponse {
}
// generate html page from ftp dir list
- private byte[] list2html(List list, String path, boolean includeDotDot) {
+ private byte[] list2html(List<FTPFile> list, String path, boolean includeDotDot) {
//StringBuffer x = new StringBuffer("<!doctype html public \"-//ietf//dtd html//en\"><html><head>");
StringBuffer x = new StringBuffer("<html><head>");
Modified: nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/DummyX509TrustManager.java Wed May 22 09:07:53 2013
@@ -36,9 +36,6 @@ public class DummyX509TrustManager imple
{
private X509TrustManager standardTrustManager = null;
- /** Logger object for this class. */
- private static final Logger LOG = LoggerFactory.getLogger(DummyX509TrustManager.class);
-
/**
* Constructor for DummyX509TrustManager.
*/
Modified: nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationException.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationException.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationException.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationException.java Wed May 22 09:07:53 2013
@@ -21,11 +21,11 @@ package org.apache.nutch.protocol.httpcl
* In the future it may be used as a method of collecting authentication
* failures during Http protocol transfer in order to present the user with
* credentials required during a future fetch.
- *
- * @author Matt Tencati
*/
public class HttpAuthenticationException extends Exception {
+ private static final long serialVersionUID = 1L;
+
/**
* Constructs a new exception with null as its detail message.
*/
Modified: nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java Wed May 22 09:07:53 2013
@@ -57,7 +57,7 @@ public class HttpAuthenticationFactory i
public static final Logger LOG = LoggerFactory.getLogger(HttpAuthenticationFactory.class);
- private static Map auths = new TreeMap();
+ private static Map<?, ?> auths = new TreeMap<Object, Object>();
private Configuration conf = null;
@@ -89,6 +89,7 @@ public class HttpAuthenticationFactory i
* ---------------------------------- */
+ @SuppressWarnings("unchecked")
public HttpAuthentication findAuthentication(Metadata header) {
if (header == null) return null;
@@ -98,15 +99,15 @@ public class HttpAuthenticationFactory i
if (header instanceof Metadata) {
Object o = header.get(WWW_AUTHENTICATE);
if (o instanceof Collection) {
- challenge = (Collection) o;
+ challenge = (Collection<?>) o;
} else {
- challenge = new ArrayList();
+ challenge = new ArrayList<String>();
challenge.add(o.toString());
}
} else {
String challengeString = header.get(WWW_AUTHENTICATE);
if (challengeString != null) {
- challenge = new ArrayList();
+ challenge = new ArrayList<Object>();
challenge.add(challengeString);
}
}
@@ -117,7 +118,7 @@ public class HttpAuthenticationFactory i
return null;
}
- Iterator i = challenge.iterator();
+ Iterator<?> i = challenge.iterator();
HttpAuthentication auth = null;
while (i.hasNext() && auth == null) {
String challengeString = (String)i.next();
Modified: nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java Wed May 22 09:07:53 2013
@@ -41,8 +41,6 @@ import org.apache.hadoop.conf.Configurab
* in standard Nutch configuration files using the following properties:
* http.auth.basic.<realm>.user
* http.auth.basic.<realm>.pass
- *
- * @author Matt Tencati
*/
public class HttpBasicAuthentication implements HttpAuthentication, Configurable {
@@ -50,11 +48,11 @@ public class HttpBasicAuthentication imp
private static Pattern basic = Pattern.compile("[bB][aA][sS][iI][cC] [rR][eE][aA][lL][mM]=\"(\\w*)\"");
- private static Map authMap = new TreeMap();
+ private static Map<String, HttpBasicAuthentication> authMap = new TreeMap<String, HttpBasicAuthentication>();
private Configuration conf = null;
private String challenge = null;
- private ArrayList credentials = null;
+ private ArrayList<String> credentials = null;
private String realm = null;
@@ -70,7 +68,7 @@ public class HttpBasicAuthentication imp
setConf(conf);
this.challenge = challenge;
- credentials = new ArrayList();
+ credentials = new ArrayList<String>();
String username = this.conf.get("http.auth.basic." + challenge + ".user");
String password = this.conf.get("http.auth.basic." + challenge + ".password");
@@ -126,7 +124,7 @@ public class HttpBasicAuthentication imp
* @return Credentials in the form of <code>Authorization: Basic <Base64 encoded userid:password>
*
*/
- public List getCredentials() {
+ public List<String> getCredentials() {
return credentials;
}
Modified: nutch/branches/2.x/src/plugin/protocol-sftp/src/java/org/apache/nutch/protocol/sftp/Sftp.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/protocol-sftp/src/java/org/apache/nutch/protocol/sftp/Sftp.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/protocol-sftp/src/java/org/apache/nutch/protocol/sftp/Sftp.java (original)
+++ nutch/branches/2.x/src/plugin/protocol-sftp/src/java/org/apache/nutch/protocol/sftp/Sftp.java Wed May 22 09:07:53 2013
@@ -189,6 +189,7 @@ public class Sftp implements Protocol {
return po;
}
+ @SuppressWarnings("unchecked")
private ProtocolOutput getDirectoryProtocolOutput(URL url,
ChannelSftp channelSftp) throws SftpException {
try {
Modified: nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java (original)
+++ nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java Wed May 22 09:07:53 2013
@@ -49,7 +49,7 @@ public class CollectionManager extends C
static final Logger LOG = LoggerFactory.getLogger(CollectionManager.class);
- transient Map collectionMap = new HashMap();
+ transient Map<String, Subcollection> collectionMap = new HashMap<String, Subcollection>();
transient URL configfile;
@@ -175,10 +175,10 @@ public class CollectionManager extends C
*/
public List<String> getSubCollections(final String url) {
List<String> collections = new ArrayList<String>();
- final Iterator iterator = collectionMap.values().iterator();
+ final Iterator<Subcollection> iterator = collectionMap.values().iterator();
while (iterator.hasNext()) {
- final Subcollection subCol = (Subcollection) iterator.next();
+ final Subcollection subCol = iterator.next();
if (subCol.filter(url) != null) {
collections.add(subCol.name);
}
@@ -196,7 +196,7 @@ public class CollectionManager extends C
*
* @return All collections CollectionManager knows about
*/
- public Collection getAll() {
+ public Collection<Subcollection> getAll() {
return collectionMap.values();
}
@@ -212,10 +212,10 @@ public class CollectionManager extends C
final Document doc = new DocumentImpl();
final Element collections = doc
.createElement(Subcollection.TAG_COLLECTIONS);
- final Iterator iterator = collectionMap.values().iterator();
+ final Iterator<Subcollection> iterator = collectionMap.values().iterator();
while (iterator.hasNext()) {
- final Subcollection subCol = (Subcollection) iterator.next();
+ final Subcollection subCol = iterator.next();
final Element collection = doc
.createElement(Subcollection.TAG_COLLECTION);
collections.appendChild(collection);
Modified: nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java (original)
+++ nutch/branches/2.x/src/plugin/subcollection/src/java/org/apache/nutch/collection/Subcollection.java Wed May 22 09:07:53 2013
@@ -40,9 +40,9 @@ public class Subcollection extends Confi
public static final String TAG_NAME="name";
public static final String TAG_ID="id";
- ArrayList blackList = new ArrayList();
+ ArrayList<String> blackList = new ArrayList<String>();
- ArrayList whiteList = new ArrayList();
+ ArrayList<String> whiteList = new ArrayList<String>();
/**
* SubCollection identifier
@@ -98,7 +98,7 @@ public class Subcollection extends Confi
*
* @return Whitelist entries
*/
- public ArrayList getWhiteList() {
+ public ArrayList<String> getWhiteList() {
return whiteList;
}
@@ -124,7 +124,7 @@ public class Subcollection extends Confi
* @param whiteList
* The whiteList to set.
*/
- public void setWhiteList(ArrayList whiteList) {
+ public void setWhiteList(ArrayList<String> whiteList) {
this.whiteList = whiteList;
}
@@ -142,9 +142,9 @@ public class Subcollection extends Confi
*/
public String filter(String urlString) {
// first the blacklist
- Iterator i = blackList.iterator();
+ Iterator<String> i = blackList.iterator();
while (i.hasNext()) {
- String row = (String) i.next();
+ String row = i.next();
if (urlString.indexOf(row) != -1)
return null;
}
@@ -152,7 +152,7 @@ public class Subcollection extends Confi
// then whitelist
i = whiteList.iterator();
while (i.hasNext()) {
- String row = (String) i.next();
+ String row = i.next();
if (urlString.indexOf(row) != -1)
return urlString;
}
@@ -189,7 +189,7 @@ public class Subcollection extends Confi
* @param list
* @param text
*/
- protected void parseList(ArrayList list, String text) {
+ protected void parseList(ArrayList<String> list, String text) {
list.clear();
StringTokenizer st = new StringTokenizer(text, "\n\r");
Modified: nutch/branches/2.x/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java (original)
+++ nutch/branches/2.x/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java Wed May 22 09:07:53 2013
@@ -32,7 +32,6 @@ import org.apache.nutch.plugin.Extension
import org.apache.nutch.plugin.PluginRepository;
import java.io.Reader;
-import java.io.FileReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
@@ -79,7 +78,7 @@ public class PrefixURLFilter implements
throws IOException {
BufferedReader in=new BufferedReader(reader);
- List urlprefixes = new ArrayList();
+ List<String> urlprefixes = new ArrayList<String>();
String line;
while((line=in.readLine())!=null) {
Modified: nutch/branches/2.x/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java (original)
+++ nutch/branches/2.x/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java Wed May 22 09:07:53 2013
@@ -181,7 +181,7 @@ public class SuffixURLFilter implements
return;
}
BufferedReader in = new BufferedReader(reader);
- List aSuffixes = new ArrayList();
+ List<String> aSuffixes = new ArrayList<String>();
boolean allow = false;
boolean ignore = false;
String line;
Modified: nutch/branches/2.x/src/plugin/urlnormalizer-regex/src/test/org/apache/nutch/net/urlnormalizer/regex/TestRegexURLNormalizer.java
URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/plugin/urlnormalizer-regex/src/test/org/apache/nutch/net/urlnormalizer/regex/TestRegexURLNormalizer.java?rev=1485125&r1=1485124&r2=1485125&view=diff
==============================================================================
--- nutch/branches/2.x/src/plugin/urlnormalizer-regex/src/test/org/apache/nutch/net/urlnormalizer/regex/TestRegexURLNormalizer.java (original)
+++ nutch/branches/2.x/src/plugin/urlnormalizer-regex/src/test/org/apache/nutch/net/urlnormalizer/regex/TestRegexURLNormalizer.java Wed May 22 09:07:53 2013
@@ -44,7 +44,7 @@ public class TestRegexURLNormalizer {
private RegexURLNormalizer normalizer;
private Configuration conf;
- private HashMap testData = new HashMap();
+ private HashMap<String, NormalizedURL[]> testData = new HashMap<String, NormalizedURL[]>();
// This system property is defined in ./src/plugin/build-plugin.xml
private String sampleDir = System.getProperty("test.data", ".");
@@ -85,9 +85,9 @@ public class TestRegexURLNormalizer {
@Test
public void testNormalizerScope() throws Exception {
- Iterator it = testData.keySet().iterator();
+ Iterator<String> it = testData.keySet().iterator();
while (it.hasNext()) {
- String scope = (String)it.next();
+ String scope = it.next();
normalizeTest((NormalizedURL[])testData.get(scope), scope);
}
}
@@ -102,6 +102,7 @@ public class TestRegexURLNormalizer {
}
}
+ /** Currently this is not being used in this class
private void bench(int loops, String scope) {
long start = System.currentTimeMillis();
try {
@@ -116,6 +117,7 @@ public class TestRegexURLNormalizer {
LOG.info("bench time (" + loops + ") " +
(System.currentTimeMillis() - start) + "ms");
}
+ */
private static class NormalizedURL {
String url;
@@ -131,7 +133,7 @@ public class TestRegexURLNormalizer {
private NormalizedURL[] readTestFile(String scope) throws IOException {
File f = new File(sampleDir, "regex-normalize-" + scope + ".test");
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
- List list = new ArrayList();
+ List<NormalizedURL> list = new ArrayList<NormalizedURL>();
String line;
while((line = in.readLine()) != null) {
if ( line.trim().length() == 0 ||
@@ -139,6 +141,7 @@ public class TestRegexURLNormalizer {
line.startsWith(" ")) continue;
list.add(new NormalizedURL(line));
}
+ in.close();
return (NormalizedURL[]) list.toArray(new NormalizedURL[list.size()]);
}
}