m00hk00h Posted June 27, 2013 Share Posted June 27, 2013 In my report, I define an image in the following way:-Image expression: new File("./path/to/image.jpg")-Expression class: java.io.FileWhen I save the report design using iReport 5.1.0 the resulting jrxml image expression looks like this:<imageExpression><![CDATA[new java.io.File("....What I want to have is this:<imageExpression class="java.io.File"><![CDATA[new File("....Of course, when I close and open the report again in iReport, the field is reset to "java.lang.String".Is there something I am missing?Background:Ever since jasperreports 4.5 (?) I have had trouble with image expression paths, giving me a "byte data not found at location"-exception and producing empty PDFs with my Java application, that fills and compiles the reports and exports them as PDF. With jasper 5 I don't even get the exception any more, PDFs are just empty.Using a "new File()" was a workaround I could live with and that worked very well, but now it's just a pain in the butt: I have to open all edited jrxml files in an editor and add the image expression class tag myself (search -> replace). The reports compile and export just like they used to afterwards, as long as I don't change something using iReport 5.1.0 - because that removes the tag and Jasper defaults back to String. Link to comment Share on other sites More sharing options...
Solution lucianc Posted July 1, 2013 Solution Share Posted July 1, 2013 It should work fine without the expression class. Expressions classes were deprecated in 4.1.1, the code was changed to use the type of the object that results by evaluating the expression without knowing it in advance.Could you attach a sample report that illustrates the problem?Regards,Lucian Link to comment Share on other sites More sharing options...
m00hk00h Posted July 8, 2013 Author Share Posted July 8, 2013 Lucian, thank you for trying to help me. I didn't know that expression classes were deprecated. Your answer didn't help me directly, but the word "depricated" somehow inspired me to go through the code line by line and indeed, I found the source of all the errors I encountered. Somebody thought it was a good idea to have a helper to compile the reports. That class was inside a package that a) did not comply with company naming rules and b) was easily mistaken for a part of the JR API ("JRCompilerHelper"). That package used it's own depency on JR - version 1.0.3(!). Guess that was long before said naming rules were introduced. So basically, all reports have been compiled by the 1.0.3-compiler. I kicked the package out and re-wrote the functionality directly into the app. Everything's working as intended now. Thanks again! 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