Remove duplicate literals

master
Stuart Boston 13 years ago
parent 259eb81f32
commit a520c75773

@ -53,6 +53,7 @@ import static com.omertron.themoviedbapi.tools.ApiUrl.*;
public class TheMovieDbApi {
private static final Logger LOG = LoggerFactory.getLogger(TheMovieDbApi.class);
private static final String FAILED_KEYWORD = "Failed to get keyword: {}";
private String apiKey;
private CommonHttpClient httpClient;
private TmdbConfiguration tmdbConfig;
@ -356,7 +357,9 @@ public class TheMovieDbApi {
}
/**
* Get the basic information for an account. You will need to have a valid session id. *
* Get the basic information for an account. You will need to have a valid session id.
*
*
* @throws MovieDbException
*/
public Account getAccount(String sessionId) throws MovieDbException {
@ -376,8 +379,6 @@ public class TheMovieDbApi {
}
}
public List<MovieDb> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException {
ApiUrl apiUrl = new ApiUrl(apiKey, BASE_ACCOUNT, accountId + "/favorite_movies");
apiUrl.addArgument(PARAM_SESSION, sessionId);
@ -388,7 +389,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, WrapperMovie.class).getMovies();
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -409,7 +410,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -444,7 +445,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -453,6 +454,7 @@ public class TheMovieDbApi {
//</editor-fold>
//
//<editor-fold defaultstate="collapsed" desc="Movie Functions">
/**
* This method is used to retrieve all of the basic movie information.
*
@ -1039,7 +1041,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, WrapperMovie.class).getMovies();
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -1072,13 +1074,12 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, StatusCode.class).getStatusCode() == 12;
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Collection Functions">
/**
* This method is used to retrieve all of the basic information about a movie collection.
@ -1690,7 +1691,6 @@ public class TheMovieDbApi {
}
}
/**
* This method lets users create a new list. A valid session id is required.
*
@ -1714,7 +1714,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, MovieDbListStatus.class).getListId();
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -1735,12 +1735,11 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, ListItemStatus.class).isItemPresent();
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
/**
* This method lets users add new movies to a list that they created. A valid session id is required.
*
@ -1774,7 +1773,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
@ -1795,13 +1794,14 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, WrapperMovie.class).getMovies();
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
/**
* This method lets users delete a list that they created. A valid session id is required.
*
* @throws MovieDbException
*/
public StatusCode deleteMovieList(String sessionId, String listId) throws MovieDbException {
@ -1816,12 +1816,11 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
}
//<editor-fold defaultstate="collapsed" desc="Keyword Functions">
/**
* Get the basic information for a specific keyword id.
@ -1840,7 +1839,7 @@ public class TheMovieDbApi {
try {
return mapper.readValue(webpage, Keyword.class);
} catch (IOException ex) {
LOG.warn("Failed to get keyword: {}", ex.getMessage());
LOG.warn(FAILED_KEYWORD, ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}

Loading…
Cancel
Save