From 770aef5053563d6e7984a6873d86456b00413dc6 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Wed, 9 Apr 2014 11:11:31 +0000 Subject: [PATCH] HADOOP-10104. Update jackson to 1.9.13 (Akira Ajisaka via stevel) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585933 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../hadoop/hdfs/server/namenode/ClusterJspHelper.java | 10 +++++----- .../org/apache/hadoop/mapreduce/v2/TestRMNMInfo.java | 8 ++++---- hadoop-project/pom.xml | 8 ++++---- .../hadoop/tools/rumen/state/StateDeserializer.java | 2 +- .../apache/hadoop/yarn/sls/RumenToSLSConverter.java | 4 ++-- .../hadoop/yarn/util/timeline/TimelineUtils.java | 5 ++--- .../yarn/webapp/YarnJacksonJaxbJsonProvider.java | 3 +-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index aa1767722e3..ec59a46e2c3 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -19,6 +19,8 @@ Release 2.5.0 - UNRELEASED HADOOP-10454. Provide FileContext version of har file system. (Kihwal Lee via jeagles) + HADOOP-10104. Update jackson to 1.9.13 (Akira Ajisaka via stevel) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ClusterJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ClusterJspHelper.java index 2d67426ba82..9345098990b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ClusterJspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ClusterJspHelper.java @@ -358,8 +358,8 @@ class ClusterJspHelper { nn.missingBlocksCount = getProperty(props, "NumberOfMissingBlocks") .getLongValue(); nn.httpAddress = httpAddress.toURL(); - getLiveNodeCount(getProperty(props, "LiveNodes").getValueAsText(), nn); - getDeadNodeCount(getProperty(props, "DeadNodes").getValueAsText(), nn); + getLiveNodeCount(getProperty(props, "LiveNodes").asText(), nn); + getDeadNodeCount(getProperty(props, "DeadNodes").asText(), nn); nn.softwareVersion = getProperty(props, "SoftwareVersion").getTextValue(); return nn; } @@ -373,11 +373,11 @@ class ClusterJspHelper { Map> statusMap, String props) throws IOException, MalformedObjectNameException { getLiveNodeStatus(statusMap, host, getProperty(props, "LiveNodes") - .getValueAsText()); + .asText()); getDeadNodeStatus(statusMap, host, getProperty(props, "DeadNodes") - .getValueAsText()); + .asText()); getDecommissionNodeStatus(statusMap, host, - getProperty(props, "DecomNodes").getValueAsText()); + getProperty(props, "DecomNodes").asText()); } /** diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestRMNMInfo.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestRMNMInfo.java index 4ac1f86b57d..afd6d473198 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestRMNMInfo.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestRMNMInfo.java @@ -116,7 +116,7 @@ public class TestRMNMInfo { Assert.assertNotNull(n.get("HostName")); Assert.assertNotNull(n.get("Rack")); Assert.assertTrue("Node " + n.get("NodeId") + " should be RUNNING", - n.get("State").getValueAsText().contains("RUNNING")); + n.get("State").asText().contains("RUNNING")); Assert.assertNotNull(n.get("NodeHTTPAddress")); Assert.assertNotNull(n.get("LastHealthUpdate")); Assert.assertNotNull(n.get("HealthReport")); @@ -124,10 +124,10 @@ public class TestRMNMInfo { Assert.assertNotNull(n.get("NumContainers")); Assert.assertEquals( n.get("NodeId") + ": Unexpected number of used containers", - 0, n.get("NumContainers").getValueAsInt()); + 0, n.get("NumContainers").asInt()); Assert.assertEquals( n.get("NodeId") + ": Unexpected amount of used memory", - 0, n.get("UsedMemoryMB").getValueAsInt()); + 0, n.get("UsedMemoryMB").asInt()); Assert.assertNotNull(n.get("AvailableMemoryMB")); } } @@ -153,7 +153,7 @@ public class TestRMNMInfo { Assert.assertNotNull(n.get("HostName")); Assert.assertNotNull(n.get("Rack")); Assert.assertTrue("Node " + n.get("NodeId") + " should be RUNNING", - n.get("State").getValueAsText().contains("RUNNING")); + n.get("State").asText().contains("RUNNING")); Assert.assertNotNull(n.get("NodeHTTPAddress")); Assert.assertNotNull(n.get("LastHealthUpdate")); Assert.assertNotNull(n.get("HealthReport")); diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 5d3d27824a7..a9a0d4b4a32 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -625,22 +625,22 @@ org.codehaus.jackson jackson-mapper-asl - 1.8.8 + 1.9.13 org.codehaus.jackson jackson-core-asl - 1.8.8 + 1.9.13 org.codehaus.jackson jackson-jaxrs - 1.8.8 + 1.9.13 org.codehaus.jackson jackson-xc - 1.8.8 + 1.9.13 org.mockito diff --git a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/state/StateDeserializer.java b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/state/StateDeserializer.java index 4f9cc9d0ee4..47ceb8e8a70 100644 --- a/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/state/StateDeserializer.java +++ b/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/state/StateDeserializer.java @@ -24,7 +24,7 @@ import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.DeserializationContext; import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.deser.StdDeserializer; +import org.codehaus.jackson.map.deser.std.StdDeserializer; import org.codehaus.jackson.node.ObjectNode; /** diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/RumenToSLSConverter.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/RumenToSLSConverter.java index 7bccd80f5f7..567963412b1 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/RumenToSLSConverter.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/RumenToSLSConverter.java @@ -120,7 +120,7 @@ public class RumenToSLSConverter { Writer output = new FileWriter(outputFile); try { ObjectMapper mapper = new ObjectMapper(); - ObjectWriter writer = mapper.defaultPrettyPrintingWriter(); + ObjectWriter writer = mapper.writerWithDefaultPrettyPrinter(); Iterator i = mapper.readValues( new JsonFactory().createJsonParser(input), Map.class); while (i.hasNext()) { @@ -141,7 +141,7 @@ public class RumenToSLSConverter { Writer output = new FileWriter(outputFile); try { ObjectMapper mapper = new ObjectMapper(); - ObjectWriter writer = mapper.defaultPrettyPrintingWriter(); + ObjectWriter writer = mapper.writerWithDefaultPrettyPrinter(); for (Map.Entry> entry : rackNodeMap.entrySet()) { Map rack = new LinkedHashMap(); rack.put("rack", entry.getKey()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java index 35d85602b0d..324c6f663d5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/timeline/TimelineUtils.java @@ -43,8 +43,7 @@ public class TimelineUtils { mapper = new ObjectMapper(); AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(); mapper.setAnnotationIntrospector(introspector); - mapper.getSerializationConfig() - .setSerializationInclusion(Inclusion.NON_NULL); + mapper.setSerializationInclusion(Inclusion.NON_NULL); } /** @@ -77,7 +76,7 @@ public class TimelineUtils { public static String dumpTimelineRecordtoJSON(Object o, boolean pretty) throws JsonGenerationException, JsonMappingException, IOException { if (pretty) { - return mapper.defaultPrettyPrintingWriter().writeValueAsString(o); + return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(o); } else { return mapper.writeValueAsString(o); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java index 100e91f7c8c..ac0ea7f9832 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java @@ -51,8 +51,7 @@ public class YarnJacksonJaxbJsonProvider extends JacksonJaxbJsonProvider { ObjectMapper mapper = super.locateMapper(type, mediaType); AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(); mapper.setAnnotationIntrospector(introspector); - mapper.getSerializationConfig() - .setSerializationInclusion(Inclusion.NON_NULL); + mapper.setSerializationInclusion(Inclusion.NON_NULL); return mapper; } } \ No newline at end of file