URLFilters: treat an exception from a filter as a rejection - #2120
Open
abhinav-phi wants to merge 1 commit into
Open
URLFilters: treat an exception from a filter as a rejection#2120abhinav-phi wants to merge 1 commit into
abhinav-phi wants to merge 1 commit into
Conversation
) The try/catch wrapped the whole chain: when a filter threw, the catch logged and fell through to the value the last successful filter had produced, so callers saw the URL as accepted and every filter after the one that threw was skipped - including the regex exclusions placed last in the archetype chain. The try/catch now sits inside the loop, logs which filter threw and returns null: a chain which throws must not widen what the crawl accepts. main() applies the same verdict, and a counter records how often it happens. FastURLFilter.Rule no longer accepts a rule line without a recognised type; it failed at evaluation time with an NPE and now fails at load time instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2084.
The try/catch wrapped the whole chain: when a filter threw, the catch logged the exception and fell through to the value the last successful filter had produced, so callers such as
StatusEmitterBolt.filterOutlinktreated the URL as accepted and every filter after the one that threw was skipped — including the regex exclusions the archetype places last.main()applies the same verdict so the command line tool agrees with the topologygetExceptionsCount()) records how often it happensFastURLFilter.Rulerejects a rule line without a recognised type at load time instead of building a rule with a null type that throws when evaluatedThis changes behaviour for topologies that currently have a throwing filter and did not notice: those URLs start being dropped instead of emitted.