Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321104

Summary: joint data set interprets numeric column name as column index
Product: z_Archived Reporter: Sven Rieckhoff <srieckhoff>
Component: BIRTAssignee: Lin Zhu <lzhu>
Status: RESOLVED WONTFIX QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, bugs.eclipse, mwu
Version: unspecified   
Target Milestone: 4.2.0 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Stacktrace of exception on Preview Results
none
sample report none

Description Sven Rieckhoff CLA 2010-07-28 06:09:33 EDT
Build Identifier: 2.6.0

If using a data set containing a numeric column name in a joint data set then the joint data set interprets the numeric column name as column index. This results in an exception if no such column index exist in data set.

Reproducible: Always

Steps to Reproduce:
1. Create a data set with a computed column named "123"
2. Create a joint data set, joining former data set to itself (join column and type are insignificant)
3. Preview results of joint data set

Expected result:
everythings works fine

Actual result:
Exception is thrown cause numeric column name is used as column index.
Comment 1 Sven Rieckhoff CLA 2010-07-28 06:10:30 EDT
Created attachment 175386 [details]
Stacktrace of exception on Preview Results
Comment 2 Sven Rieckhoff CLA 2010-07-28 06:13:08 EDT
Created attachment 175387 [details]
sample report

Attached a sample report with the erroneous joint data set.
Comment 3 Mingxia Wu CLA 2010-08-02 23:46:39 EDT
This is Rhino's behavior to handle "123" as 123,so currently we have no idea to check whether it means index or name.
Comment 4 Xiaoying Gu CLA 2012-03-26 22:35:42 EDT
*** Bug 375302 has been marked as a duplicate of this bug. ***
Comment 5 Lin Zhu CLA 2012-03-26 22:58:49 EDT
This is a rhino, BIRT can do nothing to it. Mark as won't fix.
Comment 6 T. Fischer CLA 2012-03-28 10:19:35 EDT
The Report Engine works fine generating the report. Why should the report generation work and - at the same time - the Data Set Preview Results not work, when a column has a "number" (like the string "7") as name?

Data Set Preview Results: I see no reason, why a Java program, which calls a Java-Script (and probably only with one method call as JavaScript: dataSetRow["<column name>"]), which then calls a Java-method again, cannot be written in pur Java instead. (see stacktrace in Bug 375302)

IMHO it is unlikely, that the Rhino-/JavaScript-implementation will be changed because of a BIRT problem. It seems to me more likely, that BIRT is not compliant to the LiveConnect- or parsing-specification of JavaScript:
Java Method Overloading and LiveConnect 3: http://www-archive.mozilla.org/js/liveconnect/lc3_method_overloading.html
http://jdk6.java.net/plugin2/liveconnect/#OVERLOADED_METHODS

Please reopen this issue.
Comment 7 Lin Zhu CLA 2012-03-28 13:29:21 EDT
Hey,

BIRT is using Rhino as its javascript engine. BIRT itself will not do javascript evaluation job.

Although the BIRT is java based, that not necessary means the script language used throughout the BIRT should be java. We use javascript because it is easy and popular. 

However, it is strange that report engine works fine while data set preview broken. Can you confirm that the report engine returns the correct value? Maybe that is because in your table you defined more data bindings than the number of column in data set, so that the index in your expression happen to locate some other columns?

Thanks.
Lin
Comment 8 T. Fischer CLA 2012-03-30 12:16:15 EDT
Please use attached RPT-Design in Bug 375302: NumberAsColumnName.rptdesign (Attachment 213169 [details])
- Data Set Preview Results causes an ArrayIndexOutOfBoundsException.
- The report preview with the same computed column works fine.

BTW: The problem also exists on output columns with a "number" as name (like the string "43").
The "index" is always reduced by 1, leading to the exception message "42".