Category: | Bug report |
Priority: | Normal |
Status: | New |
Project: | Severity: | Major |
Resolution: | Open |
|
Component: | Reproducibility: | N/A |
Assigned to: |
since updating to a new jasper version (docker: bitnami/jasperreports:7-debian-10) several Reports are not working any more.
The Problem seems, that the following instruction (+90) is not being parsed properly any more:
<parameter name="to" class="java.util.Date">
<defaultValueExpression><![CDATA[($P{to} == null ? new Date() + 90 : $P{to})]]></defaultValueExpression>
</parameter>
I am pretty new to jasperreports. I have tried several possible solutions with no success. Here a few error Messages i got:
ERROR GenericExceptionMapper,http-nio-8080-exec-3:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().plusDays(90) : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-5:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date() + 90.days : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-1:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().set(year, month, date +90, hrs, min, sec) : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-6:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().add(0,0,90,0,0,0) : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-10:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().add(Calendar.DATE, 90) : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-8:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date(Instant.now().plus(90,ChronoUnit.DAYS)) : $P{to})
ERROR GenericExceptionMapper,http-nio-8080-exec-9:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().addDays(5) : $P{to})
I would appreciate if someone could help me how to fix the "+ 90" (days) issue, to make my report work again with the new jasperserver version. The main problem seems to be that groovy is missing the plus functionality as can be seen by this log snippet here:
Caused by: groovy.lang.MissingMethodException: No signature of method: java.util.Date.plus() is applicable for argument types: (Integer) values: [90]
Possible solutions: parse(java.lang.String), split(groovy.lang.Closure), is(java.lang.Object), use([Ljava.lang.Object;), wait(), clone()
The Language in the report unit (in Jaspersoft Studio) is set to groovy as it should be.