|
|
|
|
|
|
JasperReports
 
0002571: JRHtmlExporter Assumes flush() Call. - JasperForge
  
Recently Visited: 0004887, 0004222, 0004163, 0004715, 0003788

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002571 [JasperReports] Bugs minor always 06/16/2008 21:49 03/04/2010 18:29
Reporter hooknc  
Assigned To lucianc
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.7.1 Product Version
  Target Version 3.7.1 Product Build
Summary 0002571: JRHtmlExporter Assumes flush() Call.
Description The net.sf.jasperreports.engine.export.JRHtmlExporter class assumes that it has to call xxx.flush() on any of the streams/writers that it is working with.

Test Case:

We are generating a net.sf.jasperreports.engine.JasperPrint instance in our Spring Web Controller and passing that instance through the javax.servlet.http.HttpServletRequest to our JSP. In our JSP we use a Java Tag to generate the net.sf.jasperreports.engine.export.JRHtmlExporter and then pass the JspWriter to the JRHtmlExporter as the JRExporterParameter.OUTPUT_WRITER.

When JRHtmlExporter calls .flush on the JspWriter the following exception occurs:

<parent exception removed...>
Caused by: java.io.IOException: Illegal to flush within a custom tag
    at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:80)
    at java.io.FilterWriter.flush(Unknown Source)
    at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReportToWriter(JRHtmlExporter.java:710)
    at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReport(JRHtmlExporter.java:389)
    ... 78 more

It might be preferable if the Exporter classes had a settable parameter for controlling the flush behavior.

There is a nice work around that Lucian provided on the JasperForge.org Forum.

We extended the java.io.FilterWriter class on overrode the .flush() method with no behavior:

private class ExtendedFilterWriter extends FilterWriter {
  public ExtendedFilterWriter(Writer writer) {
    super(writer);
  }
  public void flush() {
  }
}

We then wrapped the JspWriter class with the ExtendedFilterWriter before handing the Writer to the JRHtmlExporter.

Please see the following JasperForge.org Forum post for more information:

http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=42068&catid=8 [^]

Thank you for your time.
Steps To Reproduce
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0008651)
lucianc
12/29/2009 11:34

An export parameter (JRHtmlExporterParameter.FLUSH_OUTPUT) and a property (net.sf.jasperreports.export.html.flush.output) have been introduced to control whether the HTML exporter flushes the output after export. By default the output is flushed (for backward compatibility).

SVN log:
    Sending /home/lucian/lucru/jasperreports/src/default.jasperreports.properties
    Sending /home/lucian/lucru/jasperreports/src/net/sf/jasperreports/engine/export/JRHtmlExporter.java
    Sending /home/lucian/lucru/jasperreports/src/net/sf/jasperreports/engine/export/JRHtmlExporterParameter.java
    Transmitting file data ...
    Committed revision 3242.

- Issue History
Date Modified Username Field Change
04/22/2009 12:50 teodord Assigned To hooknc => lucianc
04/22/2009 12:50 teodord Status assigned => acknowledged
12/29/2009 11:34 lucianc Note Added: 0008651
12/29/2009 11:34 lucianc Reporter hooknc => bklawans
12/29/2009 11:34 lucianc Status acknowledged => resolved
12/29/2009 11:34 lucianc Resolution open => fixed
12/29/2009 11:34 lucianc Fixed in Version => 3.7.1
12/29/2009 11:34 lucianc Target Version => 3.7.1
03/04/2010 18:29 teodord Status resolved => closed
 
 
JasperForge Quotes
"Due to the fact that JasperServer is tightly coupled with Tomcat and works great out of the box with the installer, we are leaning towards that set up."
 
Founding Member, Open Solutions Alliance       Hot Jasper Projects on SOURCEFORGE.NET       Powered by EssentiaESP