Skip to content

Commit

Permalink
Use try-with-resource on InputStream
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Oct 5, 2023
1 parent 5150fb2 commit 330abc4
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
case REQUEST_IMPORT_SERVERLIST : {
if(resultCode == RESULT_OK) {
StringBuilder xml = new StringBuilder();
try {
try (InputStream inputStream = this.getContentResolver().openInputStream(data.getData());){
String line;
InputStream inputStream = this.getContentResolver().openInputStream(data.getData());
if (inputStream != null) {
BufferedReader source = new BufferedReader(new InputStreamReader(inputStream));
while ((line = source.readLine()) != null) {
Expand Down

0 comments on commit 330abc4

Please sign in to comment.