Skip to content

Commit efff171

Browse files
author
Caitlin Bales (MSFT)
committed
Close scanner in finally
1 parent 595b620 commit efff171

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/microsoft/graph/http/DefaultHttpProvider.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,13 @@ public static String streamToString(final InputStream input) {
420420
final String httpStreamEncoding = "UTF-8";
421421
final String endOfFile = "\\A";
422422
final Scanner scanner = new Scanner(input, httpStreamEncoding);
423-
scanner.useDelimiter(endOfFile);
424-
String scannerString = scanner.next();
425-
scanner.close();
426-
return scannerString;
423+
try {
424+
scanner.useDelimiter(endOfFile);
425+
String scannerString = scanner.next();
426+
return scannerString;
427+
} finally {
428+
scanner.close();
429+
}
427430
}
428431

429432
/**

0 commit comments

Comments
 (0)