Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: using PORTRAIT instead of LANDSCAPE causes IndexOutOfBoundsException

  1. #1
    Join Date
    Aug 2007
    Posts
    15

    Default using PORTRAIT instead of LANDSCAPE causes IndexOutOfBoundsException

    I have a rather long report (65 pages landscape) with many subreports which I would like to turn to portrait orientation. Doing so causes the following exception, has anyone seen this before?

    Code:
    org.jfree.report.ReportProcessingException: Failed to process the report
     at org.jfree.report.layout.output.AbstractReportProcessor.processReport(AbstractReportProcessor.java:1128)
     at org.jfree.report.modules.output.pageable.pdf.PdfReportUtil.createPDF(PdfReportUtil.java:121)
     at org.jfree.report.modules.output.pageable.pdf.PdfReportUtil.createPDF(PdfReportUtil.java:79)
     at com.sac.power.thirdparty.jfreereport.JFreeReportUtil.generateDocumentFile(JFreeReportUtil.java:218)
     at com.sac.power.apps.OpsDashboard.Risk.RiskPanel$5.actionPerformed(RiskPanel.java:272)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
     at java.awt.Component.processMouseEvent(Component.java:5488)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
     at java.awt.Component.processEvent(Component.java:5253)
     at java.awt.Container.processEvent(Container.java:1966)
     at java.awt.Component.dispatchEventImpl(Component.java:3955)
     at java.awt.Container.dispatchEventImpl(Container.java:2024)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
     at java.awt.Container.dispatchEventImpl(Container.java:2010)
     at java.awt.Window.dispatchEventImpl(Window.java:1778)
     at java.awt.Component.dispatchEvent(Component.java:3803)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ParentException: 
    java.lang.IndexOutOfBoundsException
     at org.jfree.report.layout.process.alignment.AbstractAlignmentProcessor.getPageBreak(AbstractAlignmentProcessor.java:148)
     at org.jfree.report.layout.process.alignment.CenterAlignmentProcessor.performShiftRight(CenterAlignmentProcessor.java:228)
     at org.jfree.report.layout.process.alignment.CenterAlignmentProcessor.performCenterAlignment(CenterAlignmentProcessor.java:188)
     at org.jfree.report.layout.process.alignment.CenterAlignmentProcessor.handleElement(CenterAlignmentProcessor.java:132)
     at org.jfree.report.layout.process.alignment.AbstractAlignmentProcessor.iterate(AbstractAlignmentProcessor.java:235)
     at org.jfree.report.layout.process.alignment.AbstractAlignmentProcessor.next(AbstractAlignmentProcessor.java:331)
     at org.jfree.report.layout.process.InfiniteMinorAxisLayoutStep.finishLine(InfiniteMinorAxisLayoutStep.java:514)
     at org.jfree.report.layout.process.InfiniteMinorAxisLayoutStep.processParagraphChilds(InfiniteMinorAxisLayoutStep.java:457)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processCanvasLevelChild(IterateVisualProcessStep.java:142)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:65)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:219)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:202)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:61)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:219)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:202)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:61)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:219)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:202)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:61)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:219)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:202)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:61)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:219)
     at org.jfree.report.layout.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:183)
     at org.jfree.report.layout.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:61)
     at org.jfree.report.layout.process.InfiniteMinorAxisLayoutStep.compute(InfiniteMinorAxisLayoutStep.java:98)
     at org.jfree.report.layout.AbstractRenderer.validatePages(AbstractRenderer.java:467)
     at org.jfree.report.layout.output.AbstractReportProcessor.processPaginationLevel(AbstractReportProcessor.java:640)
     at org.jfree.report.layout.output.AbstractReportProcessor.prepareReportProcessing(AbstractReportProcessor.java:432)
     at org.jfree.report.layout.output.AbstractReportProcessor.processReport(AbstractReportProcessor.java:1087)
     at org.jfree.report.modules.output.pageable.pdf.PdfReportUtil.createPDF(PdfReportUtil.java:121)
     at org.jfree.report.modules.output.pageable.pdf.PdfReportUtil.createPDF(PdfReportUtil.java:79)

    Specifically, the code at the second to top of the call stack (CenterAlignmentProcessor.performShiftRight()) does the following:

    Code:
    while (segment < pagebreakCount && elementEnd > segmentEnd)
          {
            // try the next segment ..
            segment += 1;
            segmentStart = segmentEnd;
            segmentEnd = getPageBreak(segment);
            elementEnd = segmentStart + elementWidth;
          }
    The call to getPageBreak( segment ) throws the exception because the segment just got incremented to be equal to pagebreakCount. The check in the while loop is insufficient to protect against this, because it comes before the increment of segment. Any ideas anyone?

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Hi,

    Can you post a sample that allows us to replicate the error? One of the centered text-elements seems to be the trigger event for this bug, but without a replication path, it is very hard to start hunting.

    Have fun,
    said Thomas
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Aug 2007
    Posts
    15

    Default

    It seems like there is a centered LabelElement in the GroupHeader that is off the right of the page when I turn it PORTRAIT, and that is causing the exception.

    I can prevent this on my side, but maybe you can throw a more meaningful exception so its easier to find.
    Or better yet, just ignore such elements. Thanks!
    Last edited by panos; 01-17-2008 at 04:26 PM.

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    I still need more information to even replicate the bug on my side. So far all my attempts to recreate the crash were futile and the engine behaved very stable.

    So please tell me:
    What version of the reporting engine do you use?
    What are the page-properties (page-size, left and right margins, number of pages spanned) used in the report?
    What was the element's position in the report that caused the crash?

    Have fun,
    said Thomas
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.