Skip to content

Commit

Permalink
Requests
Browse files Browse the repository at this point in the history
+ Content type JSON where missing
~ Null strings in request results and their handling
~ Json parsing for body elements
- NoContentException

Fixes spotify-web-api-java#129.
  • Loading branch information
dargmuesli committed Feb 11, 2018
1 parent 8ada4cd commit bfa4bf2
Show file tree
Hide file tree
Showing 26 changed files with 74 additions and 79 deletions.
4 changes: 2 additions & 2 deletions examples/data/follow/FollowArtistsOrUsersExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void followArtistsOrUsers_Sync() {
try {
final String string = followArtistsOrUsersRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -39,7 +39,7 @@ public static void followArtistsOrUsers_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/follow/FollowPlaylistExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void followPlaylist_Sync() {
try {
final String string = followPlaylistRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -39,7 +39,7 @@ public static void followPlaylist_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/follow/UnfollowArtistsOrUsersExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void unfollowArtistsOrUsers_Sync() {
try {
final String string = unfollowArtistsOrUsersRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -39,7 +39,7 @@ public static void unfollowArtistsOrUsers_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/follow/UnfollowPlaylistExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void unfollowPlaylist_Sync() {
try {
final String string = unfollowPlaylistRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -38,7 +38,7 @@ public static void unfollowPlaylist_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/library/RemoveAlbumsForCurrentUserExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void removeAlbumsForCurrentUser_Sync() {
try {
final String string = removeAlbumsForCurrentUserRequest.execute();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -37,7 +37,7 @@ public static void removeAlbumsForCurrentUser_Async() {

final String string = stringFuture.get();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/library/RemoveUsersSavedTracksExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void removeUsersSavedTracks_Sync() {
try {
final String string = removeUsersSavedTracksRequest.execute();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -37,7 +37,7 @@ public static void removeUsersSavedTracks_Async() {

final String string = stringFuture.get();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/library/SaveAlbumsForCurrentUserExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void saveAlbumsForCurrentUser_Sync() {
try {
final String string = saveAlbumsForCurrentUserRequest.execute();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -37,7 +37,7 @@ public static void saveAlbumsForCurrentUser_Async() {

final String string = stringFuture.get();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/library/SaveTracksForUserExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void saveTracksForUser_Sync() {
try {
final String string = saveTracksForUserRequest.execute();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -36,7 +36,7 @@ public static void saveTracksForUser_Async() {

final String string = stringFuture.get();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/PauseUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void pauseUsersPlayback_Sync() {
try {
final String string = pauseUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -36,7 +36,7 @@ public static void pauseUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void seekToPositionInCurrentlyPlayingTrack_Sync() {
try {
final String string = seekToPositionInCurrentlyPlayingTrackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -38,7 +38,7 @@ public static void seekToPositionInCurrentlyPlayingTrack_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/SetRepeatModeOnUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void setRepeatModeOnUsersPlayback_Sync() {
try {
final String string = setRepeatModeOnUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -38,7 +38,7 @@ public static void setRepeatModeOnUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/SetVolumeForUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void setVolumeForUsersPlayback_Sync() {
try {
final String string = setVolumeForUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -38,7 +38,7 @@ public static void setVolumeForUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/SkipUsersPlaybackToNextTrackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void skipUsersPlaybackToNextTrack_Sync() {
try {
final String string = skipUsersPlaybackToNextTrackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -37,7 +37,7 @@ public static void skipUsersPlaybackToNextTrack_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void skipUsersPlaybackToPreviousTrack_Sync() {
try {
final String string = skipUsersPlaybackToPreviousTrackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -37,7 +37,7 @@ public static void skipUsersPlaybackToPreviousTrack_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/StartResumeUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void startResumeUsersPlayback_Sync() {
try {
final String string = startResumeUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -41,7 +41,7 @@ public static void startResumeUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void toggleShuffleForUsersPlayback_Sync() {
try {
final String string = toggleShuffleForUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -38,7 +38,7 @@ public static void toggleShuffleForUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/player/TransferUsersPlaybackExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void transferUsersPlayback_Sync() {
try {
final String string = transferUsersPlaybackRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -40,7 +40,7 @@ public static void transferUsersPlayback_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/playlists/ChangePlaylistsDetailsExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void changePlaylistsDetails_Sync() {
try {
final String string = changePlaylistsDetailsRequest.execute();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -42,7 +42,7 @@ public static void changePlaylistsDetails_Async() {

final String string = stringFuture.get();

System.out.println("Empty string: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
4 changes: 2 additions & 2 deletions examples/data/playlists/ReplacePlaylistsTracksExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void replacePlaylistsTracks_Sync() {
try {
final String string = replacePlaylistsTracksRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -39,7 +39,7 @@ public static void replacePlaylistsTracks_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void uploadCustomPlaylistCoverImage_Sync() {
try {
final String string = uploadCustomPlaylistCoverImageRequest.execute();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Error: " + e.getMessage());
}
Expand All @@ -39,7 +39,7 @@ public static void uploadCustomPlaylistCoverImage_Async() {

final String string = stringFuture.get();

System.out.println("Empty String: " + string);
System.out.println("Null: " + string);
} catch (InterruptedException | ExecutionException e) {
System.out.println("Error: " + e.getCause().getMessage());
}
Expand Down
Loading

0 comments on commit bfa4bf2

Please sign in to comment.