I have a problem initializing the report in the program at startup. This once worked correctly. But when I unistall JDK 1.7 update 17 to update JDK 1.7 21 and update Netbeans, there is an Exception: (
This error message is:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:609) at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:509) at sun.font.ExtendedTextSourceLabel.getLineBreakIndex(ExtendedTextSourceLabel.java:455) at java.awt.font.TextMeasurer.calcLineBreak(TextMeasurer.java:325) at java.awt.font.TextMeasurer.getLineBreakIndex(TextMeasurer.java:561) at java.awt.font.LineBreakMeasurer.nextOffset(LineBreakMeasurer.java:358) at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLineBreakIndex(SimpleTextLineWrapper.java:561) at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLine(SimpleTextLineWrapper.java:535) at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.nextLine(SimpleTextLineWrapper.java:517) at net.sf.jasperreports.engine.fill.TextMeasurer.renderNextLine(TextMeasurer.java:649) at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:454) at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:395) at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:541) at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:641) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:379) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:353) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:458) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:421) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:282) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745) at com.ikbiz.gastroscope.controller.ReportController.initReport(ReportController.java:180) at com.ikbiz.gastroscope.controller.ReportController.<init>(ReportController.java:111) at com.ikbiz.gastroscope.view.PanelScope.<init>(PanelScope.java:32) at com.ikbiz.gastroscope.view.PanelEntry.initComponents(PanelEntry.java:199) at com.ikbiz.gastroscope.view.PanelEntry.<init>(PanelEntry.java:86) at com.ikbiz.gastroscope.view.Application.initComponents(Application.java:203) at com.ikbiz.gastroscope.view.Application.<init>(Application.java:35) at com.ikbiz.gastroscope.view.Application.getInstance(Application.java:43) at com.ikbiz.gastroscope.view.Application.main(Application.java:79) Java Result: 1
And this is my code to initialize the report.
public void initReport() { try { param.put("noMr", "0000"); param.put("visitCode", "V-199208300000"); param.put("templateLoco", iReportDir); param.put("tools", "Tools"); param.put("medicine", "Medicine"); param.put("result", "Data hasil disini"); param.put("conclusion", "Data kesimpulan disini"); param.put("suggestion", "Suggestion"); param.put("SUBREPORT_DIR",iReportDir); String imageLoco = iReportDir +"image-sample.jpg"; for (int i = 0; i < 20; i++) { FileInputStream image = new FileInputStream(imageLoco); param.put("imgResult"+(i+1), image); } param.put("emptyImg", iReportDir+"logo.jpg"); setTemplate("data/reports/templates/template_1.jasper"); jasperPrint = JasperFillManager.fillReport(getTemplate(), param, DatabaseUtility.getConnection()); } catch (JRException ex) { System.out.println(ex.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } }
But, And when I build. Jar, the error disappears.
Please help, thanks before :)
source share