RESOLVED - issue BATCH-285: Problem with DelimitedLineTokenizer and whitespace after quote
http://jira.springframework.org/browse/BATCH-285 Refactored to treat quoted strings with whitepsace outside the quotes as a special case (stripping the whitespace before unquoting). Non-quoted strings are not trimmed (but clients like the item readers may be trimming).
This commit is contained in:
@@ -119,6 +119,24 @@ public class DelimitedLineTokenizerTests extends TestCase {
|
||||
assertEquals("c", line.readString(2));
|
||||
}
|
||||
|
||||
public void testTokenizeWithSpaceAtEnd() {
|
||||
FieldSet line = tokenizer.tokenize("a,b,c ");
|
||||
assertEquals(3, line.getFieldCount());
|
||||
assertEquals("c", line.readString(2));
|
||||
}
|
||||
|
||||
public void testTokenizeWithQuoteAndSpaceAtEnd() {
|
||||
FieldSet line = tokenizer.tokenize("a,b,\"c\" ");
|
||||
assertEquals(3, line.getFieldCount());
|
||||
assertEquals("c", line.readString(2));
|
||||
}
|
||||
|
||||
public void testTokenizeWithQuoteAndSpaceBeforeDelimiter() {
|
||||
FieldSet line = tokenizer.tokenize("a,\"b\" ,c");
|
||||
assertEquals(3, line.getFieldCount());
|
||||
assertEquals("b", line.readString(1));
|
||||
}
|
||||
|
||||
public void testTokenizeWithDelimiterAtEnd() {
|
||||
FieldSet line = tokenizer.tokenize("a,b,c,");
|
||||
assertEquals(4, line.getFieldCount());
|
||||
|
||||
Reference in New Issue
Block a user