minor sonar fixes
This commit is contained in:
@@ -23,12 +23,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.MovieDb;
|
||||
import com.omertron.themoviedbapi.model2.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model2.person.Person;
|
||||
import com.omertron.themoviedbapi.model2.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model2.company.Company;
|
||||
import com.omertron.themoviedbapi.model2.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model2.list.UserList;
|
||||
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
|
||||
import com.omertron.themoviedbapi.model2.person.Person;
|
||||
import com.omertron.themoviedbapi.model2.person.PersonFind;
|
||||
import com.omertron.themoviedbapi.model2.tv.TVBasic;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
@@ -56,7 +56,7 @@ public class AbstractMethod {
|
||||
// Jackson JSON configuration
|
||||
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
// Logger
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(TmdbAccount.class);
|
||||
protected static final Logger LOG = LoggerFactory.getLogger(AbstractMethod.class);
|
||||
|
||||
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<Class, TypeReference>();
|
||||
|
||||
@@ -81,14 +81,6 @@ public class AbstractMethod {
|
||||
});
|
||||
}
|
||||
|
||||
protected static TypeReference getTypeReference(Class aClass) {
|
||||
if (TYPE_REFS.containsKey(aClass)) {
|
||||
return TYPE_REFS.get(aClass);
|
||||
} else {
|
||||
throw new RuntimeException("Class type reference for '" + aClass.getSimpleName() + "' not found!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor for the methods
|
||||
*
|
||||
@@ -100,6 +92,21 @@ public class AbstractMethod {
|
||||
this.httpTools = httpTools;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get a pre-generated TypeReference for a class
|
||||
*
|
||||
* @param aClass
|
||||
* @return
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
protected static TypeReference getTypeReference(Class aClass) throws MovieDbException {
|
||||
if (TYPE_REFS.containsKey(aClass)) {
|
||||
return TYPE_REFS.get(aClass);
|
||||
} else {
|
||||
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the wrapper list and return the results
|
||||
*
|
||||
|
||||
@@ -139,7 +139,7 @@ public class TmdbPeople extends AbstractMethod {
|
||||
return MAPPER.readValue(webpage, new TypeReference<PersonCredits<CreditTVBasic>>() {
|
||||
});
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person TV credits", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TmdbPeople extends AbstractMethod {
|
||||
return MAPPER.readValue(webpage, new TypeReference<PersonCredits<? extends CreditBasic>>() {
|
||||
});
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person combined credits", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class TmdbPeople extends AbstractMethod {
|
||||
try {
|
||||
return MAPPER.readValue(webpage, ExternalID.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person external IDs", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public class TmdbPeople extends AbstractMethod {
|
||||
results.copyWrapper(wrapper);
|
||||
return results;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get tagged images", url, ex);
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person popular", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model2.config;
|
||||
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
@@ -203,7 +202,7 @@ public class Configuration extends AbstractJsonMapping {
|
||||
StringBuilder sb = new StringBuilder(getBaseUrl());
|
||||
sb.append(requiredSize);
|
||||
sb.append(imagePath);
|
||||
|
||||
|
||||
try {
|
||||
return new URL(sb.toString());
|
||||
} catch (MalformedURLException ex) {
|
||||
|
||||
@@ -19,10 +19,8 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model2.config;
|
||||
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JobDepartment extends AbstractJsonMapping {
|
||||
|
||||
Reference in New Issue
Block a user