Skip to content
Snippets Groups Projects
Commit baa904aa authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-4381 fix NPE wenn ServiceKontoType nicht gesetzt'...

Merge pull request 'OZG-4381 fix NPE wenn ServiceKontoType nicht gesetzt' (#257) from OZG-4381-fix-NPE into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/vorgang-manager/pulls/257


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents 84da80c7 47568d64
No related branches found
No related tags found
No related merge requests found
...@@ -90,12 +90,13 @@ public abstract class PostfachNachrichtMapper { ...@@ -90,12 +90,13 @@ public abstract class PostfachNachrichtMapper {
} }
GrpcPostfachAddress buildGrpcPostfachAddress(Map<String, Object> postfachAddressMap) { GrpcPostfachAddress buildGrpcPostfachAddress(Map<String, Object> postfachAddressMap) {
return GrpcPostfachAddress.newBuilder() var postfachAddressBuilder = GrpcPostfachAddress.newBuilder()
.setType(MapUtils.getIntValue(postfachAddressMap, PostfachAddress.TYPE_FIELD)) .setType(MapUtils.getIntValue(postfachAddressMap, PostfachAddress.TYPE_FIELD))
.setVersion(MapUtils.getString(postfachAddressMap, PostfachAddress.VERSION_FIELD)) .setVersion(MapUtils.getString(postfachAddressMap, PostfachAddress.VERSION_FIELD))
.setIdentifier(grpcObjectMapper.fromMap(postfachAddressMap)) .setIdentifier(grpcObjectMapper.fromMap(postfachAddressMap));
.setServiceKontoType(MapUtils.getString(postfachAddressMap, PostfachAddress.SERVICEKONTO_TYPE_FIELD)) Optional.ofNullable(MapUtils.getString(postfachAddressMap, PostfachAddress.SERVICEKONTO_TYPE_FIELD))
.build(); .ifPresent(postfachAddressBuilder::setServiceKontoType);
return postfachAddressBuilder.build();
} }
PostfachNachricht fromMapToPostfachMail(Map<String, Object> mailMap) { PostfachNachricht fromMapToPostfachMail(Map<String, Object> mailMap) {
......
...@@ -58,7 +58,9 @@ import de.ozgcloud.vorgang.callcontext.User; ...@@ -58,7 +58,9 @@ import de.ozgcloud.vorgang.callcontext.User;
import de.ozgcloud.vorgang.files.FileService; import de.ozgcloud.vorgang.files.FileService;
import de.ozgcloud.vorgang.files.OzgFile; import de.ozgcloud.vorgang.files.OzgFile;
import de.ozgcloud.vorgang.files.UploadedFilesReference; import de.ozgcloud.vorgang.files.UploadedFilesReference;
import jakarta.activation.MimetypesFileTypeMap; import jakarta.activation.MimetypesFileTypeMap;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
/** /**
...@@ -164,10 +166,14 @@ class PersistPostfachNachrichtByCommandService implements PersistPostfachNachric ...@@ -164,10 +166,14 @@ class PersistPostfachNachrichtByCommandService implements PersistPostfachNachric
} }
private Map<String, Object> buildPostfachAddressMap(PostfachAddress postfachAddress) { private Map<String, Object> buildPostfachAddressMap(PostfachAddress postfachAddress) {
return Map.of(PostfachAddress.IDENTIFIER_FIELD, buildPostfachAddressIdentifierMap(postfachAddress), var resultMap = new HashMap<String, Object>();
PostfachAddress.VERSION_FIELD, postfachAddress.getVersion(), resultMap.put(PostfachAddress.IDENTIFIER_FIELD, buildPostfachAddressIdentifierMap(postfachAddress));
PostfachAddress.TYPE_FIELD, postfachAddress.getType(), resultMap.put(PostfachAddress.VERSION_FIELD, postfachAddress.getVersion());
PostfachAddress.SERVICEKONTO_TYPE_FIELD, postfachAddress.getServiceKontoType()); resultMap.put(PostfachAddress.TYPE_FIELD, postfachAddress.getType());
Optional.ofNullable(postfachAddress.getServiceKontoType()).ifPresentOrElse(
serviceKontoType -> resultMap.put(PostfachAddress.SERVICEKONTO_TYPE_FIELD, serviceKontoType),
() -> LOG.warn("ServiceKontoType is null"));
return Collections.unmodifiableMap(resultMap);
} }
private Map<String, Object> buildPostfachAddressIdentifierMap(PostfachAddress postfachAddress) { private Map<String, Object> buildPostfachAddressIdentifierMap(PostfachAddress postfachAddress) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment