Source:
<code>private void processAdditionalField(AdditionalField field) throws PreferencesException { DocStructInterface tempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct(); DocStructInterface tempChild = null; String fieldDocStruct = field.getDocstruct(); if (fieldDocStruct.equals("firstchild")) { try { tempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { Helper.setErrorMessage( e.getMessage() + " The first child below the top structure could not be determined!", logger, e); } } if (!fieldDocStruct.equals("firstchild") && fieldDocStruct.contains("firstchild")) { try { tempChild = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } } if (fieldDocStruct.equals("boundbook")) { tempStruct = this.rdf.getDigitalDocument().getPhysicalDocStruct(); } try { if (!field.getMetadata().equals("ListOfCreators")) { PrefsInterface prefs = serviceManager.getRulesetService().getPreferences(this.prozessKopie.getRuleset()); MetadataTypeInterface mdt = UghHelper.getMetadataType(prefs, field.getMetadata()); MetadataInterface metadata = UghHelper.getMetadata(tempStruct, mdt); if (metadata != null) { metadata.setStringValue(field.getValue()); } if (tempChild != null) { metadata = UghHelper.getMetadata(tempChild, mdt); <START> if (metadata != null) { <END> metadata.setStringValue(field.getValue()); } } } } catch (UghHelperException | RuntimeException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }</code><technical_language>a Objects.nonNull(metadata) other places changes</technical_language>

Target:
private void processAdditionalField(AdditionalField field) throws PreferencesException { DocStructInterface tempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct(); DocStructInterface tempChild = null; String fieldDocStruct = field.getDocstruct(); if (fieldDocStruct.equals("firstchild")) { try { tempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { Helper.setErrorMessage( e.getMessage() + " The first child below the top structure could not be determined!", logger, e); } } if (!fieldDocStruct.equals("firstchild") && fieldDocStruct.contains("firstchild")) { try { tempChild = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } } if (fieldDocStruct.equals("boundbook")) { tempStruct = this.rdf.getDigitalDocument().getPhysicalDocStruct(); } try { if (!field.getMetadata().equals("ListOfCreators")) { PrefsInterface prefs = serviceManager.getRulesetService().getPreferences(this.prozessKopie.getRuleset()); MetadataTypeInterface mdt = UghHelper.getMetadataType(prefs, field.getMetadata()); MetadataInterface metadata = UghHelper.getMetadata(tempStruct, mdt); if (Objects.nonNull(metadata)) { metadata.setStringValue(field.getValue()); } if (Objects.nonNull(tempChild)) { metadata = UghHelper.getMetadata(tempChild, mdt); if (Objects.nonNull(metadata)) { metadata.setStringValue(field.getValue()); } } } } catch (UghHelperException | RuntimeException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }