This patch eliminates PlanningException, IllegalQueryStateException, InvalidQueryException and their usages.