Skip to content

Commit 9d5de81

Browse files
committed
Make a shallow copy of the client dictionary
1 parent f6fb67f commit 9d5de81

File tree

1 file changed

+4
-4
lines changed
  • logicaldoc-core/src/main/java/com/logicaldoc/core/automation

1 file changed

+4
-4
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/automation/Automation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ private void evaluate(String expression, Map<String, Object> clientDictionary, W
301301
forbidRuntimeUsage(expression);
302302

303303
try {
304-
// Better to use a mutable shallow copy because we may receive an
305-
// unmodifiable client dictionary
306-
Map<String, Object> shallowCopy = new HashMap<>(clientDictionary);
307-
VelocityContext context = prepareContext(prepareDictionary(shallowCopy));
304+
// Better to use a mutable shallow copy of the client dictionaty
305+
// because we may receive an unmodifiable client dictionary
306+
VelocityContext context = prepareContext(
307+
prepareDictionary(clientDictionary != null ? new HashMap<>(clientDictionary) : null));
308308
Velocity.evaluate(context, writer, StringUtils.isNotEmpty(logTag) ? logTag : "ScriptEngine", expression);
309309
} catch (Exception e) {
310310
throw new AutomationException(expression, e);

0 commit comments

Comments
 (0)