diff --git a/core/src/main/java/lucee/runtime/functions/conversion/DeserializeJSON.java b/core/src/main/java/lucee/runtime/functions/conversion/DeserializeJSON.java index ca385aa840..72eece4283 100644 --- a/core/src/main/java/lucee/runtime/functions/conversion/DeserializeJSON.java +++ b/core/src/main/java/lucee/runtime/functions/conversion/DeserializeJSON.java @@ -20,6 +20,9 @@ import java.util.Iterator; +import lucee.commons.io.SystemUtil; +import lucee.commons.io.log.Log; +import lucee.commons.io.log.LogUtil; import lucee.commons.lang.StringUtil; import lucee.runtime.PageContext; import lucee.runtime.exp.FunctionException; @@ -45,6 +48,11 @@ public final class DeserializeJSON extends BIF implements Function { private static final long serialVersionUID = -4847186239512149277L; + private static final boolean allowEmpty; + static { + allowEmpty = Caster.toBooleanValue(SystemUtil.getSystemPropOrEnvVar("lucee.deserializejson.allowempty", null), false); + } + private static final Key ROWCOUNT = KeyConstants._ROWCOUNT; public static Object call(PageContext pc, String JSONVar) throws PageException { @@ -52,8 +60,14 @@ public static Object call(PageContext pc, String JSONVar) throws PageException { } public static Object call(PageContext pc, String JSONVar, boolean strictMapping) throws PageException { - if (StringUtil.isEmpty(JSONVar, true)) + if (StringUtil.isEmpty(JSONVar, true)) { + if (allowEmpty) { + LogUtil.log(Log.LEVEL_WARN, "datasource", "conversion", + "Deprecated functionality used at [" + LogUtil.caller(pc, "") + "]. An empty string was passed as a value to the function DeserializeJSON."); + return ""; + } throw new FunctionException(pc, "DeserializeJSON", 1, "JSONVar", "input value cannot be empty string.", "Must be the valid JSON string"); + } Object result = new JSONExpressionInterpreter().interpret(pc, JSONVar); if (!strictMapping) return toQuery(result); return result; diff --git a/loader/build.xml b/loader/build.xml index 0622880249..849cb2a4f1 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index 393f26a681..cfbc91db0b 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.1.0.241-RC + 6.1.0.242-SNAPSHOT jar Lucee Loader Build