r111288 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111287‎ | r111288 | r111289 >
Date:10:27, 12 February 2012
Author:oren
Status:deferred
Tags:
Comment:
added Type in Generic Iterators
Modified paths:
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/importer/DumpImporter.java (modified) (history)
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/oai/IndexUpdatesCollector.java (modified) (history)
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/prefix/PrefixIndexBuilder.java (modified) (history)
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/ranks/LinkReader.java (modified) (history)
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/related/TitleReader.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/related/TitleReader.java
@@ -2,6 +2,7 @@
33
44 import java.io.IOException;
55 import java.util.Iterator;
 6+import java.util.Map;
67 import java.util.Map.Entry;
78
89 import org.mediawiki.importer.DumpWriter;
@@ -55,9 +56,9 @@
5657 }
5758 public void writeSiteinfo(Siteinfo info) throws IOException {
5859 // write siteinfo to localization
59 - Iterator it = info.Namespaces.orderedEntries();
 60+ Iterator<Map.Entry<Integer,String>> it = info.Namespaces.orderedEntries();
6061 while(it.hasNext()){
61 - Entry<Integer,String> pair = (Entry<Integer,String>)it.next();
 62+ Entry<Integer,String> pair = it.next();
6263 Localization.addCustomMapping(pair.getValue(),pair.getKey(),iid.getDBname());
6364 }
6465 }
Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/prefix/PrefixIndexBuilder.java
@@ -411,6 +411,7 @@
412412
413413 /** Set omitNorms on all fields of the document */
414414 protected void setOmitNorms(Document doc){
 415+ @SuppressWarnings("rawtypes") //Iterator<Field>
415416 Iterator it = doc.getFields().iterator();
416417 while(it.hasNext()){
417418 ((Field)it.next()).setOmitNorms(true);
Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/importer/DumpImporter.java
@@ -6,6 +6,7 @@
77 import java.util.Enumeration;
88 import java.util.Hashtable;
99 import java.util.Iterator;
 10+import java.util.Map;
1011 import java.util.Map.Entry;
1112 import org.apache.log4j.Logger;
1213 import org.mediawiki.importer.DumpWriter;
@@ -137,9 +138,9 @@
138139 // nop
139140 }
140141 public void writeSiteinfo(Siteinfo info) throws IOException {
141 - Iterator it = info.Namespaces.orderedEntries();
 142+ Iterator<Map.Entry<Integer,String>> it = info.Namespaces.orderedEntries();
142143 while(it.hasNext()){
143 - Entry<Integer,String> pair = (Entry<Integer,String>)it.next();
 144+ Entry<Integer,String> pair = it.next();
144145 Localization.addCustomMapping(pair.getValue(),pair.getKey(),iid.getDBname());
145146 }
146147 }
Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/oai/IndexUpdatesCollector.java
@@ -6,6 +6,7 @@
77 import java.util.HashMap;
88 import java.util.Hashtable;
99 import java.util.Iterator;
 10+import java.util.Map;
1011 import java.util.Map.Entry;
1112
1213 import org.apache.log4j.Logger;
@@ -94,9 +95,9 @@
9596 RMIMessengerClient messenger = new RMIMessengerClient(true);
9697 // write to localization
9798 HashMap<Integer,String> map = new HashMap<Integer,String>();
98 - Iterator it = info.Namespaces.orderedEntries();
 99+ Iterator<Map.Entry<Integer,String>> it = info.Namespaces.orderedEntries();
99100 while(it.hasNext()){
100 - Entry<Integer,String> pair = (Entry<Integer,String>)it.next();
 101+ Entry<Integer,String> pair = it.next();
101102 map.put(pair.getKey(),pair.getValue());
102103 }
103104 messenger.addLocalizationCustomMapping(iid.getIndexHost(),map,iid.getDBname());
Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/ranks/LinkReader.java
@@ -3,6 +3,7 @@
44 import java.io.IOException;
55 import java.util.HashSet;
66 import java.util.Iterator;
 7+import java.util.Map;
78 import java.util.Map.Entry;
89 import org.apache.log4j.Logger;
910 import org.mediawiki.importer.DumpWriter;
@@ -60,9 +61,9 @@
6162 public void writeSiteinfo(Siteinfo info) throws IOException {
6263 siteinfo = info;
6364 // write siteinfo to localization
64 - Iterator it = info.Namespaces.orderedEntries();
 65+ Iterator<Map.Entry<Integer,String>> it = info.Namespaces.orderedEntries();
6566 while(it.hasNext()){
66 - Entry<Integer,String> pair = (Entry<Integer,String>)it.next();
 67+ Entry<Integer,String> pair = it.next();
6768 Localization.addCustomMapping(pair.getValue(),pair.getKey(),iid.getDBname());
6869 links.addToNamespaceMap(pair.getValue(),pair.getKey());
6970 }

Status & tagging log