Ensure checker query can be executed in the query system

CheckerQuery#clean only checks for allowed operators. It's possible for
a query to consist only of allowed operators but still fail when
executed, for example if it's too long or the backend doesn't support
regex searches. Add a (non-static) validate method which actually runs
the query; this is the only way the index system allows us to really
validate the query. As with clean, this new validate method is only
called when updating the query via the API.

Previously, clean threw BadRequestException; now both clean and validate
throw ConfigInvalidException. From the perspective of CheckerQuery, we
don't know whether the query argument came from an existing checker in
underlying storage, or user input. Of the two exception types,
ConfigInvalidException is more applicable to both situations.

Change-Id: I40c7bfc857c37ffe7fa9fd6411a23b322e4f7de9
9 files changed
tree: 7fba67aaf9b886da2fa767da351e187339a15f2f
  1. gr-checks/
  2. java/
  3. javatests/
  4. src/
  5. BUILD
  6. LICENSE
  7. README.md
README.md

Gerrit Code Review Checks Plugin

This plugin provides a unified experience for checkers (CI systems, static analyzers, etc.) to integrate with Gerrit Code Review.