pupeno Posted September 15, 2010 Share Posted September 15, 2010 I'm working on a system that uses Jasper reports. Recently it started throwing this error: org.apache.commons.beanutils.ConversionException: Unparseable date: "03/03/1981" at org.apache.commons.beanutils.locale.BaseLocaleConverter.convert(BaseLocaleConverter.java:241) at org.apache.commons.beanutils.locale.LocaleConvertUtilsBean.convert(LocaleConvertUtilsBean.java:285) at net.sf.jasperreports.engine.data.JRAbstractTextDataSource.convertStringValue(JRAbstractTextDataSource.java:69) at net.sf.jasperreports.engine.data.JRXmlDataSource.getFieldValue(JRXmlDataSource.java:313) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:823) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:787) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1478) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:125) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624) at XmlJasperInterface.report(XmlJasperInterface.java:89) at XmlJasperInterface.main(XmlJasperInterface.java:63) Caused by: java.text.ParseException: Unparseable date: "03/03/1981" at java.text.DateFormat.parse(DateFormat.java:337) at net.sf.jasperreports.engine.util.JRDateLocaleConverter.parse(JRDateLocaleConverter.java:84) at org.apache.commons.beanutils.locale.BaseLocaleConverter.convert(BaseLocaleConverter.java:232) ... 13 more I'm not sure what caused it. We've also recently upgraded Jasper reports but I remember it was working after the upgrade. I've found a blog post titled BeanUtils, Digester, and Type Conversion which points to add these lines: String pattern = "MM/dd/yyyy"; Locale locale = Locale.getDefault(); DateLocaleConverter converter = new DateLocaleConverter(locale, pattern); converter.setLenient(true); ConvertUtils.register(converter, java.util.Date.class); but they've changed nothing. I still get the same error. The line that triggers the error is this one: jasperPrint = JasperFillManager.fillReport(jasperReport, null, new JRXmlDataSource(System.in, selectCriteria)); Thanks.Post Edited by pupeno at 09/15/2010 14:27 Link to comment Share on other sites More sharing options...
pupeno Posted September 15, 2010 Author Share Posted September 15, 2010 Downgrading Jasper Reports to 1.1.0 made it work again, so it was most likely the upgrade that broke it. Link to comment Share on other sites More sharing options...
pupeno Posted September 16, 2010 Author Share Posted September 16, 2010 From the answer at Stack Overflow: You will need to set a date pattern in your datasource, like this: JRXmlDataSource datasource = new JRXmlDataSource(....);datasource.setDatePattern("MM/dd/yyyy");[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now