This is an automated email from the ASF dual-hosted git repository. jsinovassinnaik pushed a commit to branch UNOMI-747-add-null-check in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 493358a88447f61cdee436e2d444d0b687f132da Author: jsinovassin <[email protected]> AuthorDate: Tue Mar 14 10:15:16 2023 +0100 UNOMI-747 : add null check in events migration script --- .../src/main/resources/requestBody/2.0.0/event_migrate.painless | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless b/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless index 800fa97b7..9fd7e968a 100644 --- a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless +++ b/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless @@ -20,8 +20,12 @@ if ('login' == ctx._source.eventType) { /* Look for empty scope */ if (ctx._source.scope == '') { ctx._source.put('scope', 'systemsite'); - ctx._source.source.put('scope', 'systemsite'); - ctx._source.target.put('scope', 'systemsite'); + if (ctx._source.source != null) { + ctx._source.source.put('scope', 'systemsite'); + } + if (ctx._source.target != null) { + ctx._source.target.put('scope', 'systemsite'); + } } } /* Handle view events */
