enapps-enorman commented on a change in pull request #24:
URL: 
https://github.com/apache/sling-org-apache-sling-feature-launcher/pull/24#discussion_r612718849



##########
File path: src/main/java/org/apache/sling/feature/launcher/impl/Main.java
##########
@@ -264,20 +270,23 @@ protected static void parseArgs(final LauncherConfig 
config, final String[] args
                 config.getConfigClashOverrides().put(name, 
cfgCProps.getProperty(name));
             }
 
-            Properties fwProps = 
cl.getOptionProperties(OPT_FRAMEWORK_PROPERTIES);
-            for (final String name : fwProps.stringPropertyNames()) {
-                config.getInstallation()
-                        .getFrameworkProperties()
-                        .put(name, fwProps.getProperty(name));
-            }
+            extractValuesFromOption(cl, 
OPT_FRAMEWORK_PROPERTIES).orElseGet(ArrayList::new)
+                    .forEach(value -> {
+                        final String[] keyVal = split(value);
+                        
config.getInstallation().getFrameworkProperties().put(keyVal[0], keyVal[1]);
+                    });
 
             Properties varProps = cl.getOptionProperties(OPT_VARIABLE_VALUES);
             for (final String name : varProps.stringPropertyNames()) {
                 config.getVariables().put(name, varProps.getProperty(name));
             }
 
-            extractValueFromOption(cl, OPT_VERBOSE, "debug").ifPresent(
-                    value -> 
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", value));
+            if (cl.hasOption(OPT_VERBOSE)) {
+                extractValueFromOption(cl, OPT_VERBOSE, 
"debug").ifPresent(value -> System
+                        .setProperty("org.slf4j.simpleLogger.defaultLogLevel", 
value));
+            } else {
+                System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", 
"info");

Review comment:
       I believe that "info" is already the default log level for the 
simplelogger when there is no "org.slf4j.simpleLogger.defaultLogLevel" system 
property, so this else block shouldn't be necessary.

##########
File path: src/main/java/org/apache/sling/feature/launcher/impl/Main.java
##########
@@ -264,20 +270,23 @@ protected static void parseArgs(final LauncherConfig 
config, final String[] args
                 config.getConfigClashOverrides().put(name, 
cfgCProps.getProperty(name));
             }
 
-            Properties fwProps = 
cl.getOptionProperties(OPT_FRAMEWORK_PROPERTIES);
-            for (final String name : fwProps.stringPropertyNames()) {
-                config.getInstallation()
-                        .getFrameworkProperties()
-                        .put(name, fwProps.getProperty(name));
-            }
+            extractValuesFromOption(cl, 
OPT_FRAMEWORK_PROPERTIES).orElseGet(ArrayList::new)
+                    .forEach(value -> {
+                        final String[] keyVal = split(value);
+                        
config.getInstallation().getFrameworkProperties().put(keyVal[0], keyVal[1]);
+                    });
 
             Properties varProps = cl.getOptionProperties(OPT_VARIABLE_VALUES);
             for (final String name : varProps.stringPropertyNames()) {
                 config.getVariables().put(name, varProps.getProperty(name));
             }
 
-            extractValueFromOption(cl, OPT_VERBOSE, "debug").ifPresent(
-                    value -> 
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", value));
+            if (cl.hasOption(OPT_VERBOSE)) {
+                extractValueFromOption(cl, OPT_VERBOSE, 
"debug").ifPresent(value -> System

Review comment:
       This should validate that the supplied verbose option is a valid log 
level.  It must be one of ("trace", "debug", "info", "warn", "error" or "off"). 
 Any other value should report an error and exit.

##########
File path: src/main/java/org/apache/sling/feature/launcher/impl/Main.java
##########
@@ -174,8 +179,9 @@ protected static void parseArgs(final LauncherConfig 
config, final String[] args
         final Option fwkProperties = Option.builder(OPT_FRAMEWORK_PROPERTIES)
                 .longOpt("framework-properties")

Review comment:
       Perhaps this name (and description) should be changed to 
"framework-property" since each instance of the arg supplies just one 
<name>=<value> pair?

##########
File path: src/main/java/org/apache/sling/feature/launcher/impl/Main.java
##########
@@ -174,8 +179,9 @@ protected static void parseArgs(final LauncherConfig 
config, final String[] args
         final Option fwkProperties = Option.builder(OPT_FRAMEWORK_PROPERTIES)
                 .longOpt("framework-properties")
                 .desc("Set framework properties")
+                .hasArg()
                 .optionalArg(true)

Review comment:
       I don't believe it makes sense for the arg to be optional here, so maybe 
remove this line?




-- 
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:
us...@infra.apache.org


Reply via email to