react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.35k stars 437 forks source link

fix: close cursor in getMetadata #593

Closed jblarriviere closed 1 year ago

jblarriviere commented 1 year ago

Summary

getMetadata relies on a Cursor that needs to be closed after using it

Test Plan

What's required for testing (prerequisites)?

NA

What are the steps to reproduce (after prerequisites)?

NA

Compatibility

OS Implemented
iOS ✅❌
Android ✅❌

Checklist

vonovak commented 1 year ago

Hello and thanks for the PR! The current code uses the try-with-resources syntax: https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

so the Cursor should be closed after using it. Do you have a scenario when you think the current code doesn't do that?

Thanks 🙂

jblarriviere commented 1 year ago

Hello! Thanks for your answer

My bad, I wasn't aware that this syntax handled the closing.

I don't see any reason it would not do so, I'll close this PR 🙂