瀏覽代碼

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
Steve Loughran 11 年之前
父節點
當前提交
905be853a1

+ 3 - 0
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

+ 4 - 2
hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/util/JSONUtil.java

@@ -90,11 +90,12 @@ public class JSONUtil {
    * @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 class JSONUtil {
    * @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,