Android Question java.io.FileNotFoundException: xxx: open failed: ENOENT (No such file or directory)

AHilberink

Well-Known Member
Licensed User
Longtime User
Hi,

On my HttpJob - Post I got an error message:
B4X:
httputils2service_hc_responsesuccess (java line: 172)
java.io.FileNotFoundException: /data/data/b4a.werkbonnen/cache/7: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:456)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
    at b4a.werkbonnen.httputils2service._hc_responsesuccess(httputils2service.java:172)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.BA$2.run(BA.java:338)
    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:6134)
    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)
    ... 15 more
java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/b4a.werkbonnen/cache/7: open failed: ENOENT (No such file or directory)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:216)
    at anywheresoftware.b4a.BA$2.run(BA.java:338)
    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:6134)
    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: java.io.FileNotFoundException: /data/data/b4a.werkbonnen/cache/7: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:456)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
    at b4a.werkbonnen.httputils2service._hc_responsesuccess(httputils2service.java:172)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    ... 9 more
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)
    ... 15 more

It is on the Post command and it never reaches the JobDone event.

Can someone help what is going wrong?

Thanks.

Best regards,
André
 

AHilberink

Well-Known Member
Licensed User
Longtime User
Hi KMatle and Erel,

It seems to do something with the TempFolder = of the HttpUtils2Service.

TempFolder = File.DirInternal
or
TempFolder = File.DirInternalCache
gives the error.

Changing it to
TempFolder = File.DirRootExternal
It works fine.

What could this be?
In the past it worked fine, but could it be lost somewhere on the newer releases of B4A which I overlooked?

Best regards,
André
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I think you removed the try/catch and try to process a failed download.

Are you sure the url used in the request returns valid data?
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Upvote 0
Top