[#5202] - In XML jasperReport tag, language selected is groovy, even if you select Java or JavaScript.

Category:
Bug report
Priority:
Normal
Status:
Assigned
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

In the generated XML, language="groovy" even if you select a different language. Then, then you use the compiled report, the application throws an exception because it needs the groovy jar. I don't want this jar added to my application, but the only way to avoid that is changing the language manually in the XML.

vtommasi's picture
Joined: Apr 25 2011 - 5:35am
Last seen: 11 years 7 months ago

8 Comments:

#1

vtommasi, please add more details.
iReport does not behave as you describe for me. Changing the language to Java or Groovy or JavaScript works as expected. After saving the report I see, for example, language="javascript".

So it must be a somewhat unusual situation. Please provide exact version of iReport, Java, OS, and provide your step-by-step instructions for observing the behavior.

#2

-This is the info in Help/About:

Product Version: Jaspersoft iReport Designer 4.0.2
Java: 1.6.0_24; Java HotSpot(TM) Server VM 19.1-b02
System: Linux version 2.6.35-28-generic running on i386; UTF-8; en_US (ireport)
Userdir: /home/proda/.ireport/4.0.2

-Steps:

1. File/New/Report/Blank Letter/Open this Template
2. Next
3. Finish

Then, checking in the "XML" tab, in the <jasperReport> tag it says: language="groovy".

This is the same output, with this options in Tools/Options/General/Language:
-<Template Default>
-Java
-Goovy
-JavaScript

Changing this options, generates the same xml:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report6" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>

#3

Same thing happens to me using Win XP.

Product Version: Jaspersoft iReport Designer 4.0.2
Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b013
System: Win XP running on i386; UTF-8; en_US (ireport)

See: http://i54.tinypic.com/j633lw.jpg

#4

Ahh... I see. It's an issue about iReport preferences. The blank template has its language set to Groovy. You create a new report and want iReport to ignore this and use Java instead.

It's not related to the report XML. You can see the same fact in the Designer view.

It seems like a valid bug. If you change the language preference from <Template Default> to Java then this ought to be respected.

But it's quite minor. It only takes a couple of clicks to set the report language to Java. Or just change the language in the template so you get what you want by default.

#5

Yes, the issue is about the Preferences window not respecting what the user sets the Language to, but it is also about what happens when you create a new report using any template. If you go to the Preferences window right after creating a new report the Language field shows "Java", but if you switch to the XML view the language attribute is set to "Groovy".

This makes it very confusing and hard to track for beginners who are not familiar with jrxml syntax.

Also, making the templates' default language groovy adds another difficulty for new users. Being JasperReports a Java reporting engine, I think a common setup for a parent application could not include the Groovy JAR (which is +5MB), causing the reports created with iReport to be unable to run.

#6

The default language option is no longer used and I will remove it in the next version. The language is set by default in the template. iReport does not change it because the template may already include many expressions written in a specific language.
On the other side, if you really want to change the language, just change it in the report (or even inside the template files).

Said that, I STRONGLY suggest to use groovy, since it is powerful as java, but at the same time allows the use of much simpler expressions, preventing errors, null pointer exceptions, and so on.

5+Mb is not that much considering the time groovy can let you save in writing any kind of report expression.

Giulio

#7

Thanks for the reply and suggestion.

So, even if I choose not to use groovy and stick to Java reports (a valid configuration for JasperReports in a parent app) as I've been using up to now I'm forced to include the groovy jar just in case a new iReport user downloads the designer and creates a report that he thinks is using Java.

#8

Why do you feel you are forced to? You are not forced, it's for your users convenience that you will add support for Groovy expressions ;-)

Anyway I got your point, and actually the initial porpuse of the combo box to select the default language was introduced when we slowly started pushing the use of Groovy.
We had a problem of reports compatibility similar to your one when we did not support Groovy out of the box on JasperReports Server (years ago).

I'll think about improving that default language.

Feedback