Skip to content

./gradlew check shows alot of "A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks." warnings

  • Device OS and version: LineageOs 17.1
  • Device model/manufacturer: Sony Xperia XZ1 Compact
  • F-Droid version (in the About screen): commit bd7cc2b7
  • F-Droid privileged extension version (if installed): yes

What did you do? (clear steps if possible)

  • checkout git master branch (sah1: bd7cc2b7)
  • ./gradlew clean
  • ./gradlew check (while device above is connected via adb)

What did you expect to see?

no warnings

What did you see instead?

alot of the following warnings:

System.logW: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'close' not called
        at dalvik.system.CloseGuard.$$robo$$dalvik_system_CloseGuard$open(CloseGuard.java:180)
        at jdk.internal.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.robolectric.shadows.ShadowCloseGuard$CloseGuardReflector$$Reflector11.open(Unknown Source)
        at org.robolectric.shadows.ShadowCloseGuard.open(ShadowCloseGuard.java:36)
        at dalvik.system.CloseGuard.open(CloseGuard.java)
        at android.database.CursorWindow.$$robo$$android_database_CursorWindow$__constructor__(CursorWindow.java:111)
        at android.database.CursorWindow.<init>(CursorWindow.java)
        at android.database.AbstractWindowedCursor.$$robo$$android_database_AbstractWindowedCursor$clearOrCreateWindow(AbstractWindowedCursor.java:198)
        at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java)
        at android.database.sqlite.SQLiteCursor.$$robo$$android_database_sqlite_SQLiteCursor$fillWindow(SQLiteCursor.java:138)
        at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java)
        at android.database.sqlite.SQLiteCursor.$$robo$$android_database_sqlite_SQLiteCursor$getCount(SQLiteCursor.java:132)
        at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java)
        at org.fdroid.fdroid.Assert.assertResultCount(Assert.java:156)
        at org.fdroid.fdroid.data.ApkProviderTest.assertTotalApkCount(ApkProviderTest.java:427)
        at org.fdroid.fdroid.data.ApkProviderTest.testFindByApp(ApkProviderTest.java:267)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:591)
        at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:274)
        at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:88)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
        at java.base/java.lang.Thread.run(Thread.java:832)

They seem to have identical stack trace.

Edited by Martin R
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information