RESOLVED - issue BATCH-1217: Suggest use .doubleValue() value in DefaultFieldSet.readDouble(..)

This commit is contained in:
dsyer
2009-04-26 15:40:13 +00:00
parent 0bcc36927b
commit 79fa645aca
2 changed files with 18 additions and 2 deletions

View File

@@ -321,7 +321,7 @@ public class DefaultFieldSet implements FieldSet {
* @see org.springframework.batch.item.file.mapping.IFieldSet#readLong(int)
*/
public long readLong(int index) {
return (Long) parseNumber(readAndTrim(index));
return parseNumber(readAndTrim(index)).longValue();
}
/*
@@ -385,7 +385,7 @@ public class DefaultFieldSet implements FieldSet {
* org.springframework.batch.item.file.mapping.IFieldSet#readDouble(int)
*/
public double readDouble(int index) {
return (Double) parseNumber(readAndTrim(index));
return (Double) parseNumber(readAndTrim(index)).doubleValue();
}
/*

View File

@@ -111,6 +111,14 @@ public class DefaultFieldSetTests {
}
@Test
public void testReadIntegerAsFloat() throws Exception {
assertEquals(354224, fieldSet.readFloat(5), .001);
assertEquals(354224, fieldSet.readFloat("Integer"), .001);
}
@Test
public void testReadFloat() throws Exception {
@@ -119,6 +127,14 @@ public class DefaultFieldSetTests {
}
@Test
public void testReadIntegerAsDouble() throws Exception {
assertEquals(354224, fieldSet.readDouble(5), .001);
assertEquals(354224, fieldSet.readDouble("Integer"), .001);
}
@Test
public void testReadDouble() throws Exception {