Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » There are errors evaluating script(Possible JavaScript error in report)
icon4.gif  There are errors evaluating script [message #996764] Wed, 02 January 2013 21:11 Go to next message
John Stewart is currently offline John StewartFriend
Messages: 4
Registered: January 2013
Junior Member
I have been assigned to clean up a project for a client that uses BIRT reporting. I have fixed most of the issues but I still have one report that is not working and is returning an error. The error is:

Row (id = 1467): 
+ There are errors evaluating script "var fileName = row["Attached_File"];
params["HyperlinkParameter"].value = ImageDecoder.decodeDocs(row["Ecrash_Attach"],fileName);":
Wrapped java.lang.NullPointerException (/report/body/table[@id="61"]/detail/row[@id="70"]/cell[@id="71"]/grid[@id="1460"]/row[@id="1462"]/cell[@id="1463"]/table[@id="1464"]/detail/row[@id="1467"]/method[@name="onCreate"]#2)


I can post the full stack trace if someone wants it but for now I will omit it since it is very long.

Here is the source of the decodeDocs method:

public static String decodeDocs(byte[] source, String fileName) {
        String randName = "";
        byte[] docSource = null;
        if ( Base64.isArrayByteBase64(source) ){
            docSource = Base64.decodeBase64(source);
        }
        documentZipPath = writeByteStreamToFile(source);
        randName = writeByteStreamToFile(docSource, fileName);
        return randName;
    }


I am pretty well lost on this one. The error looks to be telling me there is an error on line two of the script which is:

var fileName = row["Attached_File"];
params["HyperlinkParameter"].value = ImageDecoder.decodeDocs(row["Ecrash_Attach"],fileName);


This is written in the OnCreate method of the report. Any help, even clues would be greatly appreciated. If you would like to see the report just ask and I will post the xml for it.
Re: There are errors evaluating script [message #997128 is a reply to message #996764] Thu, 03 January 2013 20:30 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1663
Registered: July 2009
Senior Member

Can you post the full stack? You can probably put it in a text file and attach it to keep from expanding the post.

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: There are errors evaluating script [message #997129 is a reply to message #997128] Thu, 03 January 2013 20:35 Go to previous messageGo to next message
John Stewart is currently offline John StewartFriend
Messages: 4
Registered: January 2013
Junior Member
Sure thing, please find attached the full stack
Re: There are errors evaluating script [message #997132 is a reply to message #997129] Thu, 03 January 2013 20:59 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1663
Registered: July 2009
Senior Member

Do you possibly have any null values or special characters or something that are being passed to the file writer?

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: There are errors evaluating script [message #997216 is a reply to message #997132] Fri, 04 January 2013 13:53 Go to previous messageGo to next message
John Stewart is currently offline John StewartFriend
Messages: 4
Registered: January 2013
Junior Member
I don't think so. To me this script looks like it is getting an image file name that is in the current data. This is obtained by passing in an ID number associated with the table. I think this is then passed in to the decode method so that it can be viewed. I also thought something was null but the only things that could be null would be the ID or the possible absence of an image in the row. I went to the database and checked the table and the image is there for sure. The report will populate the text data so the ID number is getting passed successfully, it is only this script which handles the image that is not working.
Re: There are errors evaluating script [message #997266 is a reply to message #997216] Fri, 04 January 2013 20:17 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1663
Registered: July 2009
Senior Member

So, no values in the row["Attached_File"] field have null values? I still would say the error is suggesting something along these lines. You might look into the line where writeByteStreamToFile is called without a fileName, yet the line below it has one. I don't know the code behind the function, so I don't know if this is handled.

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Previous Topic:Opening a hyperlink
Next Topic:Not able to see data in Web Service Data Source
Goto Forum:
  


Current Time: Thu Nov 27 08:47:25 GMT 2014

Powered by FUDForum. Page generated in 0.02757 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software