+
Skip to content

Close leaked InputStream #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: androidx-main
Choose a base branch
from

Conversation

liu-wanshun
Copy link

Proposed Changes

  • Fix stream leak

Testing

Test: no test.

Issues Fixed

Fixes: The bug on https://issuetracker.google.com/issues/387245369 being fixed

@liu-wanshun liu-wanshun requested a review from alanv as a code owner January 2, 2025 13:08
@liu-wanshun
Copy link
Author

liu-wanshun commented Jan 2, 2025

@liutikas
Copy link
Member

This fails to compile

Execution failed for task ':core:core:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler output below.
  $SUPPORT/core/core/src/main/java/androidx/core/graphics/drawable/IconCompat.java:1277: error: cannot find symbol
                      } catch (IOException e) {
    symbol:   class IOException
    location: class Api23Impl
  1 error

please fix.

@liu-wanshun liu-wanshun requested a review from liutikas July 4, 2025 16:27
return new BitmapDrawable(context.getResources(),
BitmapFactory.decodeStream(is));
} catch (Exception e) {
/* ignore */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for consistency with the existing error logging in loadDrawableInner() (e.g. line 590), consider logging the exception instead of silently ignoring it:

catch (Exception e) {
    Log.e(TAG, "Unable to load image from URI: " + getUri(), e);
}

This would make debugging easier while preserving current fallback behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@liu-wanshun liu-wanshun requested a review from harrytmthy July 8, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载