From 905be853a149813ec0848688b14b5b3dd0f8cfaa Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Sat, 28 Sep 2013 13:30:09 +0000 Subject: [PATCH] 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/branches/branch-2@1527186 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 39460c8f9bb..ec2b47efd1f 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -90,6 +90,9 @@ Release 2.3.0 - UNRELEASED HADOOP-9981. globStatus should minimize its listStatus and getFileStatus calls. (Contributed by Colin Patrick McCabe) + HADOOP-10006. Compilation failure in trunk for + o.a.h.fs.swift.util.JSONUtil (Junping Du via stevel) + Release 2.2.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java index fd923ce28fe..b17cb6590c1 100644 --- a/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java +++ b/hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java @@ -90,11 +90,12 @@ public class JSONUtil { * @param type * @return deserialized T object */ + @SuppressWarnings("unchecked") public static T toObject(String value, final TypeReference 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 class JSONUtil { * @param type * @return deserialized T object */ + @SuppressWarnings("unchecked") public static 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,