Modified: lucene/nutch/trunk/src/java/org/apache/nutch/tools/DmozParser.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/tools/DmozParser.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/tools/DmozParser.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/tools/DmozParser.java Wed Aug  
8 07:23:25 2007
@@ -209,16 +209,14 @@
      * When parsing begins
      */
     public void startDocument() {
-      if (LOG.isInfoEnabled()) { LOG.info("Begin parse"); }
+      LOG.info("Begin parse");
     }
 
     /**
      * When parsing ends
      */
     public void endDocument() {
-      if (LOG.isInfoEnabled()) {
-        LOG.info("Completed parse.  Found " + pages + " pages.");
-      }
+      LOG.info("Completed parse.  Found " + pages + " pages.");
     }
 
     /**
@@ -289,7 +287,7 @@
                        skew, topicPattern);
     reader.setContentHandler(rp);
     reader.setErrorHandler(rp);
-    if (LOG.isInfoEnabled()) { LOG.info("skew = " + rp.hashSkew); }
+    LOG.info("skew = " + rp.hashSkew);
 
     //
     // Open filtered text stream.  The TextFilter makes sure that
@@ -311,8 +309,9 @@
     }
   }
 
-  private static void addTopicsFromFile(String topicFile, Vector topics)
-    throws IOException {
+  private static void addTopicsFromFile(String topicFile,
+                                        Vector<String> topics)
+  throws IOException {
     BufferedReader in = null;
     try {
       in = new BufferedReader(new InputStreamReader(new 
FileInputStream(topicFile), "UTF-8"));
@@ -352,7 +351,7 @@
     String dmozFile = argv[0];
     boolean includeAdult = false;
     Pattern topicPattern = null; 
-    Vector topics = new Vector(); 
+    Vector<String> topics = new Vector<String>();
     
     Configuration conf = NutchConfiguration.create();
     FileSystem fs = FileSystem.get(conf);
@@ -381,14 +380,12 @@
         String regExp = new String("^("); 
         int j = 0;
         for ( ; j < topics.size() - 1; ++j) {
-          regExp = regExp.concat((String) topics.get(j));
+          regExp = regExp.concat(topics.get(j));
           regExp = regExp.concat("|");
         }
-        regExp = regExp.concat((String) topics.get(j));
+        regExp = regExp.concat(topics.get(j));
         regExp = regExp.concat(").*"); 
-        if (LOG.isInfoEnabled()) {
-          LOG.info("Topic selection pattern = " + regExp);
-        }
+        LOG.info("Topic selection pattern = " + regExp);
         topicPattern = Pattern.compile(regExp); 
       }
 

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/tools/PruneIndexTool.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/tools/PruneIndexTool.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/tools/PruneIndexTool.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/tools/PruneIndexTool.java Wed 
Aug  8 07:23:25 2007
@@ -269,7 +269,7 @@
       numIdx = 1;
     } else {
       Directory dir;
-      Vector indexes = new Vector(indexDirs.length);
+      Vector<IndexReader> indexes = new Vector<IndexReader>(indexDirs.length);
       for (int i = 0; i < indexDirs.length; i++) {
         try {
           dir = FSDirectory.getDirectory(indexDirs[i], false);
@@ -297,7 +297,7 @@
         }
       }
       if (indexes.size() == 0) throw new Exception("No input indexes.");
-      IndexReader[] readers = (IndexReader[])indexes.toArray(new 
IndexReader[0]);
+      IndexReader[] readers = indexes.toArray(new IndexReader[0]);
       reader = new MultiReader(readers);
     }
     if (LOG.isInfoEnabled()) {
@@ -414,7 +414,7 @@
       if (LOG.isFatalEnabled()) { LOG.fatal("Not a directory: " + idx); }
       return;
     }
-    Vector paths = new Vector();
+    Vector<File> paths = new Vector<File>();
     if (IndexReader.indexExists(idx)) {
       paths.add(idx);
     } else {
@@ -443,7 +443,7 @@
         return;
       }
     }
-    File[] indexes = (File[])paths.toArray(new File[0]);
+    File[] indexes = paths.toArray(new File[0]);
     boolean force = false;
     boolean dryrun = false;
     String qPath = null;
@@ -468,12 +468,12 @@
         return;
       }
     }
-    Vector cv = new Vector();
+    Vector<PruneChecker> cv = new Vector<PruneChecker>();
     if (fList != null) {
       StringTokenizer st = new StringTokenizer(fList, ",");
-      Vector tokens = new Vector();
+      Vector<String> tokens = new Vector<String>();
       while (st.hasMoreTokens()) tokens.add(st.nextToken());
-      String[] fields = (String[])tokens.toArray(new String[0]);
+      String[] fields = tokens.toArray(new String[0]);
       PruneChecker pc = new PrintFieldsChecker(System.out, fields);
       cv.add(pc);
     }
@@ -485,7 +485,7 @@
 
     PruneChecker[] checkers = null;
     if (cv.size() > 0) {
-      checkers = (PruneChecker[])cv.toArray(new PruneChecker[0]);
+      checkers = cv.toArray(new PruneChecker[0]);
     }
     Query[] queries = null;
     InputStream is = null;
@@ -535,7 +535,7 @@
     BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
     String line = null;
     QueryParser qp = new QueryParser("url", new WhitespaceAnalyzer());
-    Vector queries = new Vector();
+    Vector<Query> queries = new Vector<Query>();
     while ((line = br.readLine()) != null) {
       line = line.trim();
       //skip blanks and comments
@@ -543,7 +543,7 @@
       Query q = qp.parse(line);
       queries.add(q);
     }
-    return (Query[])queries.toArray(new Query[0]);
+    return queries.toArray(new Query[0]);
   }
   
   private static void usage() {

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/util/FibonacciHeap.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/FibonacciHeap.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/FibonacciHeap.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/FibonacciHeap.java Wed 
Aug  8 07:23:25 2007
@@ -31,7 +31,7 @@
  */
 public class FibonacciHeap {
   private FibonacciHeapNode min;
-  private HashMap itemsToNodes;
+  private HashMap<Object, FibonacciHeapNode> itemsToNodes;
 
   // private node class
   private static class FibonacciHeapNode {
@@ -67,7 +67,7 @@
    */
   public FibonacciHeap() {
     this.min= null;
-    this.itemsToNodes= new HashMap();
+    this.itemsToNodes= new HashMap<Object, FibonacciHeapNode>();
   }
 
   /**
@@ -230,7 +230,7 @@
    */
   public void decreaseKey(Object item, int priority) {
     FibonacciHeapNode node= 
-      (FibonacciHeapNode) itemsToNodes.get(item);
+      itemsToNodes.get(item);
     if (node == null) 
       throw new IllegalStateException("No such element: " + item);
     if (node.priority < priority) 

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/util/NodeWalker.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/NodeWalker.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/NodeWalker.java (original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/NodeWalker.java Wed Aug  
8 07:23:25 2007
@@ -17,7 +17,6 @@
 public class NodeWalker {
 
   // the root node the the stack holding the nodes
-  private Node rootNode;
   private Node currentNode;
   private NodeList currentChildren;
   private Stack<Node> nodes;
@@ -28,7 +27,6 @@
    * @param rootNode
    */
   public NodeWalker(Node rootNode) {
-    this.rootNode = rootNode;
 
     nodes = new Stack<Node>();
     nodes.add(rootNode);

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/util/ThreadPool.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/ThreadPool.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/ThreadPool.java (original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/ThreadPool.java Wed Aug  
8 07:23:25 2007
@@ -58,7 +58,7 @@
 
     int numThreads;
     boolean running = false;
-    Vector jobs;
+    Vector<Runnable> jobs;
 
     /**
      * Creates a pool of numThreads size.
@@ -67,7 +67,7 @@
      */
     public ThreadPool(int numThreads) {
         this.numThreads = numThreads;
-        jobs = new Vector(37);
+        jobs = new Vector<Runnable>(37);
         running = true;
 
         for (int i = 0; i < numThreads; i++) {
@@ -99,7 +99,7 @@
                 }
 
                 if (jobs.size() > 0) {
-                    job = (Runnable) jobs.firstElement();
+                    job = jobs.firstElement();
                     jobs.removeElementAt(0);
                 }
             }

Modified: 
lucene/nutch/trunk/src/java/org/apache/nutch/util/TrieStringMatcher.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/TrieStringMatcher.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/TrieStringMatcher.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/TrieStringMatcher.java 
Wed Aug  8 07:23:25 2007
@@ -37,9 +37,9 @@
   /**
    * Node class for the character tree.
    */
-  protected class TrieNode implements Comparable {
+  protected class TrieNode implements Comparable<TrieNode> {
     protected TrieNode[] children;
-    protected LinkedList childrenList;
+    protected LinkedList<TrieNode> childrenList;
     protected char nodeChar;
     protected boolean terminal;
 
@@ -52,7 +52,7 @@
     TrieNode(char nodeChar, boolean isTerminal) {
       this.nodeChar= nodeChar;
       this.terminal= isTerminal;
-      this.childrenList= new LinkedList();
+      this.childrenList= new LinkedList<TrieNode>();
     }
 
     /**
@@ -71,7 +71,7 @@
      */
     TrieNode getChildAddIfNotPresent(char nextChar, boolean isTerminal) {
       if (childrenList == null) {
-        childrenList= new LinkedList();
+        childrenList= new LinkedList<TrieNode>();
         childrenList.addAll(Arrays.asList(children));
         children= null;
       }
@@ -82,10 +82,10 @@
         return newNode;
       }
 
-      ListIterator iter= childrenList.listIterator();
-      TrieNode node= (TrieNode) iter.next();
+      ListIterator<TrieNode> iter= childrenList.listIterator();
+      TrieNode node= iter.next();
       while ( (node.nodeChar < nextChar) && iter.hasNext() ) 
-        node= (TrieNode) iter.next();
+        node= iter.next();
                         
       if (node.nodeChar == nextChar) {
         node.terminal= node.terminal | isTerminal;
@@ -107,8 +107,7 @@
      */
     TrieNode getChild(char nextChar) {
       if (children == null) {
-        children= (TrieNode[]) 
-          childrenList.toArray(new TrieNode[childrenList.size()]);
+        children= childrenList.toArray(new TrieNode[childrenList.size()]);
         childrenList= null;
         Arrays.sort(children);
       }
@@ -133,8 +132,7 @@
       return null;
     }
 
-    public int compareTo(Object o) {
-      TrieNode other= (TrieNode) o;
+    public int compareTo(TrieNode other) {
       if (this.nodeChar < other.nodeChar) 
         return -1;
       if (this.nodeChar == other.nodeChar) 

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeType.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeType.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeType.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeType.java Wed 
Aug  8 07:23:25 2007
@@ -51,10 +51,10 @@
     private String description = null;
     
     /** The Mime-Type associated extensions */
-    private ArrayList extensions = null;
+    private ArrayList<String> extensions = null;
     
     /** The magic bytes associated to this Mime-Type */
-    private ArrayList magics = null;
+    private ArrayList<Magic> magics = null;
     
     /** The minimum length of data to provides for magic analyzis */
     private int minLength = 0;
@@ -109,8 +109,8 @@
         this.name = primary + SEPARATOR + clearedSub;
         this.primary = primary;
         this.sub = clearedSub;
-        this.extensions = new ArrayList();
-        this.magics = new ArrayList();
+        this.extensions = new ArrayList<String>();
+        this.magics = new ArrayList<Magic>();
     }
 
     /**
@@ -209,7 +209,7 @@
      * @return the extensions associated to this mime-type.
      */
     String[] getExtensions() {
-        return (String[]) extensions.toArray(new String[extensions.size()]);
+        return extensions.toArray(new String[extensions.size()]);
     }
     
     void addMagic(int offset, String type, String magic) {
@@ -247,7 +247,7 @@
         
         Magic tested = null;
         for (int i=0; i<magics.size(); i++) {
-            tested = (Magic) magics.get(i);
+            tested = magics.get(i);
             if (tested.matches(data)) {
                 return true;
             }

Modified: 
lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypeException.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypeException.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- 
lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypeException.java 
(original)
+++ 
lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypeException.java 
Wed Aug  8 07:23:25 2007
@@ -22,6 +22,7 @@
  * @author Hari Kodungallur
  * @author Jerome Charron - http://frutch.free.fr/
  */
[EMAIL PROTECTED]("serial")
 public class MimeTypeException extends Exception {
 
     /**

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypes.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypes.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypes.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypes.java Wed 
Aug  8 07:23:25 2007
@@ -42,16 +42,18 @@
     public final static String DEFAULT = "application/octet-stream";
 
     /** All the registered MimeTypes */
-    private ArrayList types = new ArrayList();
+    private ArrayList<MimeType> types = new ArrayList<MimeType>();
 
     /** All the registered MimeType indexed by name */
-    private HashMap typesIdx = new HashMap();
+    private HashMap<String, MimeType> typesIdx =
+      new HashMap<String, MimeType>();
 
     /** MimeTypes indexed on the file extension */
-    private Map extIdx = new HashMap();
+    private Map<String, List<MimeType>> extIdx =
+      new HashMap<String, List<MimeType>>();
 
     /** List of MimeTypes containing a magic char sequence */
-    private List magicsIdx = new ArrayList();
+    private List<MimeType> magicsIdx = new ArrayList<MimeType>();
 
     /** The minimum length of data to provide to check all MimeTypes */
     private int minLength = 0;
@@ -63,7 +65,7 @@
      * Key is the specified file path in the [EMAIL PROTECTED] #get(String)} 
method.
      * Value is the associated MimeType instance.
      */
-    private static Map instances = new HashMap();
+    private static Map<String, MimeTypes> instances = new HashMap<String, 
MimeTypes>();
     
     
     /** Should never be instanciated from outside */
@@ -81,7 +83,7 @@
     public static MimeTypes get(String filepath) {
         MimeTypes instance = null;
         synchronized(instances) {
-            instance = (MimeTypes) instances.get(filepath);
+            instance = instances.get(filepath);
             if (instance == null) {
                 instance = new MimeTypes(filepath, null);
                 instances.put(filepath, instance);
@@ -99,7 +101,7 @@
     public static MimeTypes get(String filepath, Log logger) {
         MimeTypes instance = null;
         synchronized(instances) {
-            instance = (MimeTypes) instances.get(filepath);
+            instance = instances.get(filepath);
             if (instance == null) {
                 instance = new MimeTypes(filepath, logger);
                 instances.put(filepath, instance);
@@ -164,7 +166,7 @@
         if ((data == null) || (data.length < 1)) {
             return null;
         }
-        Iterator iter = magicsIdx.iterator();
+        Iterator<MimeType> iter = magicsIdx.iterator();
         MimeType type = null;
         // TODO: This is a very naive first approach (scanning all the magic
         //       bytes since one is matching.
@@ -173,7 +175,7 @@
         // TODO: A second improvement could be to search for the most qualified
         //       (the longuest) magic sequence (not the first that is 
matching).
         while (iter.hasNext()) {
-            type = (MimeType) iter.next();
+            type = iter.next();
             if (type.matches(data)) {
                 return type;
             }
@@ -214,7 +216,7 @@
     * Return a MimeType from its name.
     */
    public MimeType forName(String name) {
-      return (MimeType) typesIdx.get(name);
+      return typesIdx.get(name);
    }
 
     /**
@@ -254,11 +256,11 @@
         String[] exts = type.getExtensions();
         if (exts != null) {
             for (int i=0; i<exts.length; i++) {
-                List list = (List) extIdx.get(exts[i]);
+                List<MimeType> list = extIdx.get(exts[i]);
                 if (list == null) {
                     // No type already registered for this extension...
                     // So, create a list of types
-                    list = new ArrayList();
+                    list = new ArrayList<MimeType>();
                     extIdx.put(exts[i], list);
                 }
                 list.add(type);
@@ -275,17 +277,17 @@
      * (many MimeTypes can have the same registered extensions).
      */
     private MimeType[] getMimeTypes(String name) {
-        List mimeTypes = null;
+        List<MimeType> mimeTypes = null;
         int index = name.lastIndexOf('.');
         if ((index != -1) && (index != name.length()-1)) {
             // There's an extension, so try to find
             // the corresponding mime-types
             String ext = name.substring(index + 1);
-            mimeTypes = (List) extIdx.get(ext);
+            mimeTypes = extIdx.get(ext);
         }
         
         return (mimeTypes != null)
-                    ? (MimeType[]) mimeTypes.toArray(new 
MimeType[mimeTypes.size()])
+                    ? mimeTypes.toArray(new MimeType[mimeTypes.size()])
                     : null;
     }
     

Modified: 
lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypesReader.java
URL: 
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypesReader.java?view=diff&rev=563894&r1=563893&r2=563894
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypesReader.java 
(original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/util/mime/MimeTypesReader.java 
Wed Aug  8 07:23:25 2007
@@ -89,7 +89,7 @@
     
     /** Read Element named mime-types. */
     private MimeType[] readMimeTypes(Element element) {
-        ArrayList types = new ArrayList();
+        ArrayList<MimeType> types = new ArrayList<MimeType>();
         NodeList nodes = element.getChildNodes();
         for (int i=0; i<nodes.getLength(); i++) {
             Node node = nodes.item(i);
@@ -101,7 +101,7 @@
                 }
             }
         }
-        return (MimeType[]) types.toArray(new MimeType[types.size()]);
+        return types.toArray(new MimeType[types.size()]);
     }
     
     /** Read Element named mime-type. */


Reply via email to