Java Spring云任务:任务参数中有多个空格会导致StringIndexOutOfBoundsException
我正在使用以编程方式在Kubernetes上启动任务。我注意到每当任务启动参数有一次以上的空间时,SCDF服务器就会抛出一个Java Spring云任务:任务参数中有多个空格会导致StringIndexOutOfBoundsException,java,spring,dsl,spring-cloud-dataflow,spring-cloud-task,Java,Spring,Dsl,Spring Cloud Dataflow,Spring Cloud Task,我正在使用以编程方式在Kubernetes上启动任务。我注意到每当任务启动参数有一次以上的空间时,SCDF服务器就会抛出一个StringIndexOutOfBoundsException 例如: URI dataFlowUri = URI.create(dataFlowServerUri); DataFlowOperations dataFlowOperations = new DataFlowTemplate(dataFlowUri); Task task = Task.builder(dat
StringIndexOutOfBoundsException
例如:
URI dataFlowUri = URI.create(dataFlowServerUri);
DataFlowOperations dataFlowOperations = new DataFlowTemplate(dataFlowUri);
Task task = Task.builder(dataFlowOperations).name(taskNameWithBatchIdInstanceId).definition(taskDefintion).description(taskDescription).build();
Map<String, String> taskLaunchProperties = new DeploymentPropertiesBuilder()
.put("deployer.task.kubernetes.limits.cpu", cpuLimit)
.put("deployer.task.kubernetes.limits.memory", memoryLimit)
.put("deployer.task.kubernetes.requests.cpu", cpuRequest)
.put("deployer.task.kubernetes.requests.memory", memoryRequest).build();
task.launch(taskLaunchProperties, Arrays.asList("inputArgument=ABC CDE FGH"));
在客户端,由于SCDF服务器遇到StringIndexOutOfBoundsException
,对task.launch
的调用会导致服务器发出500[无正文]
响应
通过大量试验,我意识到只有当任务输入参数中有多个空格时,才会出现这种异常。如果输入参数少于2个空格,并且在本例中不再看到StringIndexOutOfBoundsException
,则我可以启动任务
task.launch(taskLaunchProperties, Arrays.asList("inputArgument=ABC CDE"));
问题:如何将带有多个空格的输入参数传递给SCDF任务?为什么SCDF不允许有多个空格的参数?这是虫子吗
task.launch(taskLaunchProperties, Arrays.asList("inputArgument=ABC CDE"));