alopresto commented on a change in pull request #4154: NIFI-7271 Make command 
timeout configurable for ShellUserGroupProvider
URL: https://github.com/apache/nifi/pull/4154#discussion_r396789668
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java
 ##########
 @@ -339,6 +347,26 @@ private long 
getDelayProperty(AuthorizerConfigurationContext authContext, String
         return syncInterval;
     }
 
+    private int getTimeoutProperty(AuthorizerConfigurationContext authContext, 
String propertyName, String defaultValue) {
+        final PropertyValue timeoutProperty = 
authContext.getProperty(propertyName);
+
+        final String propertyValue;
+        if (timeoutProperty.isSet()) {
+            propertyValue = timeoutProperty.getValue();
+        } else {
+            propertyValue = defaultValue;
+        }
+
+        final long timeoutValue;
+        try {
+            timeoutValue = 
Math.round(FormatUtils.getPreciseTimeDuration(propertyValue, TimeUnit.SECONDS));
+        } catch (final IllegalArgumentException ignored) {
+            throw new AuthorizerCreationException(String.format("The %s '%s' 
is not a valid time interval.", propertyName, propertyValue));
 
 Review comment:
   Just thinking here -- should we throw an exception and stop the app from 
starting, or just warn loudly in the logs and fall back to the known good 
default value? If someone has manually configured this to be a different value, 
they probably had a good reason to do so, but then they should be expected to 
put it in a valid format...

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to