Hi,
I am fire a number of post (3) to the server and the first 2 get a postive result in the job_done but the last one get a java error:
I have modified the HttpUtils2Service to receive the status code:
This is my posting code (the param is just a JSON string)
This is part of my job_done code:
As I said the first post 2 post of the 3 works well and the last failed with the above java error.
Any one an Idea where to look? it looks like a file is deleted that shouldn't be deleted
I am fire a number of post (3) to the server and the first 2 get a postive result in the job_done but the last one get a java error:
B4X:
1462615841326: Posted data
1462615841335: Push:2
1462615842011: Posted data
** Service (locationservice) Start **
Start Service
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
1462615842471: JobName = PostSPData, Success = true, Err =
1462615842475: Posted Return ->201
1462615842491: JobName = PostSPData, Success = true, Err =
1462615842494: Posted Return ->201
Error occurred on line: 168 (HttpJob)
java.io.FileNotFoundException: /data/data/com.cyclonesoftware/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 com.cyclonesoftware.httpjob._getstring2(httpjob.java:338)
at com.cyclonesoftware.httpjob._getstring(httpjob.java:78)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
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:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
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)
... 21 more
I have modified the HttpUtils2Service to receive the status code:
B4X:
Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Dim job As HttpJob = TaskIdToJob.Get(TaskId)
job.Tag = Response.StatusCode
Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _
True, TaskId)
End Sub
This is my posting code (the param is just a JSON string)
B4X:
job.PostString(URLPost,param)
job.GetRequest.SetContentType("application/json")
job.GetRequest.Timeout = 60000
This is part of my job_done code:
B4X:
Helpers.NLog("Posted Return ->" & job.Tag)
If job.Tag=201 Then
Dim res As String = job.GetString
db.ExecNonQuery2("update Reports Set SendedToBase=1 where id=?", Array As Int(res))
Helpers.LastReportSent(db)
End If
As I said the first post 2 post of the 3 works well and the last failed with the above java error.
Any one an Idea where to look? it looks like a file is deleted that shouldn't be deleted