Closed Bug 1261965 Opened 9 years ago Closed 9 years ago

[infer] Errors in FilePickerResultHandler

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- fixed

People

(Reporter: mcomella, Assigned: mcomella)

References

Details

Attachments

(2 files)

/var/lib/jenkins/workspace/fennec-infer/mobile/android/base/java/org/mozilla/gecko/FilePickerResultHandler.java:101: error: NULL_DEREFERENCE
  object cursor last assigned on line 99 could be null and is dereferenced at line 101

--
/var/lib/jenkins/workspace/fennec-infer/mobile/android/base/java/org/mozilla/gecko/FilePickerResultHandler.java:238: error: RESOURCE_LEAK
   resource acquired to fos by call to FileOutputStream(...) at line 222 is not released after line 238
Comment on attachment 8737955 [details]
MozReview Request: Bug 1261965 - Correct leak FileOutputStream in FilePickerResultHandler. r=grisha

https://reviewboard.mozilla.org/r/44205/#review41001

Looks good

::: mobile/android/base/java/org/mozilla/gecko/FilePickerResultHandler.java:198
(Diff revision 1)
>                                      null); // sortOrder
>          }
>  
>          @Override
>          public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
>              if (cursor.moveToFirst()) {

Since you're touching this, maybe short-circuit out of the function here?
Attachment #8737955 - Flags: review?(gkruglov) → review+
Comment on attachment 8737956 [details]
MozReview Request: Bug 1261965 - Correct potential NullPointerException in FilePickerResultHandler. r=grisha

https://reviewboard.mozilla.org/r/44207/#review41005

looks good other than little typo

::: mobile/android/base/java/org/mozilla/gecko/FilePickerResultHandler.java:97
(Diff revision 1)
>          final FragmentActivity fa = (FragmentActivity) GeckoAppShell.getGeckoInterface().getActivity();
>          final LoaderManager lm = fa.getSupportLoaderManager();
> +
>          // Finally, Video pickers and some file pickers may return a content provider.
> -        Cursor cursor = null;
> +        final ContentResolver cr = fa.getContentResolver();
> +        final Cursor cursor = cr.query(uri, new String[] { MediaStore.Video.Media.DATA }, null, null, null);;

two semicolons at the end of the line here
Attachment #8737956 - Flags: review?(gkruglov)
https://reviewboard.mozilla.org/r/44205/#review41001

> Since you're touching this, maybe short-circuit out of the function here?

If I was making more drastic changes, I'd consider it but it'll change the indentations and thus the commit history so I don't think it's worth it.
https://reviewboard.mozilla.org/r/44207/#review41005

> two semicolons at the end of the line here

Who would have thought? It compiles with two semi-colons! (...but I guess that makes sense)
Comment on attachment 8737956 [details]
MozReview Request: Bug 1261965 - Correct potential NullPointerException in FilePickerResultHandler. r=grisha

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44207/diff/1-2/
Attachment #8737956 - Flags: review?(gkruglov)
Comment on attachment 8737956 [details]
MozReview Request: Bug 1261965 - Correct potential NullPointerException in FilePickerResultHandler. r=grisha

https://reviewboard.mozilla.org/r/44207/#review41789

+1
Attachment #8737956 - Flags: review?(gkruglov) → review+
https://hg.mozilla.org/mozilla-central/rev/18434342c563
https://hg.mozilla.org/mozilla-central/rev/81f58f4715ac
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: