Jump to content
Changes to the Jaspersoft community edition download ×

NumberFormatException for Double-Field


Recommended Posts

By: Torsten M  r - tm0815

NumberFormatException for Double-Field

2003-03-27 06:07

Hello,

 

when I try to run a simple report containing Double-Fields I receive the following Exception (possibly due

to my default Locale de_DE):

 

java.lang.NumberFormatException: For input string: "-13,0"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)

at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1213)

at java.lang.Double.valueOf(Double.java:184)

at java.lang.Double.<init>(Double.java:259)

at dori.jasper.engine.JRResultSetDataSource.getFieldValue(JRResultSetDataSource.java:190)

at dori.jasper.engine.fill.JRBaseFiller.next(JRBaseFiller.java:711)

at dori.jasper.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:158)

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:463)

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:373)

at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:114)

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:217)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:737)

at JasperXmpl.main(JasperXmpl.java:54)

 

A workaround could be the following patch in JRResultSetDataSource#getgetFieldValue(JRField):

 

else if (clazz.equals(java.lang.Double.class))

{

// objValue = resultSet.getString(field.getName());

// if(resultSet.wasNull())

// {

// objValue = null;

// }

// else

// {

// objValue = new Double((String)objValue);

// }

 

objValue = new Double(resultSet.getDouble(field.getName()));

if(resultSet.wasNull())

{

objValue = null;

}

 

}

 

Is there a reason for the implementation commented out in the above snippet?

 

Thanks

 

Torsten Mueller

Link to comment
Share on other sites

  • 5 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I was worndering if you found a solution to this problem. Recently I got the same error.

 

I happens for very long reports and as a result sevaral pages, beyond that point, get corrupted.

Only the lines apprear and some random static text appears.

 

It will be great if you could share your solution, if you got any

 

thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...