Skip to content

Fix "A resource failed to call close." warnings.

Hugh Daschbach requested to merge hdasch/funkwhale-android:missing-close into develop

The leaking resource is the BufferedReader returned from FFACache.get(). This is called from several places, most often to read one or all lines of a file.

Add getLine/getLines to FFACache to return the needed line or lines, closing the BufferedReader in the FFACache module. Where the BufferedReader itself is needed (Repository.fromCache), ensure the BufferedReader is closed after use.

The offending resource was identified with:

StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder(). detectLeakedClosableObjects().penaltyLog().build())

-- This is not a crucial fix. But it does clean up some warning is logcat output. Seems "the right thing to do."

Merge request reports

Loading