jhamilton Posted November 28, 2011 Share Posted November 28, 2011 We are using the image component to display a photo within a report. One of the requirements is that when the photo cannot be found then a blank space should be placed there instead. The photos are retrieved from via an internal http request like this:http://127.0.0.1/_common/lib/photo?type=student&id=0000&w=256&h=256¬found=404If a photo could not be found the above script would return a 404 error.Prior to upgrading to JasperReports 4.1 (using 4.0.2 Javaflow), setting the onErrorType property for images to Blank would result in the correct behaviour of a blank image. Since upgrading (to fix another issue with justified text and padding), any requests to the script above by the image would generate an error and the report would not run:net.sf.jasperreports.engine.JRException: Error opening input stream from URL : http://127.0.0.1/_common/lib/photo?type=student&id=0000&w=256&h=256¬found=404Here is currently how we are using the image: <image scaleImage="RetainShape" hAlign="Center" vAlign="Middle" isUsingCache="true" isLazy="false" evaluationTime="Now" onErrorType="Blank"><reportElement positionType="FixRelativeToTop" stretchType="NoStretch" isPrintRepeatedValues="true"x="0" y="80" width="79" height="79" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false"isPrintWhenDetailOverflows="false"></reportElement><imageExpression class="java.lang.String"><![CDATA["http://127.0.0.1/_common/lib/photo?type=student&id=" + URLEncoder.encode($P{EXTERNAL_ID}) + "&w=256&h=256¬found=404"]]></imageExpression></image> Reverting back to 4.0.2 Javaflow rectifies the issue but is not ideal as the justified text fix is also required. Is there any extra properties we can set to get back the old behaviour or is this a problem with 4.1? Thanks,James Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now