Commit 93c1065b authored by Matija Obreza's avatar Matija Obreza

Fix: aclService#getSidId() may return null, causing an NPE in Optional.of

parent 48ecd31e
......@@ -124,7 +124,7 @@
<plugin>
<inherited>true</inherited>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.1</version>
<configuration>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
......
......@@ -52,7 +52,7 @@ public class SpringSecurityAuditorAware implements AuditorAware<Long> {
if (principal instanceof AclSid) {
return Optional.of(((AclSid) principal).getId());
} else if (principal instanceof String) {
return Optional.of(aclService.getSidId((String) principal));
return Optional.ofNullable(aclService.getSidId((String) principal));
} else {
LOG.warn("Principal {} is not AclSid, but type {}. Auth of type {}", principal, principal.getClass(), authentication.getClass());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment