Here's a PR with what I suggest:
JdbcPatternParserTest shows how it parses the current pattern into
"text for the prepared statement" and "arguments for it" in JdbcPatternParserTest.
I believe it fixes the CVE, and it keeps the code compatible with previous usages.
Vladimir