Update close for try witch resources

This commit is contained in:
xjoao 2020-05-22 13:58:45 -04:00
parent 84f4760349
commit f3042b6b45

View File

@ -133,10 +133,9 @@ public class YoutubeManager {
InputStream is = conn.getInputStream(); InputStream is = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(is); InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr); YoutubePlaylist playlist;
try (BufferedReader br = new BufferedReader(isr)) {
YoutubePlaylist playlist = null; playlist = null;
String inputLine; String inputLine;
while ((inputLine = br.readLine()) != null) { while ((inputLine = br.readLine()) != null) {
if (inputLine.contains("window[\"ytInitialData\"]")) { if (inputLine.contains("window[\"ytInitialData\"]")) {
@ -161,8 +160,7 @@ public class YoutubeManager {
break; break;
} }
} }
}
br.close();
this.playlistCache.put(playlistId, playlist); this.playlistCache.put(playlistId, playlist);