Optional:

The function could benefit from _extract method_ refactoring:

```
final String key = getNextKey(args, i);
```

```
        private static String getNextKey(final String[] args, final int index) {
                final String arg = args[index];
                final String key;

                if (arg.startsWith("--")) {
                        key = arg.substring(2);
                } else if (arg.startsWith("-")) {
                        key = arg.substring(1);
                } else {
                        throw new IllegalArgumentException(
                                String.format("Error parsing arguments '%s' on 
'%s'." + " Please prefix keys with -- or -.",
                                        Arrays.toString(args), arg));
                }

                if (key.length() == 0) {
                        throw new IllegalArgumentException(
                                String.format("The input %s contains an empty 
argument",
                                        Arrays.toString(args)));
                }
                return key;
        }
```


[ Full content available at: https://github.com/apache/flink/pull/6737 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to