From 62252ae8a6e0b9f1b4d4b250e3b58b7b5b931dd2 Mon Sep 17 00:00:00 2001 From: diego Dupin Date: Thu, 19 May 2022 11:34:00 +0200 Subject: [PATCH] [CONJ-972] possible java.lang.ClassCastException when executing prepared statement --- src/main/java/org/mariadb/jdbc/util/ClientParser.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/util/ClientParser.java b/src/main/java/org/mariadb/jdbc/util/ClientParser.java index d3ce875c8..55c947524 100644 --- a/src/main/java/org/mariadb/jdbc/util/ClientParser.java +++ b/src/main/java/org/mariadb/jdbc/util/ClientParser.java @@ -6,16 +6,13 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; public final class ClientParser implements PrepareResult { private final String sql; private final List queryParts; private final int paramCount; - private static final Map cache = new LinkedHashMap<>(512); private ClientParser(String sql, List queryParts) { this.sql = sql; @@ -35,7 +32,6 @@ private ClientParser(String sql, List queryParts) { * @return ClientPrepareResult */ public static ClientParser parameterParts(String queryString, boolean noBackslashEscapes) { - if (cache.containsKey(queryString)) return cache.get(queryString); List partList = new ArrayList<>(); LexState state = LexState.Normal; @@ -156,9 +152,7 @@ public static ClientParser parameterParts(String queryString, boolean noBackslas .getBytes(StandardCharsets.UTF_8)); } - ClientParser clientParser = new ClientParser(queryString, partList); - if (queryString.length() < 16384) cache.put(queryString, clientParser); - return clientParser; + return new ClientParser(queryString, partList); } public String getSql() {