Findbugs warning for try-with-resources due enabling error prone |
||
Issue descriptionFindbugs complains about try-with-resources since the bytecode has changed with JDK 9 (which error-prone uses). See: https://github.com/google/error-prone/issues/620#issuecomment-313738963 We should switch to errorprone and remove findbugs if it does not add additional benefits. FindBugs reported the following issues: OBL_UNSATISFIED_OBLIGATION: Method may fail to clean up stream or resource In class com.android.webview.chromium.LicenseContentProvider In method com.android.webview.chromium.LicenseContentProvider.writeDataToPipe(ParcelFileDescriptor, Uri, String, Bundle, String) Reference type java.io.OutputStream Obligation to clean up resource created at LicenseContentProvider.java:[line 51] is not discharged
,
Oct 2 2017
Might be due to this change to desugar since null-check was removed for resources initialized by constructor (OutputStream here): https://bugs.openjdk.java.net/browse/JDK-7020499
,
Nov 16 2017
Findbugs is dead, long live error prone. |
||
►
Sign in to add a comment |
||
Comment 1 by wnwen@chromium.org
, Oct 2 2017This is the generated bytecode (after enabling latest error prone): try { InputStream in = this.getContext().getAssets().open(filename); Throwable var7 = null; try { OutputStream out = new FileOutputStream(output.getFileDescriptor()); Throwable var9 = null; try { byte[] buf = new byte[8192]; boolean var11 = true; int size; while((size = in.read(buf)) != -1) { out.write(buf, 0, size); } } catch (Throwable var24) { var9 = var24; throw var24; } finally { $closeResource(var9, out); } } catch (Throwable var26) { var7 = var26; throw var26; } finally { if(in != null) { $closeResource(var7, in); } } } catch (IOException var28) { Log.e("LicenseCP", "Failed to read the license file", var28); }