Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/search/NamespaceFilter.java |
— | — | @@ -56,13 +56,26 @@ |
57 | 57 | init(); |
58 | 58 | included.set(namespace); |
59 | 59 | } |
60 | | - /** filter number of namespaces separated by comma, e.g. 0,2,10 */ |
| 60 | + /** |
| 61 | + * |
| 62 | + * filter number of namespaces separated by comma, e.g. 0,2,10 */ |
61 | 63 | public NamespaceFilter(String namespaces) { |
62 | 64 | init(); |
63 | 65 | if (namespaces != null && !namespaces.equals("")) { |
64 | 66 | String[] bits = namespaces.split(","); |
65 | 67 | for (int i = 0; i < bits.length; i++) { |
| 68 | + try{ |
66 | 69 | included.set(Integer.parseInt(bits[i].trim())); |
| 70 | + } |
| 71 | + catch (NumberFormatException e) |
| 72 | + { |
| 73 | + if(bits[i].trim().startsWith("NS")) |
| 74 | + { |
| 75 | + System.err.println("bad input found by NamespaceFilter "+ bits[i]); |
| 76 | + included.set(Integer.parseInt("0")); |
| 77 | + } |
| 78 | + |
| 79 | + } |
67 | 80 | } |
68 | 81 | } |
69 | 82 | } |