Android:uncatchable ErrnoException

时间:2016-03-15 07:54:18

标签: android

我有一段代码:

            try {
                it.write()
            } catch (e : ErrnoException) {
                Logger.d("Playlist ${location.parentFile} could not be saved:", e)
            } catch (e: Exception) {
                Logger.d("Playlist ${location.parentFile} could not be saved:", e)
            } catch (e: Error) {
                Logger.d("Playlist ${location.parentFile} could not be saved:", e)
            } finally {
                try {
                    it.close()
                } catch (ex: Exception) {
                }
                isSaveNeeded = false
            }

似乎应该抓住所有可能的东西。然而我的应用程序崩溃了: Fatal Exception: java.io.FileNotFoundException: /storage/emulated/0/xenoamp/SCRATCH.m3u8: open failed: EACCES (Permission denied) at libcore.io.IoBridge.open(IoBridge.java:452) at java.io.FileOutputStream.(FileOutputStream.java:87) at java.io.FileOutputStream.(FileOutputStream.java:72) at pl.qus.io.XenoFileOutputStream.(SourceFile:36) at pl.qus.xenoamp.structures.PlaylistFiled.save(SourceFile:486) at pl.qus.xenoamp.xenoservice.XenoAmpService$onEventBackgroundThread$1.run(SourceFile:1304) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:224) at android.os.HandlerThread.run(HandlerThread.java:61) Caused by android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Posix.open(Posix.java) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) at libcore.io.IoBridge.open(IoBridge.java:438) at java.io.FileOutputStream.(FileOutputStream.java:87) at java.io.FileOutputStream.(FileOutputStream.java:72) at pl.qus.io.XenoFileOutputStream.(SourceFile:36) at pl.qus.xenoamp.structures.PlaylistFiled.save(SourceFile:486) at pl.qus.xenoamp.xenoservice.XenoAmpService$onEventBackgroundThread$1.run(SourceFile:1304) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:224) at android.os.HandlerThread.run(HandlerThread.java:61)

它开始突然发生(可能是对Android ibraries的另一次更新)。知道怎么抓住这个例外吗?我的应用程序在清单中具有所有必需的读/写权限,并在运行时为> KitKat请求它们。

Android 4,5和6上发生错误。

0 个答案:

没有答案