Jump to content
  • [JasperReports] Wrong method resolution when calling msg() with more than 3 parameters

    CategoryBug report

    In a jrxml file, the method formatting msg() raise exceptions when using more than 3 parameters, because it is resolved to the wrong declaration of the msg() method.

    Replacing all msg() method declarations with a varargs method fixes the problem (see patch attached).

    User Feedback

    Recommended Comments

    Changed Resolution from Fixed to Reopened

    Changed Assigned User from @teodord to -

    Hi Teodor,it looks like this changes is breaking old compiled, i.e. *.jasper, Java reports that use the msg function.For example I have an jasper file compiled with JasperReports 6.2.2 and this reports includes a field with:msg($R{pageFooter}, $V{CURRENT_PAGE_NUMBER}, $V{PAGE_NUMBER})An since this is the compiled with language Java it is statically bound to the function signature:msg(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;Till JasperReports Library version 6.10 this worked well.But with 6.12.1 this fails with:net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: msg($R{pageFooter}, $V{CURRENT_PAGE_NUMBER}, $V{PAGE_NUMBER})... Stack trace ...Caused by: java.lang.NoSuchMethodError: Departments_1412358499713_8295.msg(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String; at Departments_1412358499713_8295.evaluate(Departments_1412358499713_8295:463) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:259) ... 50 moreI guess it fails because the function definitions for explicitly one, two and three Object parameters were removed:https://github.com/TIBCOSoftware/jasperreports/commit/3092bb0b5609b385dc8144735243a1d1b438adb6Would it be a good idea to include them (again) so that older compiled reports still work?Regards,Michael
    Link to comment
    Share on other sites

    Changed Resolution from Reopened to Fixed

    Changed Assigned User from - to @teodord

    Hi,This has been fixed on the master branch at Github:https://github.com/TIBCOSoftware/jasperreports/commits/masterCan you build a snapshot out of it and let us know if it works for you?Thanks,Teodor
    Link to comment
    Share on other sites

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...