#vulnerable code 
                              @Test
  public void shouldGetPlaylistsForUser_sync() throws Exception {
    final String accessToken = "myVeryLongAccessToken";
    final Api api = Api.builder().build();

    final UserPlaylistsRequest request = api
            .getPlaylistsForUser("wizzler")
            .accessToken(accessToken)
            .httpManager(TestUtil.MockedHttpManager.returningJson("user-playlists.json"))
            .build();

    final Paging<PlaylistSimplified> playlistsPage = request.get();

    assertTrue(playlistsPage.getTotal() >= 0);
    assertNull(playlistsPage.getNext());
    assertEquals("https://api.spotify.com/v1/users/wizzler/playlists?offset=0&limit=10", playlistsPage.getPrevious());
    assertEquals(10, playlistsPage.getLimit());
    assertEquals(2, playlistsPage.getOffset());
    assertEquals("https://api.spotify.com/v1/users/wizzler/playlists?offset=2&limit=10", playlistsPage.getHref());

    final PlaylistSimplified simplePlaylist = playlistsPage.getItems().get(0);
    final String playlistId = simplePlaylist.getId();
    assertNotNull(playlistId);
    assertTrue(playlistId.length() > 0);
    assertEquals(false, simplePlaylist.getIsCollaborative());
    assertEquals("http://open.spotify.com/user/wizzler/playlist/" + playlistId, simplePlaylist.getExternalUrls().get("spotify"));
    assertNotNull(simplePlaylist.getName());
    assertNotNull(simplePlaylist.getOwner());
    assertNotNull(simplePlaylist.getIsPublicAccess());
    assertNotNull(simplePlaylist.getTracks().getHref());
    assertNotNull(simplePlaylist.getTracks().getTotal());
    assertEquals(ObjectType.PLAYLIST, simplePlaylist.getType());
    assertEquals("spotify:user:wizzler:playlist:" + playlistId, simplePlaylist.getUri());
    assertEquals(1, simplePlaylist.getImages().size());
    assertEquals("https://i.scdn.co/image/418ce596327dc3a0f4d377db80421bffb3b94a9a", simplePlaylist.getImages().get(0).getUrl());
    assertNull(simplePlaylist.getImages().get(0).getWidth());
    assertNull(simplePlaylist.getImages().get(0).getHeight());
  } 
                            #location 9 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              @Test
  public void shouldGetPlaylistsForUser_sync() throws Exception {
    final String accessToken = "myVeryLongAccessToken";
    final Api api = Api.builder().build();

    final UserPlaylistsRequest request = api
            .getPlaylistsForUser("wizzler")
            .accessToken(accessToken)
            .httpManager(TestUtil.MockedHttpManager.returningJson("user-playlists.json"))
            .build();

    final Paging<PlaylistSimplified> playlistsPage = request.get();

    assertTrue(playlistsPage.getTotal() >= 0);
    assertNull(playlistsPage.getNext());
    assertEquals("https://api.spotify.com/v1/users/wizzler/playlists?offset=0&limit=10", playlistsPage.getPrevious());
    assertEquals(10, playlistsPage.getLimit());
    assertEquals(2, playlistsPage.getOffset());
    assertEquals("https://api.spotify.com/v1/users/wizzler/playlists?offset=2&limit=10", playlistsPage.getHref());

    final PlaylistSimplified simplePlaylist = playlistsPage.getItems().get(0);
    final String playlistId = simplePlaylist.getId();
    assertNotNull(playlistId);
    assertTrue(playlistId.length() > 0);
    assertEquals(false, simplePlaylist.getIsCollaborative());
    assertEquals("http://open.spotify.com/user/wizzler/playlist/" + playlistId, simplePlaylist.getExternalUrls().get("spotify"));
    assertNotNull(simplePlaylist.getName());
    assertNotNull(simplePlaylist.getOwner());
    assertNotNull(simplePlaylist.getIsPublicAccess());
    assertNotNull(simplePlaylist.getTracks().getHref());
    assertNotNull(simplePlaylist.getTracks().getTotal());
    assertEquals(ObjectType.PLAYLIST, simplePlaylist.getType());
    assertEquals("spotify:user:wizzler:playlist:" + playlistId, simplePlaylist.getUri());
    assertEquals(1, simplePlaylist.getImages().size());
    assertEquals("https://i.scdn.co/image/418ce596327dc3a0f4d377db80421bffb3b94a9a", simplePlaylist.getImages().get(0).getUrl());
    assertEquals(0, simplePlaylist.getImages().get(0).getWidth());
    assertEquals(0, simplePlaylist.getImages().get(0).getHeight());
  }