[#10791] - Field-value of type InputStream reused during the filling -> EOFException

Category:
Bug report
Priority:
Normal
Status:
Resolved
Project: Severity:
Major
Resolution:
Fixed
Component: Reproducibility:
Always
Assigned to:
0

A report based on JDBC-Datasources uses a field of type InputStream backed by a BLOB. Filling the report fails in JasperReports v6.5.1 always with EOFException here:

Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: Report.evaluate(this, $P{REPORT_LOCALE}, "A", Report.evaluate(this, $P{REPORT_LOCALE}, "S", $F{VALUE}))
at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:287)
at net.sf.jasperreports.compilers.GroovyEvaluator.handleEvaluationException(GroovyEvaluator.java:98)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:319)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:672)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:640)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1164)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:526)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:510)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383)
at net.sf.jasperreports.engine.fill.JRFillFrame.evaluate(JRFillFrame.java:159)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:533)
at net.sf.jasperreports.engine.fill.JRFillBand.refill(JRFillBand.java:383)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2608)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:791)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:272)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:103)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:609)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:387)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:736)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2638)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3113)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:853)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:349)
at de.ser.doxis4.csb.tools.transport.extensions.changelog.Report.evaluate(Report.java:224)
at sun.reflect.GeneratedMethodAccessor436.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
at import_configuration_1524080524276_25359.evaluate(calculator_import_configuration_1524080524276_25359:190)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:305)
... 22 more

It turned out, that JasperReports decides to re-fill an element (s. JRFillBand.refill(JRFillBand.java:383)), using the current values, which can of course not work with InputStreams, Readers, BLOBs, CLOBs, etc.
If this is not a bug, it would be reasonable to introduce byte[] as supported field-type (internally are InputStreams anyway backed by byte-arrays in JRResultSetDataSource), in order the value can be reused across multiple fill-attempts.

In JasperReports 6.4.1 there were no such problems.

v6.5.1
barnabas.bodnar's picture
Joined: Mar 19 2015 - 4:10am
Last seen: 2 months 1 week ago

4 Comments:

#1
  • Status:New» Acknowledged
#2

Support for byte[] has been added at https://github.com/TIBCOSoftware/jasperreports/commit/f601d2ec9bd2d5c9ab...

We're currently considering possible solutions for the InputStream problem.

#3

Thank you!

#4
  • Resolution:Open» Fixed
  • Status:Acknowledged» Resolved
  • Assigned:nobody» lucianc

Fixed the InputStream problem at https://github.com/TIBCOSoftware/jasperreports/commit/53c42d94dd6fe99c75...

Regards,
Lucian

Feedback