diff --git a/Kitodo-Query-URL-Import/src/main/java/org/kitodo/queryurlimport/QueryURLImport.java b/Kitodo-Query-URL-Import/src/main/java/org/kitodo/queryurlimport/QueryURLImport.java index 7dec0a63fa9..f5ba68695df 100644 --- a/Kitodo-Query-URL-Import/src/main/java/org/kitodo/queryurlimport/QueryURLImport.java +++ b/Kitodo-Query-URL-Import/src/main/java/org/kitodo/queryurlimport/QueryURLImport.java @@ -285,7 +285,7 @@ private DataRecord performQueryToRecord(DataImport dataImport, String queryURL, } try (InputStream inputStream = httpEntity.getContent()) { String content = IOUtils.toString(inputStream, Charset.defaultCharset()); - if (Objects.nonNull(interfaceType.getNumberOfRecordsString()) + if (Objects.nonNull(interfaceType) && Objects.nonNull(interfaceType.getNumberOfRecordsString()) && XmlResponseHandler.extractNumberOfRecords(content, interfaceType) < 1) { throw new NoRecordFoundException("No record with ID \"" + identifier + "\" found!"); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java index a9f6d425b8e..6c5ce2ddc41 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java @@ -469,7 +469,8 @@ public void prepareProcess(int templateId, int projectId, String referringView, processDataTab.setAllDocTypes(docTypes); titleRecordLinkTab.setChosenParentProcess(String.valueOf(parentId)); titleRecordLinkTab.chooseParentProcess(); - if (Objects.nonNull(project.getDefaultChildProcessImportConfiguration())) { + if (Objects.nonNull(project) && Objects.nonNull(project + .getDefaultChildProcessImportConfiguration())) { setCurrentImportConfiguration(project.getDefaultChildProcessImportConfiguration()); } if (setChildCount(titleRecordLinkTab.getTitleRecordProcess(), rulesetManagement, workpiece)) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java index 4007c9b379f..f0ff9fdc3b9 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java @@ -219,7 +219,9 @@ private void createMetadataTable() { } } List tableData = metadataView.getSortedVisibleMetadata(entered, additionallySelectedFields); - treeNode.getChildren().clear(); + if (Objects.nonNull(treeNode) && Objects.nonNull(treeNode.getChildren())) { + treeNode.getChildren().clear(); + } hiddenMetadata = Collections.emptyList(); for (MetadataViewWithValuesInterface rowData : tableData) { Optional optionalMetadataView = rowData.getMetadata(); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java index 8cb717c7e76..6188bf93399 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java @@ -538,12 +538,14 @@ public void show() { private void restoreSelection(String rowKey, TreeNode parentNode) { for (TreeNode childNode : parentNode.getChildren()) { - if (Objects.nonNull(childNode) && rowKey.equals(childNode.getRowKey())) { - childNode.setSelected(true); - break; - } else { - childNode.setSelected(false); - restoreSelection(rowKey, childNode); + if (Objects.nonNull(childNode)) { + if (rowKey.equals(childNode.getRowKey())) { + childNode.setSelected(true); + break; + } else { + childNode.setSelected(false); + restoreSelection(rowKey, childNode); + } } } } diff --git a/Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java b/Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java index f91c9da0692..d26bc1392af 100644 --- a/Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java +++ b/Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/TaskActionProcessor.java @@ -200,8 +200,11 @@ private void markErrorCommentAsCorrected(Task currentTask, Integer correctionTas } private static boolean isEqualCorrectionTask(Integer correctionTaskId, Task correctionTask) { - return (Objects.isNull(correctionTaskId) && Objects.isNull(correctionTask)) || (Objects.nonNull( - correctionTaskId) && correctionTaskId.equals(correctionTask.getId())); + return (Objects.isNull(correctionTaskId) + && Objects.isNull(correctionTask)) + || (Objects.nonNull(correctionTaskId) + && Objects.nonNull(correctionTask) + && correctionTaskId.equals(correctionTask.getId())); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java index 6bab6583e4c..881dc596db6 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java @@ -384,8 +384,10 @@ private void processRecoveredMetadata(List recoveredMetadata) metadata.setMetadataType(metaDatum.getMetadataType()); metadata.setStartValue(metaDatum.getValue()); metadata.setStepSize(metaDatum.getStepSize()); - foundBlock.addMetadata(metadata); - last.put(Pair.of(foundBlock, metaDatum.getMetadataType()), metadata); + if (Objects.nonNull(foundBlock)) { + foundBlock.addMetadata(metadata); + last.put(Pair.of(foundBlock, metaDatum.getMetadataType()), metadata); + } } } diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java index be3d436bf72..5399b60a069 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java @@ -259,7 +259,8 @@ && new IssueComparator(block).compare(Pair.of(this.create.getLeft(), this.create && (Objects.isNull(delete) || new IssueComparator(block).compare(issue, delete) < 0) || Boolean.TRUE.equals(create) && Pair.of(this.create.getLeft(), this.create.getMiddle()).equals(issue) || Boolean.FALSE.equals(create) - && (Objects.isNull(issue) && Objects.isNull(this.delete) || issue.equals(this.delete))); + && (Objects.isNull(issue) && Objects.isNull(this.delete) + || (Objects.nonNull(issue) && issue.equals(this.delete)))); } } return false; @@ -342,7 +343,7 @@ public List getAllMetadataTypes(Integer processId) { Helper.setErrorMessage("Unable to load metadata types: " + e.getMessage()); } } - if (Objects.nonNull(metadataDetail)) { + if (Objects.nonNull(metadataDetail) && Objects.nonNull(allMetadataTypes)) { for (int i = 0; i < allMetadataTypes.size(); i++) { if (allMetadataTypes.get(i).getMetadataID().equals(metadataDetail.getMetadataID())) { allMetadataTypes.set(i, metadataDetail); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java index 2238a428a42..b023e939b6f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java @@ -632,7 +632,7 @@ protected Long countDocuments(QueryBuilder query) throws DataException { * @return query */ protected QueryBuilder createSetQuery(String key, Set values, boolean contains) { - if (contains && !values.isEmpty()) { + if (contains && Objects.nonNull(values) && !values.isEmpty()) { return termsQuery(key, values); } else if (!contains && Objects.nonNull(values)) { BoolQueryBuilder boolQuery = new BoolQueryBuilder();