PDA

View Full Version : Exception "Cannot advance negative"



Anonymous
09-10-2002, 08:57 AM
Hi,
I have just upgraded from version 0.7.5b to version 0.7.6. When I try to preview the report I get the exception depicted below.
I'm using java 1.4.0_01 on Windows XP.
What did I get wrong?
Thanks in advance for your help

Antonino

***********************************************************

java.lang.IllegalArgumentException: Cannot advance negative
at com.jrefinery.report.Cursor.advance(Cursor.java:98)
at com.jrefinery.report.ReportProcessor.draw(ReportProcessor.java:124)
at com.jrefinery.report.ReportProcessor.printPageFooter(ReportProcessor.
java:171)
at com.jrefinery.report.JFreeReport.processPage(JFreeReport.java:742)
at com.jrefinery.report.JFreeReport.repaginate(JFreeReport.java:647)
at com.jrefinery.report.preview.ReportPane.repaginate(ReportPane.java:61
1)
at com.jrefinery.report.preview.ReportPane.paintComponent(ReportPane.jav
a:433)
at javax.swing.JComponent.paint(JComponent.java:804)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JViewport.paint(JViewport.java:707)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:552)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4742)

at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
at javax.swing.JComponent.paint(JComponent.java:794)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)

at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:
60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97
)
at java.awt.Container.paint(Container.java:1268)
at sun.awt.RepaintArea.paint(RepaintArea.java:180)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3586)
at java.awt.Container.dispatchEventImpl(Container.java:1582)
at java.awt.Window.dispatchEventImpl(Window.java:1581)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:191)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
java.lang.IllegalArgumentException: Cannot advance negative
at com.jrefinery.report.Cursor.advance(Cursor.java:98)
at com.jrefinery.report.ReportProcessor.draw(ReportProcessor.java:124)
at com.jrefinery.report.ReportProcessor.printPageFooter(ReportProcessor.
java:171)
at com.jrefinery.report.JFreeReport.processPage(JFreeReport.java:742)
at com.jrefinery.report.JFreeReport.repaginate(JFreeReport.java:647)
at com.jrefinery.report.preview.ReportPane.repaginate(ReportPane.java:61
1)
at com.jrefinery.report.preview.ReportPane.paintComponent(ReportPane.jav
a:433)
at javax.swing.JComponent.paint(JComponent.java:804)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JViewport.paint(JViewport.java:707)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paint(JComponent.java:813)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:552)
at javax.swing.JComponent.paintChildren(JComponent.java:643)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4742)

at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
at javax.swing.JComponent.paint(JComponent.java:794)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)

at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:
60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97
)
at java.awt.Container.paint(Container.java:1268)
at sun.awt.RepaintArea.paint(RepaintArea.java:180)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
at java.awt.Component.dispatchEventImpl(Component.java:3586)
at java.awt.Container.dispatchEventImpl(Container.java:1582)
at java.awt.Window.dispatchEventImpl(Window.java:1581)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:191)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

Anonymous
09-10-2002, 09:41 AM
Hi,

This exception is mostly caused by a wrong PageFormat object, your PageFooter does not fit on the page, try a greater PageFormat so that the printable area is suitable for at least the pagefooter and pageheader.

When you upgrade from older versions make sure you have the report-tag updated. The older versions ignored the "width" and "height" attributes, but now these attributes are used to construct the DefaultPageFormat. Have a look at report1.xml for a valid tag defining a A4-PageFormat.

This Exception can be "fixed" on the fly by selecting a new Paper in the preview frame, the report should then be printed. For a permanent fix, you will have to define the PageFormat in the report tag or remove the height and width attributes completly (then the Printers default pageformat is used).

Have more fun,
said Thomas

Anonymous
09-10-2002, 11:15 AM
Thanks a lot Thomas for your prompt answer.
It helped a lot.

Antonino