Bug? nextobject hangs

dcoun

Member
Licensed User
Longtime User
Hi
B4X:
s=$" { "test":{ "as":"1"  } }"$
                Try
                Dim jj As JSONParser
                Log(s) : jj.Initialize(s) 
                Log(jj)
                Log(jj.IsInitialized)
                dim a as map
                a=jj.nextobject
                Catch : Log(LastException) : End Try
code hangs as jj.nextobject. If I stop debugger I get the red errors following:
*** Service (starter) Create ***
** Service (starter) Start **
0
{ "test":{ "as":"1" } }
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
(JSONTokener) at character 0 of { "test":{ "as":"1" } }
true
java.lang.RuntimeException: java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:175)
at anywheresoftware.b4a.BA$2.run(BA.java:365)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6186)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
... 8 more
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:151)
at java.net.SocketInputStream.read(SocketInputStream.java:120)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
at java.io.DataInputStream.readByte(DataInputStream.java:268)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:353)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
... 12 more
 

DonManfred

Expert
Licensed User
Longtime User
See this tool for help parsing a jjon
http://basic4ppc.com:51042/json/index.html

B4X:
Dim parser As JSONParser
parser.Initialize($" { "test":{ "as":"1"  } }"$)
Dim root As Map = parser.NextObject
Dim test As Map = root.Get("test")
Dim as As String = test.Get("as")
 

dcoun

Member
Licensed User
Longtime User
To my B4A 8.3 it hangs with 2 different devices
In emulators I get
adb: failed to install myprogram_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries
 

dcoun

Member
Licensed User
Longtime User
It was a case in a select inside a for/next loop.
I put the above code outside
it still hangs and when I Stop the debuging I am getting:
java.net.SocketException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:542)
at libcore.io.IoBridge.sendto(IoBridge.java:511)
at java.net.PlainSocketImpl.write(PlainSocketImpl.java:500)
at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:85)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:88)
at java.io.DataOutputStream.flush(DataOutputStream.java:63)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:760)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at medsite.mypatients.starter.onCreate(starter.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2877)
at android.app.ActivityThread.access$1900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.system.ErrnoException: sendto failed: EBADF (Bad file descriptor)
at libcore.io.Posix.sendtoBytes(Native Method)
at libcore.io.Posix.sendto(Posix.java:211)
at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
at libcore.io.IoBridge.sendto(IoBridge.java:509)
 

Cableguy

Expert
Licensed User
Longtime User
it works now, but I changed nothing and I do not why it works now
My bet is, when you stop the debugger and then restart the compilation, the IDE makes a "clean-up" of the cached "start-pause-resume" action and cleans up any "trash" info left behind...
 

dcoun

Member
Licensed User
Longtime User
To be honest, I restarted many times the B4A IDE. I did not restart the b4A bridge. But it was fixed, after taking a walk
 
Top