Tidied up some methods
Removed some Sonar Critical issues
This commit is contained in:
@@ -424,9 +424,7 @@ public class TheMovieDb {
|
||||
* @return A movie bean with all of the information
|
||||
*/
|
||||
public MovieDB moviedbGetInfo(String tmdbID, String language) {
|
||||
MovieDB movie = null;
|
||||
movie = moviedbGetInfo(tmdbID, movie, language);
|
||||
return movie;
|
||||
return moviedbGetInfo(tmdbID, new MovieDB(), language);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,4 +116,20 @@ public class Artwork implements Comparable<Object> {
|
||||
builder.append("]]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Artwork other = (Artwork)obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,28 +13,26 @@
|
||||
package com.moviejukebox.themoviedb.tools;
|
||||
|
||||
public class Base64 {
|
||||
public static String base64code = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
||||
"abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/";
|
||||
public static String base64code = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/";
|
||||
|
||||
public static int splitLinesAt = 76;
|
||||
public static String base64Encode(String string) {
|
||||
|
||||
String encoded = "";
|
||||
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 - (string.length() % 3)) % 3;
|
||||
int paddingCount = (3 - (unEncoded.length() % 3)) % 3;
|
||||
// add any necessary padding to the input
|
||||
string += "\0\0".substring(0, paddingCount);
|
||||
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 < string.length(); i += 3) {
|
||||
int j = (string.charAt(i) << 16) + (string.charAt(i + 1) << 8) + string.charAt(i + 2);
|
||||
encoded = encoded + base64code.charAt((j >> 18) & 0x3f) +
|
||||
base64code.charAt((j >> 12) & 0x3f) +
|
||||
base64code.charAt((j >> 6) & 0x3f) +
|
||||
base64code.charAt(j & 0x3f);
|
||||
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;
|
||||
return "Basic " + encoded.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,6 @@ public class MovieDbParser {
|
||||
|
||||
Node node = nlMovies.item(0);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
movie = new MovieDB();
|
||||
|
||||
Element element = (Element) node;
|
||||
movie = MovieDbParser.parseSimpleMovie(element);
|
||||
}
|
||||
@@ -168,8 +166,6 @@ public class MovieDbParser {
|
||||
|
||||
Node node = nlMovies.item(0);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
person = new Person();
|
||||
|
||||
Element element = (Element) node;
|
||||
person = MovieDbParser.parseSimplePerson(element);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user