{"record":{"id":"bcd561eebc44c472","repo":"jhy/jsoup","slug":"null","errorCode":null,"errorMessage":"null","messagePattern":"null","errorType":"exception","errorClass":"Selector.SelectorParseException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/jsoup/select/QueryParser.java","lineNumber":59,"sourceCode":"        query = trimAsciiWhitespace(query);\n        this.query = query;\n        this.tq = new TokenQueue(query);\n    }\n\n    /**\n     Parse a CSS query into an Evaluator. If you are evaluating the same query repeatedly, it may be more efficient to\n     parse it once and reuse the Evaluator.\n\n     @param query CSS query\n     @return Evaluator\n     @see Selector selector query syntax\n     @throws Selector.SelectorParseException if the CSS query is invalid\n     */\n    public static Evaluator parse(String query) {\n        try (QueryParser p = new QueryParser(query)) {\n            return p.parse();\n        } catch (IllegalArgumentException e) {\n            throw new Selector.SelectorParseException(e.getMessage());\n        }\n    }\n\n    /**\n     Parse the query. We use this simplified expression of the grammar:\n     <pre>\n     SelectorGroup   ::= Selector (',' Selector)*\n     Selector        ::= [ Combinator ] SimpleSequence ( Combinator SimpleSequence )*\n     SimpleSequence  ::= [ TypeSelector ] ( ID | Class | Attribute | Pseudo )*\n     Pseudo           ::= ':' Name [ '(' SelectorGroup ')' ]\n     Combinator      ::= S+         // descendant (whitespace)\n     | '>'       // child\n     | '+'       // adjacent sibling\n     | '~'       // general sibling\n     </pre>\n\n     See <a href=\"https://www.w3.org/TR/selectors-4/#grammar\">selectors-4</a> for the real thing\n     */","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/jhy/jsoup/blob/9851ac5d9c576c6888910b5a51a2362bbc978959/src/main/java/org/jsoup/select/QueryParser.java#L41-L77","documentation":"A selector parse failure surfaced by QueryParser.parse: the message is literally the string \"null\" because the underlying exception carried no detail (null message). It wraps any low-level failure (empty input, illegal state) encountered while parsing a CSS query into jsoup's public Selector.SelectorParseException, so it signals an invalid/unparseable selector rather than a runtime condition of the document.","triggerScenarios":"Thrown at src/main/java/org/jsoup/select/QueryParser.java:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Catch Selector.SelectorParseException around Selector.parse / Elements.select and validate the query string before retrying.","Inspect the wrapped cause; the 'null' message means the original exception had no message, so the cause chain holds the detail.","Sanitize user-supplied selectors: reject empty strings and characters outside the selector grammar before parsing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9851ac5d9c576c6888910b5a51a2362bbc978959","analyzedAt":"2026-09-08T15:22:04.931Z","contentChangedAt":"2026-09-08T15:22:04.931Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}