Android Question Error DirInternalCache

Giovanni Passali

Member
Licensed User
Longtime User
My app download images from my server.
I want to save image in a directory, check if I have this image and download only new images.
I know how save image and I see the image I've downloaded (or read from file) but now (after 20 seconds!?) I have an error.
B4X:
** Service (check2receive) Start **
** Service (check2receive) Start **
** Service (check2receive) Start **
java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/com.xxxwww.demo/cache/6: open failed: EISDIR (Is a directory)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
    at anywheresoftware.b4a.BA$3.run(BA.java:320)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4476)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:583)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.FileNotFoundException: /data/data/com.xxxwww.demo/cache/6: open failed: EISDIR (Is a directory)
    at libcore.io.IoBridge.open(IoBridge.java:406)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
    at anywheresoftware.b4a.samples.httputils2.httputils2service._hc_responsesuccess(httputils2service.java:130)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    ... 10 more
Caused by: libcore.io.ErrnoException: open failed: EISDIR (Is a directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:390)
    ... 16 more
I tried to remove from my code any reference to DirInternalCache (now I use DirInternal) but happens the same error!
 

Giovanni Passali

Member
Licensed User
Longtime User
No problem with JobDone.
I solved: I cleaned the cache (in Settings Application) and then no more crash.
I didn't understand, but now no more crash and I can see the image, from filesystem o from download (if not present in filesystem).
My question is: when I save in DirInternal, Android saves for a moment in DirInternalCache?
And why after 20 seconds crashes, after I see the image? DirInternalCache temporarily corrupted?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top