java/com.sap.sailing.aiagent/src/com/sap/sailing/aiagent/impl/AIAgentImpl.java
... ...
@@ -15,6 +15,7 @@ import java.util.logging.Logger;
15 15
16 16
import org.apache.http.client.ClientProtocolException;
17 17
import org.apache.shiro.SecurityUtils;
18
+import org.apache.shiro.UnavailableSecurityManagerException;
18 19
import org.apache.shiro.authz.AuthorizationException;
19 20
import org.json.simple.parser.ParseException;
20 21
import org.osgi.util.tracker.ServiceTracker;
... ...
@@ -312,7 +313,13 @@ public class AIAgentImpl implements AIAgent {
312 313
for (final Leaderboard leaderboard : event.getLeaderboards()) {
313 314
addNewRaceColumnListenerToLeaderboard(leaderboard);
314 315
}
315
- logger.info("User "+SecurityUtils.getSubject().getPrincipal()+" activated AI comments for event "+event.getName()+" with ID "+event.getId());
316
+ Object principal;
317
+ try {
318
+ principal = SecurityUtils.getSubject().getPrincipal();
319
+ } catch (UnavailableSecurityManagerException e) {
320
+ principal = "null";
321
+ }
322
+ logger.info("User "+principal+" activated AI comments for event "+event.getName()+" with ID "+event.getId());
316 323
listeners.forEach(l->l.startedCommentingOnEvent(event));
317 324
}
318 325