B4J Question [jTableViewExtended] unexpected behavior in release

Lahksman

Active Member
Licensed User
Longtime User
Getting some strange behavior (dunno if it's my behavior or the tableview).

If i run following code in debug mode, everything works as expected but in release (not obfuscated) i'm getting a NullPointerException.

B4X:
Sub Row_MouseClicked (EventData As MouseEvent)
    If EventData.ClickCount > 1 Then
        Try
            Log("EventData: " & EventData)
            SQL1 = mDBaseConnector.ConnectToDBase("com.mysql.jdbc.Driver","jdbc:mysql://...")
            Dim cur As ResultSet
            Dim objGame As cGames
            objGame.Initialize
            Dim Row As TableRow = Sender
            Log("Row: " & Row)
            Log("Row index; " & Row.Index)
            Dim Items() As Object = exttvDocknode1Games.Items.Get(Row.Index)
            Log("item 0 :" & Items(0))
...
This gives me the following log in release
B4X:
EventData: (MouseEvent) MouseEvent [source = TableRow@42f4026e[styleClass=cell indexed-cell table-row-cell]'null', target = Text[text="07/01/2017", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=15.0], fontSmoothingType=LCD, fill=0xffffffff], eventType = MOUSE_CLICKED, consumed = false, x = 206.0, y = 14.0, z = 0.0, button = PRIMARY, clickCount = 2, pickResult = PickResult [node = Text[text="07/...Sender: null
Row: null
(NullPointerException) java.lang.NullPointerException

and following log in debug
B4X:
EventData: (MouseEvent) MouseEvent [source = TableRow@400915ee[styleClass=cell indexed-cell table-row-cell]'null', target = TableColumn$1$1[id=null, styleClass=cell indexed-cell table-cell table-column]'20', eventType = MOUSE_CLICKED, consumed = false, x = 311.0, y = 18.0, z = 0.0, button = PRIMARY, clickCount = 2, pickResult = PickResult [node = TableColumn$1$1[id=null, styleClass=cell indexed-cell table-cell table-column]'20', point = Point3D [x = 39.0, y = 18.0, z = 0.0], distance = 1974.2548...Sender: flm.b4j.tableviewextended.RowWrapper@541e767a
Row: flm.b4j.tableviewextended.RowWrapper@541e767a
Row index; 1
item 0 :2
 

Lahksman

Active Member
Licensed User
Longtime User
Comment out the Try / Catch and post the full error message.

It doesn't look like the best design to connect to the database from the click event.
The database connector was only in there for testing purpose.

Removed the try / catch (did it before already) but still the same result. This in in the log (release mode).
B4X:
EventData: (MouseEvent) MouseEvent [source = TableRow@58a6e3c3[styleClass=cell indexed-cell table-row-cell]'null', target = TableColumn$1$1[id=null, styleClass=cell indexed-cell table-cell table-column]'23', eventType = MOUSE_CLICKED, consumed = false, x = 252.0, y = 15.0, z = 0.0, button = PRIMARY, clickCount = 2, pickResult = PickResult [node = TableColumn$1$1[id=null, styleClass=cell indexed-cell table-cell table-column]'23', point = Point3D [x = 60.0, y = 15.0, z = 0.0], distance = 1317.4139...
Sender: null
Row: null
frmdashboard._row_mouseclicked (java line: 789)
java.lang.NullPointerException
    at b4j.example.frmdashboard._row_mouseclicked(frmdashboard.java:789)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    at flm.b4j.tableviewextended.RowFactory.lambda$0(RowFactory.java:43)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
    at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:380)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:416)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:415)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)
 
Upvote 0
Top