Using JR 3.1.2, iReport for JR 3.1.2, and Maven plugin for compiling. I have image stored in Java in a byte array and would like to display it in a report. I read that JR would accept any Java object as a parameter, but I cannot figure how to do it. When defining new parameter (using iReport) only some class types are available, so I chose Object. When I tried to add this filed to "Last Page Footer", program was changing the type to String. I can change it manually, but then I'm getting:
Error compiling report design :
org.xml.sax.SAXParseException: cvc-enumeration-valid: Value 'java.lang.Object' is not facet-valid with respect to enumeration '[java.lang.Boolean, java.lang.Byte, java.util.Date, java.sql.Timestamp, java.sql.Time, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short, java.math.BigDecima l, java.lang.Number, java.lang.String]'. It must be a value from the enumeration.
Any suggestions how to use parameters with type different from the 13 types listed above? I was trying to use Byte instead of the Object, but then I was getting CastingException.
I found the solution to my problem, I'll put the solution here if someone has the same problem.
I was defining byte array parameter as an object and when I was adding it to the page it was by default added as a String in text field. The byte array was image which I wanted to display on the report, so first I had to convert byte array to ByteArrayInputStream on the Java side, define parameter as type InputStream, and then display it within the image, also as InputStream type.