[GEOT-4408] NPE in Query.toString method