Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid log error and throw approach #377

Open
ipotapchuk opened this issue Jul 19, 2023 · 0 comments
Open

Avoid log error and throw approach #377

ipotapchuk opened this issue Jul 19, 2023 · 0 comments

Comments

@ipotapchuk
Copy link

I have this error logged by jasper when I am canceling the fill and cleaning the swap file virtualizer:

Error virtualizing object 622875385_1438335749_15478_-1362924112 to JRSwapFile \var\swap\swap_1169073004_1689777368024
java.io.IOException: Stream Closed
	at java.base/java.io.RandomAccessFile.seek0(Native Method)
	at java.base/java.io.RandomAccessFile.seek(RandomAccessFile.java:590)
	at net.sf.jasperreports.engine.util.JRSwapFile.write(JRSwapFile.java:168)
	at net.sf.jasperreports.engine.util.JRSwapFile.write(JRSwapFile.java:157)
	at net.sf.jasperreports.engine.util.SwapFileVirtualizerStore.store(SwapFileVirtualizerStore.java:106)
	at net.sf.jasperreports.engine.fill.StoreVirtualizer.pageOut(StoreVirtualizer.java:49)
	at net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer.virtualizeData(JRAbstractLRUVirtualizer.java:614)
	at net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer.evict(JRAbstractLRUVirtualizer.java:429)
	at net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer.registerObject(JRAbstractLRUVirtualizer.java:383)
	at net.sf.jasperreports.engine.base.ElementsBlock.register(ElementsBlock.java:134)
	at net.sf.jasperreports.engine.base.ElementsBlock.preAdd(ElementsBlock.java:185)
	at net.sf.jasperreports.engine.base.ElementsBlock.add(ElementsBlock.java:220)
	at net.sf.jasperreports.engine.base.ElementsBlock.add(ElementsBlock.java:244)
	at net.sf.jasperreports.engine.base.VirtualizableElementList.add(VirtualizableElementList.java:125)
	at net.sf.jasperreports.engine.base.JRVirtualPrintPage.addElement(JRVirtualPrintPage.java:159)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.lambda$fillBand$2(JRBaseFiller.java:1345)
	at java.base/java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at net.sf.jasperreports.engine.fill.OffsetElementsUtil.lambda$transfer$1(OffsetElementsUtil.java:45)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at net.sf.jasperreports.engine.fill.OffsetElementsUtil.transfer(OffsetElementsUtil.java:41)
	at net.sf.jasperreports.engine.fill.JRPrintBand.consumeElement(JRPrintBand.java:82)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.fillBand(JRBaseFiller.java:1343)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:471)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:421)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBreak(JRVerticalFiller.java:2361)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBreak(JRVerticalFiller.java:2450)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2698)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:837)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:276)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:119)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:631)
	at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:434)
	at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:131)
	at java.base/java.lang.Thread.run(Thread.java:833)

I guess it happens because the virtualizer is still doing some work while fill was already canceled.
In general, it's not a good practice to log and re-throw, so I think this logging should be changed to debug level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant