Fix NPE in Pulsar Functions CLI
As it stands, an NPE is thrown if you try to `create` or `localrun` a function with neither a class name nor a function name supplied, as the CLI will attempt to infer a function name from a class name that is `null`.
@@ -582,6 +582,10 @@ public class CmdFunctions extends CmdBase {
}
private void inferMissingFunctionName(FunctionConfig functionConfig) {
+ if (isNull(functionConfig.getClassName())) {
+ throw new IllegalArgumentException("You must specify a class name for the function");
+ }
+
String [] domains = functionConfig.getClassName().split("\\.");
if (domains.length == 0) {
functionConfig.setName(functionConfig.getClassName());
