Skip to content

Implimentation smell fix #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/main/java/spotify/api/impl/PlaylistApiRetrofit.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,14 @@ public void addItemToPlaylist(List<String> listOfObjectUris, String playlistId,

@Override
public void createPlaylist(String userId, CreateUpdatePlaylistRequestBody requestBody) {
if (userId == null || requestBody.getName() == null || userId.isEmpty() || requestBody.getName().isEmpty()) {
final String errorMessage = "Required parameters are empty!";
if (userId == null || userId.isEmpty()) {
final String errorMessage = "userId can not be empty!";
logger.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}

if (requestBody.getName() == null || requestBody.getName().isEmpty()) {
final String errorMessage = "requestBody can not be empty!";
logger.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
Expand Down Expand Up @@ -293,8 +299,14 @@ public void replacePlaylistItems(String playlistId, List<String> listOfItemUris)

@Override
public void uploadCoverImageToPlaylist(String playlistId, String base64EncodedJpegImage) {
if (playlistId == null || base64EncodedJpegImage == null || playlistId.isEmpty() || base64EncodedJpegImage.isEmpty()) {
final String errorMessage = "Required parameters are empty!";
if (playlistId == null || playlistId.isEmpty()) {
final String errorMessage = "playlistId can not be empty!";
logger.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}

if (base64EncodedJpegImage == null || base64EncodedJpegImage.isEmpty()) {
final String errorMessage = "Image can not be empty!";
logger.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
Expand Down