spring-projects / spring-batch

Spring Batch is a framework for writing batch applications using Java and Spring
http://projects.spring.io/spring-batch/
Apache License 2.0
2.63k stars 2.31k forks source link

PlaceholderTargetSource doesn't always replace all placeholders [BATCH-1058] #2519

Closed spring-projects-issues closed 15 years ago

spring-projects-issues commented 15 years ago

Takuma Ueda opened BATCH-1058 and commented

When multiple Spring EL binding patterns are used, some keys may be missed when replacing text is shorter than the key length.

For exapmle,

When "#{jobParameters[year]}" gets replaced with "2009", the following code fragment misses the second key "#{jobParameters[month]" as "next + 1" points to where "#{jobParameters[month]}" has already started.

while (first >= 0) {

...
first = result.indexOf(PLACEHOLDER_PREFIX, next + 1);
next = result.indexOf(PLACEHOLDER_SUFFIX, first + 1);

}


Affects: 2.0.0.M4

Attachments:

Referenced from: commits https://github.com/spring-projects/spring-batch/commit/ef4dba7590e447f6777417a8f6aeb78af6af3abf

spring-projects-issues commented 15 years ago

Dave Syer commented

Fixed, thanks. N.B. they are not real Spring EL expressions (just designed to be forward compatible when Spring 3.0 comes out - at which point we won't need the PlaceholderTargetSource).

spring-projects-issues commented 15 years ago

Takuma Ueda commented

Thanks. Quick fix and good to know about the Spring EL expressions as well.