2001 JI Open Discussion Posted August 14, 2006 Share Posted August 14, 2006 By: Samanth Athrey - samanth_athrey Filling Error 2002-04-05 23:16Hi, Am using SQL server and when am trying to create the jsprint file i get the following exception ========== [java] java.lang.StringIndexOutOfBoundsException: String index out of range: 1 [java] at java.lang.String.substring(String.java:1473) [java] at FirstJasper.evaluateEstimated(FirstJasper.java:518) [java] at dori.jasper.engine.JRCalculator.evaluateEstimated(JRCalculator.java:489) [java] at dori.jasper.engine.JRCalculator.estimateVariables(JRCalculator.java:108) [java] at dori.jasper.engine.JRCalculator.estimateGroupRuptures(JRCalculator.java:122) [java] at dori.jasper.engine.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:178) [java] at dori.jasper.engine.JRVerticalFiller.fillReport(JRVerticalFiller.java:142) [java] at dori.jasper.engine.JRFiller.fillReport(JRFiller.java:114) [java] at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:811) [java] at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:667) [java] at dori.jasper.engine.JasperManager.fillReportToFile(JasperManager.java:582) [java] at dori.jasper.engine.JasperManager.fillReportToFile(JasperManager.java:550) [java] at JasperApp.main(JasperApp.java:103) ================== What is the problem? is there any other parameters i need to pass??? thanx in advance samanth By: Teodor Danciu - teodord RE: Filling Error 2002-04-07 01:32 Hi, This error appears in one of the report expressions. If we are talking about the FirstJasper.xml sample, and you have not modified it, then certainly the error comes from the FirstLetterGroup expression (FisrstLetter variable expression), which has a "substring" method call. If in your database the ShipCountry field might be null or empty, then you should protect the group expression by adding a length test before applying "substring" like this: <variable name="FirstLetter" class="java.lang.String" resetType="None" calculation="Nothing"> <variableExpression> <![CDATA[ ($F{ShipCountry} != null && $F{ShipCountry}.length() > 0)?$F{ShipCountry}.substring(0, 1).toUpperCase():"" ]]> </variableExpression> </variable> In the supplied database, there was no need for such an expression since all the records contained a not null and not empty ShipCountry field value. Good luck! Teodor 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