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

Bug 505710

Summary: [Table][Tree] Client side error on touch event when no items exist
Product: [RT] RAP Reporter: Sebastian Habenicht <dev>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan, mknauer
Version: 3.1   
Target Milestone: 3.2 M3   
Hardware: PC   
OS: Android   
See Also: https://git.eclipse.org/r/#/c/83190/
Whiteboard: sr312

Description Sebastian Habenicht CLA 2016-10-11 09:04:32 EDT
When a table or tree with no items receives a touch event, a client side error occurs: "Cannot read property 'getOffset' of undefined"

Reproduceable since 3.1.0-RC1 on android tablet and smartphone with chrome and the on-board-browser app:

protected void createContents(final Composite parent) {
    final Table table = new Table(parent, SWT.BORDER);
    table.setLayoutData(new GridData(200, 100));
    // new TableItem(table, SWT.NONE); // no error when item is created
}
Comment 1 Ivan Furnadjiev CLA 2016-10-11 09:15:09 EDT
Could you provide the complete error stack trace/details?
Comment 2 Sebastian Habenicht CLA 2016-10-11 09:58:36 EDT
Sure - this is what firebug-lite shows (using 3.1.0-RC1):

TypeError: Cannot read property 'getOffset' of undefined
    at Object._getScrollYOffset (http://10.0.20.5:62721/rwt-resources/310/rap-client.js:61171:32)
    at Object._initVirtualScroll (http://10.0.20.5:62721/rwt-resources/310/rap-client.js:61127:43)
    at Object._handleTouchStart (http://10.0.20.5:62721/rwt-resources/310/rap-client.js:61029:12)
    at Object._onTouchEvent (http://10.0.20.5:62721/rwt-resources/310/rap-client.js:60966:18)
    at HTMLBodyElement.<anonymous> (http://10.0.20.5:62721/rwt-resources/310/rap-client.js:624:17)

I simply started the application with the example code above in the entry point and touched the table without doing anything else. Hope, this helps. 

BTW: Adding a TableColumn does not make a difference (that's why I omitted it in the example code).
Comment 3 Ivan Furnadjiev CLA 2016-10-11 10:05:26 EDT
Please try RAP 3.1 final release. I believe it's fixed there.
Comment 4 Sebastian Habenicht CLA 2016-10-12 02:29:25 EDT
No, it's not. I actually came up against it using 3.1.1 and just tried the older builds to provide the information since when the error exists (that's why I wrote 'Reproduceable since 3.1.0-RC1...' - sorry, if that was misleading). So it is still in 3.1.0 and 3.1.1. The stack trace is the same for all these builds.
Comment 5 Ivan Furnadjiev CLA 2016-10-14 05:43:59 EDT
Fixed with change https://git.eclipse.org/r/#/c/83190/
Comment 6 Sebastian Habenicht CLA 2016-10-14 05:57:16 EDT
Thank you - it would be great to have this fix in the service release 3.1.2. Do you think this is possible?
Comment 7 Ivan Furnadjiev CLA 2016-10-14 06:42:28 EDT
(In reply to Sebastian Habenicht from comment #6)
> Thank you - it would be great to have this fix in the service release 3.1.2.
> Do you think this is possible?

Yes... It's a safe fix for backporting.