New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 770782 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
OOO until Feb 4th
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 383646



Sign in to add a comment

Findbugs warning for try-with-resources due enabling error prone

Project Member Reported by wnwen@chromium.org, Oct 2 2017

Issue description

Findbugs 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
 

Comment 1 by wnwen@chromium.org, Oct 2 2017

This 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);
        }

Comment 2 by wnwen@chromium.org, 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

Comment 4 by wnwen@chromium.org, Nov 16 2017

Status: Fixed (was: Assigned)
Findbugs is dead, long live error prone.

Sign in to add a comment