rzo1 commented on code in PR #2120:
URL: https://github.com/apache/stormcrawler/pull/2120#discussion_r3944167151
##########
core/src/main/java/org/apache/stormcrawler/filtering/URLFilters.java:
##########
@@ -189,25 +205,28 @@ public static void main(String[] args) throws
ParseException {
try {
URLFilters filters = new URLFilters(conf, configFile);
String normalizedUrl = inputUrl;
- try {
- for (URLFilter filter : filters.filters) {
- long start = System.currentTimeMillis();
+ for (URLFilter filter : filters.filters) {
+ long start = System.currentTimeMillis();
+ try {
normalizedUrl =
filter.filter(URLUtil.toURL(sourceUrl), new
Metadata(), normalizedUrl);
- long end = System.currentTimeMillis();
- System.out.println(
- "\t["
- + filter.getClass().getName()
- + "] "
- + (end - start)
- + "msec => "
- + normalizedUrl);
- if (normalizedUrl == null) {
- break;
- }
+ } catch (Exception e) {
+ LOG.error("URL filter {} threw exception",
filter.getClass().getName(), e);
+ System.err.println(
Review Comment:
This `System.err` line and the `System.out` timing line below both report
the rejection, so the CLI prints it twice. Dropping this block is enough; the
existing `=> null` output already says it.
##########
core/src/main/java/org/apache/stormcrawler/filtering/URLFilters.java:
##########
@@ -56,10 +57,20 @@ public class URLFilters extends URLFilter implements
JSONResource {
private URLFilter[] filters;
+ private final AtomicLong filteredOut = new AtomicLong();
Review Comment:
The field name does not match what it counts. Same rename needed at lines 71
and 136.
```suggestion
private final AtomicLong exceptionsCount = new AtomicLong();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]