HADOOP-10006. Compilation failure in trunk for o.a.h.fs.swift.util.JSONUtil

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1527187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steve Loughran 2013-09-28 13:31:14 +00:00
parent eccdb9aa8b
commit 42b6cadd76
2 changed files with 7 additions and 2 deletions

View File

@ -339,6 +339,9 @@ Release 2.3.0 - UNRELEASED
HADOOP-9998. Provide methods to clear only part of the DNSToSwitchMapping.
(Junping Du via Colin Patrick McCabe)
HADOOP-10006. Compilation failure in trunk for
o.a.h.fs.swift.util.JSONUtil (Junping Du via stevel)
OPTIMIZATIONS
HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn)

View File

@ -90,11 +90,12 @@ public static <T> T toObject(String value, Class<T> klazz) throws
* @param <T> type
* @return deserialized T object
*/
@SuppressWarnings("unchecked")
public static <T> T toObject(String value,
final TypeReference<T> typeReference)
throws IOException {
try {
return jsonMapper.readValue(value, typeReference);
return (T)jsonMapper.readValue(value, typeReference);
} catch (JsonGenerationException e) {
throw new SwiftJsonMarshallingException("Error generating response", e);
} catch (JsonMappingException e) {
@ -108,11 +109,12 @@ public static <T> T toObject(String value,
* @param <T> type
* @return deserialized T object
*/
@SuppressWarnings("unchecked")
public static <T> T toObject(String value,
final CollectionType collectionType)
throws IOException {
try {
return jsonMapper.readValue(value, collectionType);
return (T)jsonMapper.readValue(value, collectionType);
} catch (JsonGenerationException e) {
throw new SwiftJsonMarshallingException(e.toString()
+ " source: " + value,