Closed
Description
Bug description
DefaultJobParamatersConverter
class's private parseValue(String encodedJobParameter)
method throws java.lang.ArrayIndexOutOfBoundsException
if the parameter encodedJobParameter
is null or empty.
This causes the batch app started from the command line to not accept empty command line arguments in the format arg1=
.
Environment
Java 17
Spring Boot 3.1.4
Spring Batch 5.0.3
Expected behavior
Job parameter should be null or empty.
Minimal Complete Reproducible example
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Properties;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.converter.DefaultJobParametersConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class Test {
@Autowired
DefaultJobParametersConverter converter;
@Test
void testConversion() {
Properties props = new Properties();
props.put("arg1", "");
assertEquals("", converter.getJobParameters(props).getString("arg1"));
}
}