zentol commented on a change in pull request #7717: [FLINK-11533] [container] 
Add option parse JAR manifest for jobClassName
URL: https://github.com/apache/flink/pull/7717#discussion_r260724860
 
 

 ##########
 File path: 
flink-container/src/main/java/org/apache/flink/container/entrypoint/StandaloneJobClusterConfigurationParserFactory.java
 ##########
 @@ -75,32 +76,48 @@ public Options getOptions() {
        }
 
        @Override
-       public StandaloneJobClusterConfiguration createResult(@Nonnull 
CommandLine commandLine) {
+       public StandaloneJobClusterConfiguration createResult(@Nonnull 
CommandLine commandLine) throws FlinkParseException {
                final String configDir = 
commandLine.getOptionValue(CONFIG_DIR_OPTION.getOpt());
                final Properties dynamicProperties = 
commandLine.getOptionProperties(DYNAMIC_PROPERTY_OPTION.getOpt());
-               final String restPortString = 
commandLine.getOptionValue(REST_PORT_OPTION.getOpt(), "-1");
-               final int restPort = Integer.parseInt(restPortString);
+               final int restPort = getRestPort(commandLine);
                final String hostname = 
commandLine.getOptionValue(HOST_OPTION.getOpt());
-               final String jobClassName = 
commandLine.getOptionValue(JOB_CLASS_NAME_OPTION.getOpt());
                final SavepointRestoreSettings savepointRestoreSettings = 
CliFrontendParser.createSavepointRestoreSettings(commandLine);
                final JobID jobId = getJobId(commandLine);
+               final String jobClassName = 
commandLine.getOptionValue(JOB_CLASS_NAME_OPTION.getOpt());
 
                return new StandaloneJobClusterConfiguration(
                        configDir,
                        dynamicProperties,
                        commandLine.getArgs(),
                        hostname,
                        restPort,
-                       jobClassName,
                        savepointRestoreSettings,
-                       jobId);
+                       jobId,
+                       jobClassName);
        }
 
-       private static JobID getJobId(CommandLine commandLine) {
+       private int getRestPort(CommandLine commandLine) throws 
FlinkParseException {
+               final String restPortString = 
commandLine.getOptionValue(REST_PORT_OPTION.getOpt(), "-1");
+               try {
+                       return Integer.parseInt(restPortString);
+               } catch (NumberFormatException e) {
+                       throw flinkParseException(REST_PORT_OPTION, e);
+               }
+       }
+
+       private static JobID getJobId(CommandLine commandLine) throws 
FlinkParseException {
                String jobId = 
commandLine.getOptionValue(JOB_ID_OPTION.getOpt());
                if (jobId == null) {
                        return DEFAULT_JOB_ID;
                }
-               return JobID.fromHexString(jobId);
+               try {
+                       return JobID.fromHexString(jobId);
+               } catch (IllegalArgumentException e) {
+                       throw flinkParseException(JOB_ID_OPTION, e);
 
 Review comment:
   rename to `createFlinkParseException`; this straight away confused me since 
all i saw was a call to the `FlinkParseException` constructor with an Option.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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