Home Analytics Designing reports
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Birt upgrade 4.3 to 4.5 Error in BirtStr.trim function

<p>We use <span style="font-size:8pt;font-family:'courier new';">BirtStr.trim function in all our reports and it is failing on 4.5 (Eclipse Mars).</span></p>
<p> </p>
<p><span style="font-size:8pt;font-family:'courier new';">Stack trace:</span></p>
<p> </p>
<p><span style="font-size:8pt;font-family:'courier new';">BirtStr.trim(fname+" "+lname)</span></p>
<p><span style="font-family:'courier new';"><span style="font-size:8pt;">org.mozilla.javascript.ConsString cannot be cast to java.lang.String<br>
   at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1245)<br>
   at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1224)<br>
   at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)<br>
   at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)</span></span><br>
 </p>
<p> </p>
<p>This code works fine in 4.3 version (luna eclipse)</p>
<p> </p>
<p> </p>
<p>When we change the code to use the BirtStr.concat function it works fine.</p>
<p><span style="font-family:'courier new';font-size:10.6667px;">BirtStr.trim(</span><span style="font-family:'courier new';font-size:10.6667px;">BirtStr.concat(</span><span style="font-family:'courier new';font-size:10.6667px;">fname," ",lname))</span></p>
<p> </p>
<p> </p>
<p><span style="font-size:10.6667px;">Effort of making code changes are really high. </span></p>
<p> </p>
<p>Any recommendations ?</p>
<p> </p>
<p> </p>
Tagged:

Comments

  • <p>Issue 1:</p>
    <p>BirtStr - all functions</p>
    <p> </p>
    <p><span style="font-family:'courier new';"><span style="font-size:8pt;">BirtStr.trim(fname+" "+lname)</span></span></p>
    <p> </p>
    <p>Error</p>
    <p><span style="font-size:8pt;font-family:'courier new';">org.mozilla.javascript.ConsString cannot be cast to java.lang.String</span></p>
    <p> </p>
    <p>Work around:</p>
    <p><span style="font-family:'courier new';font-size:10.6667px;">BirtStr.trim(</span><span style="font-family:'courier new';font-size:10.6667px;">BirtStr.concat(</span><span style="font-family:'courier new';font-size:10.6667px;">fname," ",mname))</span></p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
  • <p>Hi,</p>
    <p> </p>
    <p>If you google the error message, you'll find out that with Rhino 1.7.4, now included in BIRT 4.5, Rhino has changed substantially how it handles Java to Javascript object conversion. I don't know of a workaround, except changing the way you concatenate strings.</p>
    <p> </p>
    <p>Hope this helps,</p>
    <p> </p>
    <p>P.</p>

    Pierre Richer

    Solutions Consultant, Analytics & Reporting

    OpenText

     

Sign In or Register to comment.