From e4b4a5cace20e7cb1dfcf05bcf8b5b77d9a2d1d1 Mon Sep 17 00:00:00 2001 From: Possommi Date: Thu, 28 Nov 2024 08:59:00 +0100 Subject: [PATCH] UBO-373 Fixed NullPointerException, store realm attribute of user in MCRJob (#438) --- .../java/org/mycore/ubo/importer/DozBibImportServlet.java | 3 ++- .../java/org/mycore/ubo/importer/ImportListJobAction.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java b/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java index 9c88e03b..219f1051 100644 --- a/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java +++ b/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java @@ -55,7 +55,8 @@ private void handleImportJob(HttpServletRequest req, HttpServletResponse res) th if ("true".equals(doAsync)) { MCRJob job = new MCRJob(ImportListJobAction.class); job.setParameter(ImportListJobAction.EDITOR_SUBMISSION_PARAMETER, new XMLOutputter().outputString(doc)); - job.setParameter(ImportListJobAction.USER_ID_PARAMETER, MCRUserManager.getCurrentUser().getUserName()); + job.setParameter(ImportListJobAction.USER_ID_PARAMETER, + MCRUserManager.getCurrentUser().getUserName() + "@" + MCRUserManager.getCurrentUser().getRealmID()); MCRJobQueueManager.getInstance().getJobQueue(ImportListJobAction.class).offer(job); String referer = req.getHeader("Referer"); diff --git a/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java b/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java index 316fbc6d..54e23c3c 100644 --- a/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java +++ b/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java @@ -79,6 +79,12 @@ public void execute() throws ExecutionException { private void sendMail(ImportJob importJob) { String userName = job.getParameter(ImportListJobAction.USER_ID_PARAMETER); MCRUser mcrUser = MCRUserManager.getUser(userName); + + if(mcrUser == null) { + LOGGER.error("User {} not found", userName); + return; + } + String eMailAddress = mcrUser.getEMailAddress(); if (eMailAddress == null) {