diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 128964650d..d9c796322a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -326,6 +326,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 2d67426ba8..9345098990 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 @@ public NamenodeStatus getNamenodeStatus(String props) throws IOException, 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 @@ private void getDecomNodeInfoForReport( 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 4ac1f86b57..afd6d47319 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 void testRMNMInfo() throws Exception { 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 void testRMNMInfo() throws Exception { 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 void testRMNMInfoMissmatch() throws Exception { 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 b5337f1261..a44a390d52 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -631,22 +631,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 4f9cc9d0ee..47ceb8e8a7 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.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 7bccd80f5f..567963412b 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 @@ private static void generateSLSLoadFile(String inputFile, String outputFile) 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 @@ private static void generateSLSNodeFile(String outputFile) 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 35d85602b0..324c6f663d 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 static String dumpTimelineRecordtoJSON(Object o) 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 100e91f7c8..ac0ea7f983 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 ObjectMapper locateMapper(Class type, MediaType mediaType) { 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