dcherk Posted August 3, 2006 Share Posted August 3, 2006 I can't seem to log an issue into the bug system, so reporting it here: I've got an isStyledText==true field, and it just so happened that the field's value evaluated to: <font size="200%">public </font>notes.This resulted in the following exciting exception:java.lang.NumberFormatException: For input string: "200%" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1207) at java.lang.Float.valueOf(Float.java:205) at java.lang.Float.<init>(Float.java:289) at net.sf.jasperreports.engine.util.JRStyledTextParser.parseStyle(JRStyledTextParser.java:362) at net.sf.jasperreports.engine.util.JRStyledTextParser.parse(JRStyledTextParser.java:140) at net.sf.jasperreports.engine.fill.JRFillTextElement.getStyledText(JRFillTextElement.java:466) at net.sf.jasperreports.engine.fill.JRFillTextElement.getText(JRFillTextElement.java:492) at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:485) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter(JRVerticalFiller.java:685) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters(JRVerticalFiller.java:659) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:239) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:647) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234) at net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:203) That's a bit harsh. Perhaps like in other cases where the styled text violates the styled rules, JasperReports should just output the raw text rather than throwing such a nasty exception. This is particularly painful for me, because the text is submitted by the user -- for me, it is not part of the report defininition, so it is very hard to catch such a problem. Thanks,Dave CherkasskyDJiNN Software. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 3, 2006 Share Posted August 3, 2006 Hi, When the styled text content is not a valid XML, we interpret it as raw text, without raising any exceptions.But in this particular case, the styled text is a valid XML, with tags that our styled text recognizes, is just that the value for the size attribute is unexpected.Our HTML support in styled text right now, does not support the % character, or any other letter. It only supports integer numbers there representing the size of the font as you would normally specify using the fontSize attribute in JasperReports. Note that our HTML support is limited, so any other HTML constructs that would work in a browser do not necessarily work in JR. Thank you,Teodor Link to comment Share on other sites More sharing options...
dcherk Posted August 3, 2006 Author Share Posted August 3, 2006 Teodor: I understand why it happened from a technical point of view, and I've already implemented a work-around. But what I am saying is that its not very usable from a business point of view, so I think you might want to improve the functionality here a little bit... Thanks for your explanation though -- it'll help me think of other scenarios that might result in similar issues and write some preventitive code. Dave Cherkassky. 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