You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
api-impl/android/content/res/AssetManager.java: fix lack of throwing exception on failure
ClassLoader.getResourceAsStream() eats the IOException, so we need to throw a new one when it returns null. We also report the errno we got from openAsset.
This commit is contained in:
@@ -343,7 +343,11 @@ public final class AssetManager {
|
||||
}
|
||||
}
|
||||
// alternatively load directly from APK
|
||||
return ClassLoader.getSystemClassLoader().getResourceAsStream("assets/" + fileName);
|
||||
InputStream ret = ClassLoader.getSystemClassLoader().getResourceAsStream("assets/" + fileName);
|
||||
if(ret == null)
|
||||
throw new FileNotFoundException("Asset file: " + fileName + ", errno: " + asset);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public final AssetFileDescriptor openFd(String fileName)
|
||||
|
||||
Reference in New Issue
Block a user