B4J Question java.lang.reflect.InvocationTargetException if to make CallSub2

peacemaker

Expert
Licensed User
Longtime User
Hi, All

A class has internal HTTP requests and with callbacks:
B4X:
Sub handleRequestUploadPath(Job As HttpJob, res As String)
    Dim parser As JSONParser
    parser.Initialize(res)
    Dim root As Map = parser.NextObject
    root.Put("Tag", Job.Tag)
    If SubExists(Me, "meyadisk_RequestUploadPath") Then
        CallSub2(Me, "meyadisk_RequestUploadPath", root)    'ME - it's the class itself
    End If
End Sub

And in DEBUG mode sometimes i have error in this CallSub2 line:

Error occurred on line: 245 (yadisk)
java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:482)
at peacemaker.dnngrabber.yadisk$ResumableSub_handleRequestUploadPath.resume(yadisk.java:733)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
at jdk.internal.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:96)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1046)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:134)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:81)
... 27 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:40)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:154)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:110)
... 28 more
Mostly all works OK.
But sometimes is this error, what does it mean ? The class itself always exists...
 
Last edited:
Top