jasper-reports

in Jasper report we are getting error 1. String literal is not properly closed by a double-quote


When generating the report we are getting

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/myapp] threw exception [Request processing failed; nested exception is com.openpayment.api.service.ApplicationException: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. String literal is not properly closed by a double-quote
                value = ((net.sf.jasperreports.engine.JasperReport)parameter_subreportA5.getValue())"; //$JR_EXPR_ID=15$
                                                                                                    <------------------>

the JRXML was:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.2.final using JasperReports Library version 6.21.2-8434a0bd7c3bbc37cbf916f2968d35e4b165821a  -->
<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="MobileA4Main" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="fd3c50b8-f0bb-4689-b77c-a028f0955fe4">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="name" class="java.lang.String">
        <defaultValueExpression><![CDATA["NAME"]]></defaultValueExpression>
    </parameter>
    <parameter name="account" class="java.lang.String">
        <defaultValueExpression><![CDATA["11111"]]></defaultValueExpression>
    </parameter>
    <parameter name="url" class="java.lang.String">
        <defaultValueExpression><![CDATA["https://google.com"]]></defaultValueExpression>
    </parameter>
    <parameter name="subreportA5" class="net.sf.jasperreports.engine.JasperReport">
<!--        <defaultValueExpression><![CDATA["https://google.com"]]></defaultValueExpression>-->
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="665" splitType="Stretch">
            <subreport>
                <reportElement x="0" y="0" width="420" height="595" uuid="b96f6247-8f25-40be-b361-d70f8dd8db5a">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <subreportParameter name="name">
                    <subreportParameterExpression><![CDATA[$P{name}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="url">
                    <subreportParameterExpression><![CDATA[$P{url}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="account">
                    <subreportParameterExpression><![CDATA[$P{account}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{subreportA5}"]]></subreportExpression>
            </subreport>
            <frame>
                <reportElement x="0" y="0" width="420" height="595" uuid="fe3ca5d8-c38f-4db1-b753-b55ffb832061"/>
                <box>
                    <pen lineWidth="0.5" lineStyle="Dashed"/>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.5" lineStyle="Dashed" lineColor="#000000"/>
                    <rightPen lineWidth="0.5" lineStyle="Dashed" lineColor="#000000"/>
                </box>
            </frame>
        </band>
    </title>
</jasperReport>

Solution

  • The reason was " in

    <subreportExpression><![CDATA[$P{subreportA5}"]]></subreportExpression>
    

    After removing it, the error has gone.