You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/10/11 20:40:00 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3015: Print warning in log when user does not have permission to get config

ctubbsii commented on code in PR #3015:
URL: https://github.com/apache/accumulo/pull/3015#discussion_r992756318


##########
shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java:
##########
@@ -155,14 +155,23 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
     } else {
       // display properties
       final TreeMap<String,String> systemConfig = new TreeMap<>();
-      systemConfig
-          .putAll(shellState.getAccumuloClient().instanceOperations().getSystemConfiguration());
+      try {
+        systemConfig
+            .putAll(shellState.getAccumuloClient().instanceOperations().getSystemConfiguration());
+      } catch (AccumuloSecurityException e) {
+        Shell.log.warn("System Configuration: " + e.getMessage());
+      }
 
       final String outputFile = cl.getOptionValue(outputFileOpt.getOpt());
       final PrintFile printFile = outputFile == null ? null : new PrintFile(outputFile);
 
       final TreeMap<String,String> siteConfig = new TreeMap<>();
-      siteConfig.putAll(shellState.getAccumuloClient().instanceOperations().getSiteConfiguration());
+      try {
+        siteConfig
+            .putAll(shellState.getAccumuloClient().instanceOperations().getSiteConfiguration());
+      } catch (AccumuloSecurityException e) {
+        Shell.log.warn("Site Configuration: " + e.getMessage());

Review Comment:
   This is not a safe way to print with interpolation that logging provides. A better way is:
   
   ```suggestion
           Shell.log.warn("Site Configuration: {}", e.getMessage());
   ```



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

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