fix: move static JSON parsers to local variables (#26889)
This commit is contained in:
parent
f01a37982f
commit
d9321d1134
|
|
@ -12,7 +12,6 @@ import reactor.core.Exceptions;
|
|||
public class ArrayType implements AppsmithType {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private static final JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
|
|
@ -23,6 +22,8 @@ public class ArrayType implements AppsmithType {
|
|||
|
||||
@Override
|
||||
public String performSmartSubstitution(String s) {
|
||||
JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
|
||||
try {
|
||||
JSONArray jsonArray = (JSONArray) parser.parse(s);
|
||||
return objectMapper.writeValueAsString(jsonArray);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ public class JsonObjectType implements AppsmithType {
|
|||
|
||||
private static final TypeAdapter<JsonObject> strictGsonObjectAdapter = new Gson().getAdapter(JsonObject.class);
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private static final JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
|
|
@ -39,6 +38,7 @@ public class JsonObjectType implements AppsmithType {
|
|||
|
||||
@Override
|
||||
public String performSmartSubstitution(String s) {
|
||||
JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) parser.parse(s);
|
||||
String jsonString = objectMapper.writeValueAsString(jsonObject);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ public class DataTypeStringUtils {
|
|||
|
||||
private static ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private static JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
|
||||
private static final TypeAdapter<JsonObject> strictGsonObjectAdapter = new Gson().getAdapter(JsonObject.class);
|
||||
|
||||
@Deprecated(
|
||||
|
|
@ -222,6 +220,7 @@ public class DataTypeStringUtils {
|
|||
Map.Entry<String, String> parameter = new SimpleEntry<>(replacement, dataType.toString());
|
||||
insertedParams.add(parameter);
|
||||
|
||||
JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
|
||||
String updatedReplacement;
|
||||
switch (dataType) {
|
||||
case INTEGER:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user