MCPcopy Create free account
hub / github.com/apache/nutch / checkOne

Method checkOne

src/java/org/apache/nutch/net/URLFilterChecker.java:45–87  ·  view source on GitHub ↗
(String filterName)

Source from the content-addressed store, hash-verified

43 }
44
45 private void checkOne(String filterName) throws Exception {
46 URLFilter filter = null;
47
48 ExtensionPoint point = PluginRepository.get(conf).getExtensionPoint(
49 URLFilter.X_POINT_ID);
50
51 if (point == null)
52 throw new RuntimeException(URLFilter.X_POINT_ID + " not found.");
53
54 Extension[] extensions = point.getExtensions();
55
56 for (int i = 0; i < extensions.length; i++) {
57 Extension extension = extensions[i];
58 filter = (URLFilter) extension.getExtensionInstance();
59 if (filter.getClass().getName().equals(filterName)) {
60 break;
61 } else {
62 filter = null;
63 }
64 }
65
66 if (filter == null)
67 throw new RuntimeException("Filter " + filterName + " not found.");
68
69 // jerome : should we keep this behavior?
70 // if (LogFormatter.hasLoggedSevere())
71 // throw new RuntimeException("Severe error encountered.");
72
73 System.out.println("Checking URLFilter " + filterName);
74
75 BufferedReader in = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
76 String line;
77 while ((line = in.readLine()) != null) {
78 String out = filter.filter(line);
79 if (out != null) {
80 System.out.print("+");
81 System.out.println(out);
82 } else {
83 System.out.print("-");
84 System.out.println(line);
85 }
86 }
87 }
88
89 private void checkAll() throws Exception {
90 System.out.println("Checking combination of all URLFilters available");

Callers 1

mainMethod · 0.95

Calls 8

getMethod · 0.95
getExtensionsMethod · 0.95
getExtensionInstanceMethod · 0.95
filterMethod · 0.95
getExtensionPointMethod · 0.80
readLineMethod · 0.80
equalsMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected