diff --git a/themoviedbapi/pom.xml b/themoviedbapi/pom.xml
index 4123db571..fd0b362ae 100644
--- a/themoviedbapi/pom.xml
+++ b/themoviedbapi/pom.xml
@@ -15,12 +15,12 @@
Google Codehttp://code.google.com/p/themoviedbapi/issues/list
-
+
Hudson CIhttp://jenkins.omertron.com/job/API-TheMovieDb/
-
+
scm:svn:http://themoviedbapi.googlecode.com/svn/trunk/themoviedbapiscm:svn:https://themoviedbapi.googlecode.com/svn/trunk/themoviedbapi
@@ -39,8 +39,13 @@
junitjunit
+
+ commons-codec
+ commons-codec
+ 1.4
+
-
+
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDb.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDb.java
index 14058252e..28146eb88 100644
--- a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDb.java
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/TheMovieDb.java
@@ -1,14 +1,14 @@
/*
* Copyright (c) 2004-2011 YAMJ Members
- * http://code.google.com/p/moviejukebox/people/list
- *
+ * http://code.google.com/p/moviejukebox/people/list
+ *
* Web: http://code.google.com/p/moviejukebox/
- *
+ *
* This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License
- *
- * For any reuse or distribution, you must make clear to others the
- * license terms of this work.
+ *
+ * For any reuse or distribution, you must make clear to others the
+ * license terms of this work.
*/
package com.moviejukebox.themoviedb;
@@ -36,7 +36,7 @@ import com.moviejukebox.themoviedb.tools.WebBrowser;
* This is the main class for the API to connect to TheMovieDb.org.
* The implementation is for v2.1 of the API as detailed here:
* http://api.themoviedb.org/2.1
- *
+ *
* @author Stuart.Boston
* @version 1.3
*/
@@ -47,7 +47,56 @@ public class TheMovieDb {
private static ConsoleHandler tmdbConsoleHandler = new ConsoleHandler();
private static final String API_SITE = "http://api.themoviedb.org/2.1/";
private static final String DEFAULT_LANGUAGE = "en-US";
-
+
+ /**
+ * Constructor with default logger.
+ * @param apiKey
+ */
+ public TheMovieDb(String apiKey) {
+ setLogger(Logger.getLogger("TheMovieDB"));
+ if (!isValidString(apiKey)) {
+ logger.severe("TheMovieDb was initialized with a wrong API key!");
+ }
+ setApiKey(apiKey);
+ }
+
+ /*
+ * API Methods
+ * http://api.themoviedb.org/2.1
+ * Note: This is currently a read-only interface and as such, no write methods exist.
+ */
+
+ /*
+ * Media
+ */
+ @SuppressWarnings("unused")
+ private static final String MEDIA_GET_INFO = "Media.getInfo";
+
+ /*
+ * Movies
+ */
+ private static final String MOVIE_BROWSE = "Movie.browse";
+ private static final String MOVIE_GET_IMAGES = "Movie.getImages";
+ private static final String MOVIE_GET_INFO = "Movie.getInfo";
+ private static final String MOVIE_GET_LATEST = "Movie.getLatest";
+ private static final String MOVIE_GET_TRANSLATIONS = "Movie.getTranslations";
+ private static final String MOVIE_GET_VERSION = "Movie.getVersion";
+ private static final String MOVIE_IMDB_LOOKUP = "Movie.imdbLookup";
+ private static final String MOVIE_SEARCH = "Movie.search";
+
+ /*
+ * People
+ */
+ private static final String PERSON_GET_INFO = "Person.getInfo";
+ private static final String PERSON_GET_LATEST = "Person.getLatest";
+ private static final String PERSON_GET_VERSION = "Person.getVersion";
+ private static final String PERSON_SEARCH = "Person.search";
+
+ /*
+ * Misc
+ */
+ private static final String GENRES_GET_LIST = "Genres.getList";
+
/**
* Compare the MovieDB object with a title & year
* @param moviedb The moviedb object to compare too
@@ -96,7 +145,7 @@ public class TheMovieDb {
}
return false;
}
-
+
/**
* Search a list of movies and return the one that matches the title & year
* @param movieList The list of movies to search
@@ -117,7 +166,7 @@ public class TheMovieDb {
return null;
}
-
+
/**
* Check the string passed to see if it contains a value.
* @param testString The string to test
@@ -131,68 +180,11 @@ public class TheMovieDb {
}
return true;
}
-
- /*
- * API Methods
- * http://api.themoviedb.org/2.1
- * Note: This is currently a read-only interface and as such, no write methods exist.
- */
-
- /*
- * Media
- */
- @SuppressWarnings("unused")
- private static final String MEDIA_GET_INFO = "Media.getInfo";
-
- /*
- * Movies
- */
- private static final String MOVIE_BROWSE = "Movie.browse";
- private static final String MOVIE_GET_IMAGES = "Movie.getImages";
- private static final String MOVIE_GET_INFO = "Movie.getInfo";
- private static final String MOVIE_GET_LATEST = "Movie.getLatest";
- private static final String MOVIE_GET_TRANSLATIONS = "Movie.getTranslations";
- private static final String MOVIE_GET_VERSION = "Movie.getVersion";
- private static final String MOVIE_IMDB_LOOKUP = "Movie.imdbLookup";
- private static final String MOVIE_SEARCH = "Movie.search";
-
- /*
- * People
- */
- private static final String PERSON_GET_INFO = "Person.getInfo";
- private static final String PERSON_GET_LATEST = "Person.getLatest";
- private static final String PERSON_GET_VERSION = "Person.getVersion";
- private static final String PERSON_SEARCH = "Person.search";
-
- /*
- * Misc
- */
- private static final String GENRES_GET_LIST = "Genres.getList";
public static Logger getLogger() {
return logger;
}
- /**
- * Constructor with default logger.
- * @param apiKey
- */
- public TheMovieDb(String apiKey) {
- setLogger(Logger.getLogger("TheMovieDB"));
- if (!isValidString(apiKey)) {
- logger.severe("TheMovieDb was initialized with a wrong API key!");
- }
- setApiKey(apiKey);
- }
-
- public TheMovieDb(String apiKey, Logger logger) {
- setLogger(logger);
- if (!isValidString(apiKey)) {
- logger.severe("TheMovieDb was initialized with a wrong API key!");
- }
- setApiKey(apiKey);
- }
-
/**
* Build comma separated ids for Movie.getLatest and Movie.getVersion.
* @param ids a List of ids
@@ -200,7 +192,7 @@ public class TheMovieDb {
*/
private String buildIds(List ids) {
StringBuilder builder = new StringBuilder();
-
+
for (int i = 0; i < ids.size(); i++) {
if (i == 0) {
builder.append(ids.get(i));
@@ -221,9 +213,9 @@ public class TheMovieDb {
*/
private String buildUrl(String prefix, String searchTerm, String language) {
StringBuilder url = new StringBuilder();
-
-
-
+
+
+
url.append(API_SITE);
url.append(prefix);
url.append("/");
@@ -321,11 +313,11 @@ public class TheMovieDb {
validParameters.add("companies");
validParameters.add("countries");
-
+
StringBuilder searchUrl = new StringBuilder();
searchUrl.append("order_by=").append(orderBy);
searchUrl.append("&order=").append(order);
-
+
if(!parameters.isEmpty()) {
for (String key : validParameters) {
if (parameters.containsKey(key)) {
@@ -336,11 +328,11 @@ public class TheMovieDb {
// Get the search url
String baseUrl = buildUrl(MOVIE_BROWSE, "", language);
-
+
// Now append the parameter url to the end of the search url
searchUrl.insert(0, "?");
searchUrl.insert(0, baseUrl);
-
+
return MovieDbParser.parseMovies(searchUrl.toString());
}
@@ -395,13 +387,13 @@ public class TheMovieDb {
/**
* Gets all the information for a given TheMovieDb ID
- *
+ *
* @param movie
* An existing MovieDB object to populate with the data
* @param tmdbID
* The Movie Db ID for the movie to get information for
* @param language
- * The two digit language code. E.g. en=English
+ * The two digit language code. E.g. en=English
* @return A movie bean with all of the information
*/
public MovieDB moviedbGetInfo(String tmdbID, MovieDB movie, String language) {
@@ -424,9 +416,9 @@ public class TheMovieDb {
/**
* Passes a null MovieDB object to the full function
- *
+ *
* @param tmdbID TheMovieDB ID of the movie to get the information for
- * @param language The two digit language code. E.g. en=English
+ * @param language The two digit language code. E.g. en=English
* @return A movie bean with all of the information
*/
public MovieDB moviedbGetInfo(String tmdbID, String language) {
@@ -493,9 +485,9 @@ public class TheMovieDb {
/**
* Searches the database using the IMDb reference
- *
+ *
* @param imdbID IMDb reference, must include the "tt" at the start
- * @param language The two digit language code. E.g. en=English
+ * @param language The two digit language code. E.g. en=English
* @return A movie bean with the data extracted
*/
public MovieDB moviedbImdbLookup(String imdbID, String language) {
@@ -512,7 +504,7 @@ public class TheMovieDb {
/**
* Searches the database using the movie title passed
- *
+ *
* @param movieTitle The title to search for
* @param language The two digit language code. E.g. en=English
* @return A movie bean with the data extracted
@@ -528,9 +520,9 @@ public class TheMovieDb {
}
/**
- * The Person.getInfo method is used to retrieve the full filmography, known movies,
+ * The Person.getInfo method is used to retrieve the full filmography, known movies,
* images and things like birthplace for a specific person in the TMDb database.
- *
+ *
* @param personID
* @param language
* @return
@@ -574,18 +566,18 @@ public class TheMovieDb {
}
/**
- * The Person.getVersion method is used to retrieve the last modified time
+ * The Person.getVersion method is used to retrieve the last modified time
* along with the current version number of the called object(s). This is
* useful if you've already called the object sometime in the past and
* simply want to do a quick check for updates.
- *
+ *
* @param personID a Person TMDb id
* @param language the two digit language code. E.g. en=English
* @return
*/
public Person personGetVersion(String personID, String language) {
Person person = new Person();
-
+
if (!isValidString(personID)) {
return person;
}
@@ -601,7 +593,7 @@ public class TheMovieDb {
/**
* The Person.search method is used to search for an actor, actress or production member.
* http://api.themoviedb.org/2.1/methods/Person.search
- *
+ *
* @param personName
* @param language
* @return
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java
index b3c9e7a5d..f9ca36905 100644
--- a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/MovieDB.java
@@ -1,34 +1,38 @@
/*
* Copyright (c) 2004-2011 YAMJ Members
- * http://code.google.com/p/moviejukebox/people/list
- *
+ * http://code.google.com/p/moviejukebox/people/list
+ *
* Web: http://code.google.com/p/moviejukebox/
- *
+ *
* This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License
- *
- * For any reuse or distribution, you must make clear to others the
- * license terms of this work.
+ *
+ * For any reuse or distribution, you must make clear to others the
+ * license terms of this work.
*/
package com.moviejukebox.themoviedb.model;
+import com.moviejukebox.themoviedb.TheMovieDb;
import java.io.Serializable;
import java.text.DateFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import com.moviejukebox.themoviedb.tools.ModelTools;
+import java.util.logging.Logger;
/**
* This is the Movie Search bean for the MovieDb.org search
- *
+ *
* @author Stuart.Boston
*/
public class MovieDB extends ModelTools implements Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = TheMovieDb.getLogger();
public static final String UNKNOWN = "UNKNOWN";
@@ -63,7 +67,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getPopularity() {
return popularity;
}
-
+
public void setPopularity(String popularity) {
this.popularity = popularity;
}
@@ -71,7 +75,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getTitle() {
return title;
}
-
+
public void setTitle(String title) {
this.title = title;
}
@@ -79,11 +83,11 @@ public class MovieDB extends ModelTools implements Serializable {
public String getType() {
return type;
}
-
+
public void setType(String type) {
this.type = type;
}
-
+
public String getId() {
return id;
}
@@ -91,11 +95,11 @@ public class MovieDB extends ModelTools implements Serializable {
public void setId(String id) {
this.id = id;
}
-
+
public String getImdb() {
return imdb;
}
-
+
public void setImdb(String imdb) {
this.imdb = imdb;
}
@@ -103,7 +107,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getUrl() {
return url;
}
-
+
public void setUrl(String url) {
this.url = url;
}
@@ -111,7 +115,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getOverview() {
return overview;
}
-
+
public void setOverview(String overview) {
this.overview = overview;
}
@@ -119,7 +123,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getReleaseDate() {
return releaseDate;
}
-
+
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
@@ -127,7 +131,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getRating() {
return rating;
}
-
+
public void setRating(String rating) {
this.rating = rating;
}
@@ -135,7 +139,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getRuntime() {
return runtime;
}
-
+
public void setRuntime(String runtime) {
this.runtime = runtime;
}
@@ -143,7 +147,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getBudget() {
return budget;
}
-
+
public void setBudget(String budget) {
this.budget = budget;
}
@@ -151,7 +155,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getRevenue() {
return revenue;
}
-
+
public void setRevenue(String revenue) {
this.revenue = revenue;
}
@@ -159,7 +163,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getHomepage() {
return homepage;
}
-
+
public void setHomepage(String homepage) {
this.homepage = homepage;
}
@@ -167,7 +171,7 @@ public class MovieDB extends ModelTools implements Serializable {
public String getTrailer() {
return trailer;
}
-
+
public void setTrailer(String trailer) {
this.trailer = trailer;
}
@@ -175,17 +179,17 @@ public class MovieDB extends ModelTools implements Serializable {
public List getProductionCountries() {
return countries;
}
-
+
public void addProductionCountry(Country country) {
if (country != null) {
countries.add(country);
}
}
-
+
public List getPeople() {
return people;
}
-
+
public void addPerson(Person person) {
if (person != null) {
people.add(person);
@@ -195,7 +199,7 @@ public class MovieDB extends ModelTools implements Serializable {
public List getCategories() {
return categories;
}
-
+
public void addCategory(Category category) {
if (category != null) {
categories.add(category);
@@ -273,13 +277,13 @@ public class MovieDB extends ModelTools implements Serializable {
public void setStudios(List studios) {
this.studios = studios;
}
-
+
public void addStudio(Studio studio) {
if (studio != null) {
this.studios.add(studio);
}
}
-
+
public void setCountries(List countries) {
this.countries = countries;
}
@@ -298,11 +302,10 @@ public class MovieDB extends ModelTools implements Serializable {
public void setLastModifiedAt(String lastModifiedAt) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
try {
setLastModifiedAt(df.parse(lastModifiedAt));
- } catch (Exception ignore) {
- return;
+ } catch (ParseException ex) {
+ logger.fine("MovieDB: Error parsing date: " + lastModifiedAt);
}
}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java
index 07218142b..637da5a38 100644
--- a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/model/Person.java
@@ -1,34 +1,38 @@
/*
* Copyright (c) 2004-2011 YAMJ Members
- * http://code.google.com/p/moviejukebox/people/list
- *
+ * http://code.google.com/p/moviejukebox/people/list
+ *
* Web: http://code.google.com/p/moviejukebox/
- *
+ *
* This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License
- *
- * For any reuse or distribution, you must make clear to others the
- * license terms of this work.
+ *
+ * For any reuse or distribution, you must make clear to others the
+ * license terms of this work.
*/
package com.moviejukebox.themoviedb.model;
+import com.moviejukebox.themoviedb.TheMovieDb;
import java.io.Serializable;
import java.text.DateFormat;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.moviejukebox.themoviedb.tools.ModelTools;
+import java.util.logging.Logger;
/**
- * This is the new bean for the Person
- *
+ * This is the new bean for the Person
+ *
* @author Stuart.Boston
*
*/
public class Person extends ModelTools implements Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = TheMovieDb.getLogger();
private static final String UNKNOWN = MovieDB.UNKNOWN;
@@ -49,119 +53,226 @@ public class Person extends ModelTools implements Serializable {
private List filmography = new ArrayList();
private List aka = new ArrayList();
private List images = new ArrayList();
-
+
+ /**
+ * Add a single AKA
+ * @param alsoKnownAs
+ */
public void addAka(String alsoKnownAs) {
this.aka.add(alsoKnownAs);
}
-
+
+ /**
+ * Add a film for the person
+ * @param film
+ */
public void addFilm(Filmography film) {
this.filmography.add(film);
}
-
+
+ /**
+ * Add an artwork image to the person
+ * @param image
+ */
public void addImage(Artwork image) {
if (image != null) {
this.images.add(image);
}
}
-
+
+ /**
+ * Get all the AKA values
+ * @return
+ */
public List getAka() {
return aka;
}
-
+
+ /**
+ * Get the biography information
+ * @return
+ */
public String getBiography() {
return biography;
}
-
+
+ /**
+ * Get the birthday of the person
+ * @return
+ */
public Date getBirthday() {
return birthday;
}
-
+
+ /**
+ * Get the birthplace
+ * @return
+ */
public String getBirthPlace() {
return birthPlace;
}
-
+
+ /**
+ * get the cast ID
+ * @return
+ */
public int getCastId() {
return castId;
}
-
+
+ /**
+ * get the character
+ * @return
+ */
public String getCharacter() {
return character;
}
-
+
+ /**
+ * get the department
+ * @return
+ */
public String getDepartment() {
return department;
}
-
+
+ /**
+ * get the list of films
+ * @return
+ */
public List getFilmography() {
return filmography;
}
-
+
+ /**
+ * get the ID of the person
+ * @return
+ */
public String getId() {
return id;
}
-
+
+ /**
+ * get a list of images for the person
+ * @return
+ */
public List getImages() {
return images;
}
-
+
+ /**
+ * get the job
+ * @return
+ */
public String getJob() {
return job;
}
+ /**
+ * get the known movies
+ * @return
+ */
public int getKnownMovies() {
return knownMovies;
}
+ /**
+ * get the last modified date for the person
+ * @return
+ */
public Date getLastModifiedAt() {
return lastModifiedAt;
}
-
+
+ /**
+ * get the name
+ * @return
+ */
public String getName() {
return name;
}
+ /**
+ * get the order
+ * @return
+ */
public int getOrder() {
return order;
}
+ /**
+ * get the URL for the person
+ * @return
+ */
public String getUrl() {
return url;
}
-
+
+ /**
+ * get the version
+ * @return
+ */
public int getVersion() {
return version;
}
+ /**
+ * Set the AKA list for the person
+ * @param aka
+ */
public void setAka(List aka) {
this.aka = aka;
}
+ /**
+ * Set the biography
+ * @param biography
+ */
public void setBiography(String biography) {
this.biography = biography;
}
-
+
+ /**
+ * Set the person's birthday
+ * @param birthday
+ */
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
+ /**
+ * Set the person's birthday
+ * @param sBirthday
+ */
public void setBirthday(String sBirthday) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-
try {
setBirthday(df.parse(sBirthday));
- } catch (Exception ignore) {
- return;
+ } catch (ParseException ex) {
+ logger.fine("TheMovieDB - Person: Error parsing birthday: " + sBirthday);
}
}
+ /**
+ * Set the birth place
+ * @param birthPlace
+ */
public void setBirthPlace(String birthPlace) {
this.birthPlace = birthPlace;
}
+ /**
+ * Set the cast ID for the person
+ * @param castId
+ */
public void setCastId(int castId) {
this.castId = castId;
}
-
+
+ /**
+ * Set the cast ID for the person
+ * @param castId
+ */
public void setCastId(String castId) {
try {
this.castId = Integer.parseInt(castId);
@@ -170,41 +281,77 @@ public class Person extends ModelTools implements Serializable {
}
}
+ /**
+ * Set the character
+ * @param character
+ */
public void setCharacter(String character) {
this.character = character;
}
-
+
+ /**
+ * set the Department
+ * @param department
+ */
public void setDepartment(String department) {
this.department = department;
}
+ /**
+ * Add a list of films
+ * @param filmography
+ */
public void setFilmography(List filmography) {
this.filmography = filmography;
}
+ /**
+ * Set the ID of the person
+ * @param id
+ */
public void setId(String id) {
this.id = id;
}
+ /**
+ * Set a list of images for the person
+ * @param images
+ */
public void setImages(List images) {
this.images = images;
}
+ /**
+ * Set the job for the person
+ * @param job
+ */
public void setJob(String job) {
this.job = job;
}
+ /**
+ * Set the known movie for the person
+ * @param knownMovies
+ */
public void setKnownMovies(int knownMovies) {
this.knownMovies = knownMovies;
}
+ /**
+ * Set the last modified date
+ * @param lastModifiedAt
+ */
public void setLastModifiedAt(Date lastModifiedAt) {
this.lastModifiedAt = lastModifiedAt;
}
+ /**
+ * Set the last modified date
+ * @param lastModifiedAt
+ */
public void setLastModifiedAt(String lastModifiedAt) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
+
try {
Date lma = df.parse(lastModifiedAt);
setLastModifiedAt(lma);
@@ -213,14 +360,26 @@ public class Person extends ModelTools implements Serializable {
}
}
+ /**
+ * Set the person's anme
+ * @param name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ *Set the order
+ * @param order
+ */
public void setOrder(int order) {
this.order = order;
}
-
+
+ /**
+ * Set the order
+ * @param order
+ */
public void setOrder(String order) {
try {
this.order = Integer.parseInt(order);
@@ -229,14 +388,26 @@ public class Person extends ModelTools implements Serializable {
}
}
+ /**
+ * Set the URL
+ * @param url
+ */
public void setUrl(String url) {
this.url = url;
}
-
+
+ /**
+ * Set the version
+ * @param version
+ */
public void setVersion(int version) {
this.version = version;
}
+ /**
+ * Generate a String representation of the person
+ * @return
+ */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/Base64.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/Base64.java
deleted file mode 100644
index 7560e50a2..000000000
--- a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/Base64.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2004-2011 YAMJ Members
- * http://code.google.com/p/moviejukebox/people/list
- *
- * Web: http://code.google.com/p/moviejukebox/
- *
- * This software is licensed under a Creative Commons License
- * See this page: http://code.google.com/p/moviejukebox/wiki/License
- *
- * For any reuse or distribution, you must make clear to others the
- * license terms of this work.
- */
-package com.moviejukebox.themoviedb.tools;
-
-public class Base64 {
- private static final String base64code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- public static String base64Encode(String string) {
- String unEncoded = string; // Copy the string so we can modify it
- StringBuffer encoded = new StringBuffer();
- // determine how many padding bytes to add to the output
- int paddingCount = (3 - (unEncoded.length() % 3)) % 3;
- // add any necessary padding to the input
- unEncoded += "\0\0".substring(0, paddingCount);
- // process 3 bytes at a time, churning out 4 output bytes
- // worry about CRLF insertions later
- for (int i = 0; i < unEncoded.length(); i += 3) {
- int j = (unEncoded.charAt(i) << 16) + (unEncoded.charAt(i + 1) << 8) + unEncoded.charAt(i + 2);
- encoded.append(base64code.charAt((j >> 18) & 0x3f) + base64code.charAt((j >> 12) & 0x3f) + base64code.charAt((j >> 6) & 0x3f)
- + base64code.charAt(j & 0x3f));
- }
- // replace encoded padding nulls with "="
- // return encoded;
- return "Basic " + encoded.toString();
- }
-}
diff --git a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/DOMHelper.java b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/DOMHelper.java
index 22146b0e4..a5c4be580 100644
--- a/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/DOMHelper.java
+++ b/themoviedbapi/src/main/java/com/moviejukebox/themoviedb/tools/DOMHelper.java
@@ -1,14 +1,14 @@
/*
* Copyright (c) 2004-2011 YAMJ Members
- * http://code.google.com/p/moviejukebox/people/list
- *
+ * http://code.google.com/p/moviejukebox/people/list
+ *
* Web: http://code.google.com/p/moviejukebox/
- *
+ *
* This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License
- *
- * For any reuse or distribution, you must make clear to others the
- * license terms of this work.
+ *
+ * For any reuse or distribution, you must make clear to others the
+ * license terms of this work.
*/
package com.moviejukebox.themoviedb.tools;
@@ -35,7 +35,7 @@ import com.moviejukebox.themoviedb.TheMovieDb;
*
*/
public class DOMHelper {
- private static Logger logger = TheMovieDb.getLogger();
+ private static final Logger logger = TheMovieDb.getLogger();
/**
* Gets the string value of the tag element name passed
@@ -71,11 +71,11 @@ public class DOMHelper {
Document doc = null;
InputStream in = null;
String webPage = null;
-
+
try {
boolean validWebPage = false;
webPage = WebBrowser.request(url);
-
+
// There seems to be an error with some of the web pages that returns garbage
if (webPage.startsWith("() {
+ private static final String EOL = (String) java.security.AccessController.doPrivileged(new PrivilegedAction