Android Question [SOLVED] job.GetString - open failed: ENOENT (No such file or directory)

nicejoinworlds

Member
Licensed User
Longtime User
Hello there!

with this code:

B4X:
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
   Log("ExecuteRemoteQuery: " & Query & " TaskID:" &  TaskId)
   If TaskId = 1 Then
     Dim job As HttpJob
     job.Initialize(TaskId, Me)
     job.Download2("http://www.domain.com/tareas/app1.php", Array As String("cadena", Query))

   Else
     Dim job As HttpJob
     job.Initialize(TaskId, Me)
     job.Download2( "http://www.domain.com/tareas/app-1.php",  Array As String("cadena", Query))

   End If

End Sub


Sub JobDone(job As HttpJob)

   Log("Back from Job:" & job.JobName )

  If job.Success = True Then

     Log("Job:" & job.JobName & "Success OK" )
     Dim res As String
     res = job.GetString
     Log("Response from server: " & res)

     Dim parser As JSONParser
     parser.Initialize(res)

     Select job.JobName
       ....
     End Select
  Else

    Log("Error: " & job.ErrorMessage)
  End If
  job.Release
End Sub


Show the next error:

B4X:
Back from Job:1
Job:1Success OK
gpsservice_jobdone (B4A line: 401)
res = job.GetString
java.io.FileNotFoundException: /data/data/aplus.phones.android.personal/cache/1: open failed: ENOENT (No such file or directory)
   at libcore.io.IoBridge.open(IoBridge.java:456)
   at java.io.FileInputStream.<init>(FileInputStream.java:76)
   at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
   at anywheresoftware.b4a.samples.httputils2.httpjob._getstring2(httpjob.java:167)
   at anywheresoftware.b4a.samples.httputils2.httpjob._getstring(httpjob.java:156)
   at aplus.phones.android.personal.gpsservice._jobdone(gpsservice.java:702)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
   at anywheresoftware.b4a.keywords.Common$5.run(Common.java:981)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5312)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
   at libcore.io.Posix.open(Native Method)
   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
   at libcore.io.IoBridge.open(IoBridge.java:442)
   ... 17 more

If I check the /data directory is empty: No folders, no files

thanks in advance
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Use code Tags when Posting code use Quote Tags when Posting logs
 
Upvote 0

nicejoinworlds

Member
Licensed User
Longtime User
I rewrite the code to know exactly when I generate a JOB and finally, the real problem was that job.GetString show the error [open failed: ENOENT (No such file or directory)] if the job not return nothing.
I soved it asking job.GetString inside of the [Select Case] if I wait somthing

B4X:
Sub JobDone(job As HttpJob)
   
    Log("Back from Job: " & job.JobName )
    Dim res As String
   
   If job.Success = True Then

    Log("Job:" & job.JobName & " Success OK" )

    Select job.JobName
                   
        Case A 'no waiting answer form the job execute
                       ....

        Case B 'waiting answer form the job execute
            res = job.GetString
            Log("Response from server: " & res)
...
 
Upvote 0
Top