| Summary: | Nebula grid: UnsupportedOperationException after click on RWT hyperlink | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Thomas Hendel <hendel> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.0 | ||
| Target Milestone: | 3.0 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I don't understand how this is possible - index parameter to be "null" literal. If you look at Grid.ja#_fireSelectionChanged function there is a check if inxed is number or not. If it's not a number the index parameter is "undefined" (missing) and on the server-side it is null. Which RAP version are you using? Is it reproducible with RAP 3.0M2? It is reproducible in RAP 3.0M2; and I use the nebula grid that comes with RAP 3.0M2. OK... I can reproduce it with our Controls Demo -> Nebula Grid tab. In the debugger one can see this:
call stack:
GridOperationHandler.readIndex(JsonObject) line: 252
GridOperationHandler.handleNotifySelection(Grid, JsonObject) line: 182
GridOperationHandler.handleNotify(Grid, String, JsonObject) line: 69
GridOperationHandler.handleNotify(Control, String, JsonObject) line: 1
GridOperationHandler(ControlOperationHandler<T>).handleNotify(Widget, String, JsonObject) line: 1
GridOperationHandler(WidgetOperationHandler<T>).handleNotify(String, JsonObject) line: 51
ProtocolUtil.handleOperation(OperationHandler, Operation) line: 70
GridLCA(AbstractWidgetLCA).readData(Widget) line: 51
GridLCA.readData(Widget) line: 109
the JsonObject in GridOperationHandler.readIndex(JsonObject) looks like this:
{"item":"w141","detail":"hyperlink","index":null,"text":"303","button":1,"shiftKey":false,"ctrlKey":false,"altKey":false}
The "clientMessage" in GridLCA(AbstractWidgetLCA).readData(Widget) looks like this:
{"head":{"requestCounter":7},"operations":[["notify","w117","MouseUp",{"x":615,"y":295,"time":10849,"button":1,"shiftKey":false,"ctrlKey":false,"altKey":false}],["notify","w117","Selection",{"item":"w141","detail":"hyperlink","index":null,"text":"303","button":1,"shiftKey":false,"ctrlKey":false,"altKey":false}],["set","w1",{"cursorLocation":[615,295]}]]}
May be a bug in the creation of the JSON object?
It seems that in JavaScript isNaN( null ) returns false - null is considered as number. Fix is pending. Pending change: https://git.eclipse.org/r/#/c/35719/ Fixed in master with change https://git.eclipse.org/r/#/c/35719/ |
Activating RWT hyperlinks (myGrid.setData(RWT.MARKUP_ENABLED, Boolean.TRUE)) leads to an UnsupportedOperationException if the user clicks on such a hyperlink. The exception is thrown in GridOperationHandler.readIndex() (package org.eclipse.nebula.widgets.grid.internal.gridkit). The retrieved JSON value is not null. It is not a number, but a literal conatining "null" due to the parameters of the event fired in Grid.js, line 556: this._fireSelectionChanged( item, "hyperlink", null, text ); Changing the return statement in GridOperationHandler.readIndex() from return value == null ? 0 : value.asInt(); to return value == null || !value.isNumber() ? 0 : value.asInt(); would fix that. But I'm not surce whether it is ok this way...