How to validation jql clause in java class?

I want to validation jql clause in java class.

Some thing like: I have a string “project = 10000”

I want to check it valid or invalid /( correct or uncorrect) jql.

How can I do that?


I found script to validation JQL:

ApplicationUser user = jiraAuthenticationContext.getLoggedInUser();
    SearchService.ParseResult parseResult = searchService.parseQuery(user, jql == null ? "" : jql);
    if (!parseResult.isValid()) {
      return false;
    final MessageSet result = searchService.validateQuery(user, parseResult.getQuery());
    if (result.hasAnyErrors()) {
      return false;
    return true;
1 Like