You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/05/07 11:02:40 UTC

[GitHub] [ignite] nizhikov commented on a change in pull request #7772: IGNITE-12983 Logging exceptions inside IgniteSecurityProcessor#withContext(java.util.UUID)

nizhikov commented on a change in pull request #7772:
URL: https://github.com/apache/ignite/pull/7772#discussion_r421419886



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/security/IgniteSecurityProcessor.java
##########
@@ -125,17 +130,24 @@ public IgniteSecurityProcessor(GridKernalContext ctx, GridSecurityProcessor secP
 
     /** {@inheritDoc} */
     @Override public OperationSecurityContext withContext(UUID subjId) {
-        ClusterNode node = Optional.ofNullable(ctx.discovery().node(subjId))
-            .orElseGet(() -> ctx.discovery().historicalNode(subjId));
+        try {
+            ClusterNode node = Optional.ofNullable(ctx.discovery().node(subjId))
+                .orElseGet(() -> ctx.discovery().historicalNode(subjId));
+
+            SecurityContext res = node != null ? secCtxs.computeIfAbsent(subjId,
+                uuid -> nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node))
+                : secPrc.securityContext(subjId);
 
-        SecurityContext res = node != null ? secCtxs.computeIfAbsent(subjId,
-            uuid -> nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node))
-            : secPrc.securityContext(subjId);
+            if (res == null)
+                throw new IllegalStateException("Failed to find security context for subject with given ID : " + subjId);

Review comment:
       What's the point throw an Exception and catch it two lines later?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org