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
This commit is contained in:
parent
f040bd0739
commit
905be853a1
|
@ -90,6 +90,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
HADOOP-9981. globStatus should minimize its listStatus and getFileStatus
|
HADOOP-9981. globStatus should minimize its listStatus and getFileStatus
|
||||||
calls. (Contributed by Colin Patrick McCabe)
|
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
|
Release 2.2.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -90,11 +90,12 @@ public class JSONUtil {
|
||||||
* @param <T> type
|
* @param <T> type
|
||||||
* @return deserialized T object
|
* @return deserialized T object
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> T toObject(String value,
|
public static <T> T toObject(String value,
|
||||||
final TypeReference<T> typeReference)
|
final TypeReference<T> typeReference)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
try {
|
try {
|
||||||
return jsonMapper.readValue(value, typeReference);
|
return (T)jsonMapper.readValue(value, typeReference);
|
||||||
} catch (JsonGenerationException e) {
|
} catch (JsonGenerationException e) {
|
||||||
throw new SwiftJsonMarshallingException("Error generating response", e);
|
throw new SwiftJsonMarshallingException("Error generating response", e);
|
||||||
} catch (JsonMappingException e) {
|
} catch (JsonMappingException e) {
|
||||||
|
@ -108,11 +109,12 @@ public class JSONUtil {
|
||||||
* @param <T> type
|
* @param <T> type
|
||||||
* @return deserialized T object
|
* @return deserialized T object
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> T toObject(String value,
|
public static <T> T toObject(String value,
|
||||||
final CollectionType collectionType)
|
final CollectionType collectionType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
try {
|
try {
|
||||||
return jsonMapper.readValue(value, collectionType);
|
return (T)jsonMapper.readValue(value, collectionType);
|
||||||
} catch (JsonGenerationException e) {
|
} catch (JsonGenerationException e) {
|
||||||
throw new SwiftJsonMarshallingException(e.toString()
|
throw new SwiftJsonMarshallingException(e.toString()
|
||||||
+ " source: " + value,
|
+ " source: " + value,
|
||||||
|
|
Loading…
Reference in New Issue