RESOLVED - issue BATCH-1217: Suggest use .doubleValue() value in DefaultFieldSet.readDouble(..)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user