Commit 5d4dfe51 authored by Tobias Thierer's avatar Tobias Thierer Committed by Naga Venkata Durga Ashok Mutyala
Browse files

Avoid I/O during DexPathList.Element.toString().

toString() was calling path.isDirectory(), which could be a StrictMode
violation (eg. on the main thread) and therefore trigger a failure.

This CL moves the check for path.isDirectory() from toString into the
constructors. Note that when dexFile == path == null, then toString()
will throw NPE both before and after this CL; invoking constructors
that allow this to happen is only possible via reflection; a follow-up
CL rules this out.

URL findResource(String name) continues to perform I/O, but that
(and I/O during construction) appears more reasonable than during
toString().

I plan to rely on empirical observation (after this CL is submitted)
rather than code analysis to confirm whether this CL is sufficient to
resolve the associated bugs.

Bug: 120099466
Bug: 77611513
CRs-Fixed:2542952
Test: Treehugger
Change-Id: I35a771f5891775e6dd77d98cbb09a18a85179e18
(cherry picked from commit d853723d)
parent b10f4494
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment