HADOOP-15299. Bump Jackson 2 version to Jackson 2.9.x.
This commit is contained in:
parent
24bc5e0e4d
commit
82665a7887
|
@ -69,7 +69,7 @@
|
|||
|
||||
<!-- jackson versions -->
|
||||
<jackson.version>1.9.13</jackson.version>
|
||||
<jackson2.version>2.7.8</jackson2.version>
|
||||
<jackson2.version>2.9.4</jackson2.version>
|
||||
|
||||
<!-- SLF4J version -->
|
||||
<slf4j.version>1.7.25</slf4j.version>
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
package org.apache.hadoop.tools.rumen.state;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
@ -216,7 +216,7 @@ public class StatePool {
|
|||
// register the module with the object-mapper
|
||||
mapper.registerModule(module);
|
||||
|
||||
JsonParser parser = mapper.getFactory().createParser((DataInputStream)in);
|
||||
JsonParser parser = mapper.getFactory().createParser((InputStream)in);
|
||||
StatePool statePool = mapper.readValue(parser, StatePool.class);
|
||||
this.setStates(statePool.getStates());
|
||||
parser.close();
|
||||
|
@ -285,7 +285,7 @@ public class StatePool {
|
|||
|
||||
JsonFactory outFactory = outMapper.getFactory();
|
||||
JsonGenerator jGen =
|
||||
outFactory.createGenerator((DataOutputStream)out, JsonEncoding.UTF8);
|
||||
outFactory.createGenerator((OutputStream)out, JsonEncoding.UTF8);
|
||||
jGen.useDefaultPrettyPrinter();
|
||||
|
||||
jGen.writeObject(this);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.hadoop.tools.rumen;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonEncoding;
|
||||
|
@ -142,7 +143,7 @@ public class TestHistograms {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonFactory factory = mapper.getFactory();
|
||||
FSDataOutputStream ostream = lfs.create(goldFilePath, true);
|
||||
JsonGenerator gen = factory.createGenerator(ostream,
|
||||
JsonGenerator gen = factory.createGenerator((OutputStream)ostream,
|
||||
JsonEncoding.UTF8);
|
||||
gen.useDefaultPrettyPrinter();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.client.api.impl;
|
|||
import java.io.Closeable;
|
||||
import java.io.Flushable;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -374,7 +375,8 @@ public class FileSystemTimelineWriter extends TimelineWriter{
|
|||
|
||||
protected void prepareForWrite() throws IOException{
|
||||
this.stream = createLogFileStream(fs, logPath);
|
||||
this.jsonGenerator = new JsonFactory().createGenerator(stream);
|
||||
this.jsonGenerator = new JsonFactory().createGenerator(
|
||||
(OutputStream)stream);
|
||||
this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||
this.lastModifiedTime = Time.monotonicNow();
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
abstract class LogInfo {
|
||||
|
@ -140,7 +141,7 @@ abstract class LogInfo {
|
|||
try {
|
||||
in.seek(offset);
|
||||
try {
|
||||
parser = jsonFactory.createParser(in);
|
||||
parser = jsonFactory.createParser((InputStream)in);
|
||||
parser.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
|
||||
} catch (IOException e) {
|
||||
// if app hasn't completed then there may be errors due to the
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
|
|||
import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
|
@ -232,7 +233,7 @@ public class PluginStoreTestUtils {
|
|||
FileSystem fs) throws IOException {
|
||||
FSDataOutputStream outStream = createLogFile(logPath, fs);
|
||||
JsonGenerator jsonGenerator
|
||||
= new JsonFactory().createGenerator(outStream);
|
||||
= new JsonFactory().createGenerator((OutputStream)outStream);
|
||||
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||
ObjectMapper objMapper = createObjectMapper();
|
||||
for (TimelineEntity entity : entities.getEntities()) {
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
@ -232,7 +233,8 @@ public class TestLogInfo {
|
|||
throws IOException {
|
||||
if (outStream == null) {
|
||||
outStream = PluginStoreTestUtils.createLogFile(logPath, fs);
|
||||
jsonGenerator = new JsonFactory().createGenerator(outStream);
|
||||
jsonGenerator = new JsonFactory().createGenerator(
|
||||
(OutputStream)outStream);
|
||||
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||
}
|
||||
for (TimelineEntity entity : entities.getEntities()) {
|
||||
|
@ -248,7 +250,7 @@ public class TestLogInfo {
|
|||
}
|
||||
// Write domain uses its own json generator to isolate from entity writers
|
||||
JsonGenerator jsonGeneratorLocal
|
||||
= new JsonFactory().createGenerator(outStreamDomain);
|
||||
= new JsonFactory().createGenerator((OutputStream)outStreamDomain);
|
||||
jsonGeneratorLocal.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||
objMapper.writeValue(jsonGeneratorLocal, domain);
|
||||
outStreamDomain.hflush();
|
||||
|
|
Loading…
Reference in New Issue