Android Question Error with httpjob on some devices

djmainero

Member
Licensed User
Hello!
I uploaded my app to google play and when testing in some devices i get this error
java.io.FileNotFoundException: /data/data/com.sysoluciones.micoop/cache/1: open failed: ENOENT (No such file or directory):
FATAL EXCEPTION: main
java.io.FileNotFoundException: /data/data/com.sysoluciones.micoop/cache/1: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:409)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:215)
    at com.sysoluciones.micoop.httpjob._getstring2(httpjob.java:290)
    at com.sysoluciones.micoop.httpjob._getstring(httpjob.java:279)
    at com.sysoluciones.micoop.b4xmainpage$ResumableSub_GetCooperativas.resume(b4xmainpage.java:734)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1178)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5419)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:393)
    ... 17 more
In this case the error is on Galaxy S3 (SDK 18)

What could be causing it?

Thanks in advance!
 

djmainero

Member
Licensed User
Thanks for the response

I'am checking that
B4X:
Dim JobString As String
    Dim cadena As Map
    cadena.Initialize
    cadena.Put ("Accion", "GetCooperativas")
    
    Glo.lCooperativas.Initialize
    ht.Ejecuta(Me, cadena, Glo.sysURL)
    Wait For JobDone(Job As HttpJob)
    If(Not(Job.Success)) Then ' <- Here
        Return False
    End If
    JobString = Job.GetString
    Job.Release
    Dim su As StringUtils
    Dim b() As Byte
    b = su.DecodeBase64(JobString)
    Glo.lCooperativas = fCom.decoJSON3(BytesToString(b, 0, b.Length, "UTF8"))

ht.Ejecuta:
Sub Ejecuta(Act As Object, cadena As Map, url As String)
    Dim j As HttpJob
    j.Initialize("j", Act)
    j.PostString(url, fCom.encoJSON(cadena))
    j.GetRequest.SetContentType("application/json")
    j.GetRequest.SetHeader("Authorization", Glo.Bearer)
    j.GetRequest.Timeout = 20000
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Upvote 0

Erel

Administrator
Staff member
Licensed User
You are NOT releasing the job in case it is false.
That's true and it should be fixed, but it is not the cause of this error.

Not elegant:
B4X:
Dim cadena As Map
    cadena.Initialize
    cadena.Put ("Accion", "GetCooperativas")
Elegant:
B4X:
Dim cadena As Map = CreateMap("Accion": "GetCooperativas")

The error is probably here:
B4X:
 Wait For JobDone(Job As HttpJob)
The explanation is in the resumable subs video tutorial: https://www.b4x.com/etp.html

Correct code: https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345/
 
Upvote 0
Top