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 versions -->
|
||||||
<jackson.version>1.9.13</jackson.version>
|
<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 -->
|
||||||
<slf4j.version>1.7.25</slf4j.version>
|
<slf4j.version>1.7.25</slf4j.version>
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
package org.apache.hadoop.tools.rumen.state;
|
package org.apache.hadoop.tools.rumen.state;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -216,7 +216,7 @@ private void read(DataInput in) throws IOException {
|
|||||||
// register the module with the object-mapper
|
// register the module with the object-mapper
|
||||||
mapper.registerModule(module);
|
mapper.registerModule(module);
|
||||||
|
|
||||||
JsonParser parser = mapper.getFactory().createParser((DataInputStream)in);
|
JsonParser parser = mapper.getFactory().createParser((InputStream)in);
|
||||||
StatePool statePool = mapper.readValue(parser, StatePool.class);
|
StatePool statePool = mapper.readValue(parser, StatePool.class);
|
||||||
this.setStates(statePool.getStates());
|
this.setStates(statePool.getStates());
|
||||||
parser.close();
|
parser.close();
|
||||||
@ -285,7 +285,7 @@ private void write(DataOutput out) throws IOException {
|
|||||||
|
|
||||||
JsonFactory outFactory = outMapper.getFactory();
|
JsonFactory outFactory = outMapper.getFactory();
|
||||||
JsonGenerator jGen =
|
JsonGenerator jGen =
|
||||||
outFactory.createGenerator((DataOutputStream)out, JsonEncoding.UTF8);
|
outFactory.createGenerator((OutputStream)out, JsonEncoding.UTF8);
|
||||||
jGen.useDefaultPrettyPrinter();
|
jGen.useDefaultPrettyPrinter();
|
||||||
|
|
||||||
jGen.writeObject(this);
|
jGen.writeObject(this);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.hadoop.tools.rumen;
|
package org.apache.hadoop.tools.rumen;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonEncoding;
|
import com.fasterxml.jackson.core.JsonEncoding;
|
||||||
@ -142,7 +143,7 @@ public static void main(String[] args) throws IOException {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
JsonFactory factory = mapper.getFactory();
|
JsonFactory factory = mapper.getFactory();
|
||||||
FSDataOutputStream ostream = lfs.create(goldFilePath, true);
|
FSDataOutputStream ostream = lfs.create(goldFilePath, true);
|
||||||
JsonGenerator gen = factory.createGenerator(ostream,
|
JsonGenerator gen = factory.createGenerator((OutputStream)ostream,
|
||||||
JsonEncoding.UTF8);
|
JsonEncoding.UTF8);
|
||||||
gen.useDefaultPrettyPrinter();
|
gen.useDefaultPrettyPrinter();
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.Flushable;
|
import java.io.Flushable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -374,7 +375,8 @@ public long getLastModifiedTime() {
|
|||||||
|
|
||||||
protected void prepareForWrite() throws IOException{
|
protected void prepareForWrite() throws IOException{
|
||||||
this.stream = createLogFileStream(fs, logPath);
|
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.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||||
this.lastModifiedTime = Time.monotonicNow();
|
this.lastModifiedTime = Time.monotonicNow();
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
abstract class LogInfo {
|
abstract class LogInfo {
|
||||||
@ -140,7 +141,7 @@ private long parsePath(TimelineDataManager tdm, Path logPath,
|
|||||||
try {
|
try {
|
||||||
in.seek(offset);
|
in.seek(offset);
|
||||||
try {
|
try {
|
||||||
parser = jsonFactory.createParser(in);
|
parser = jsonFactory.createParser((InputStream)in);
|
||||||
parser.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
|
parser.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// if app hasn't completed then there may be errors due to the
|
// if app hasn't completed then there may be errors due to the
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
|
import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
@ -232,7 +233,7 @@ static void writeEntities(TimelineEntities entities, Path logPath,
|
|||||||
FileSystem fs) throws IOException {
|
FileSystem fs) throws IOException {
|
||||||
FSDataOutputStream outStream = createLogFile(logPath, fs);
|
FSDataOutputStream outStream = createLogFile(logPath, fs);
|
||||||
JsonGenerator jsonGenerator
|
JsonGenerator jsonGenerator
|
||||||
= new JsonFactory().createGenerator(outStream);
|
= new JsonFactory().createGenerator((OutputStream)outStream);
|
||||||
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||||
ObjectMapper objMapper = createObjectMapper();
|
ObjectMapper objMapper = createObjectMapper();
|
||||||
for (TimelineEntity entity : entities.getEntities()) {
|
for (TimelineEntity entity : entities.getEntities()) {
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
@ -232,7 +233,8 @@ private void writeEntitiesLeaveOpen(TimelineEntities entities, Path logPath)
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
if (outStream == null) {
|
if (outStream == null) {
|
||||||
outStream = PluginStoreTestUtils.createLogFile(logPath, fs);
|
outStream = PluginStoreTestUtils.createLogFile(logPath, fs);
|
||||||
jsonGenerator = new JsonFactory().createGenerator(outStream);
|
jsonGenerator = new JsonFactory().createGenerator(
|
||||||
|
(OutputStream)outStream);
|
||||||
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||||
}
|
}
|
||||||
for (TimelineEntity entity : entities.getEntities()) {
|
for (TimelineEntity entity : entities.getEntities()) {
|
||||||
@ -248,7 +250,7 @@ private void writeDomainLeaveOpen(TimelineDomain domain, Path logPath)
|
|||||||
}
|
}
|
||||||
// Write domain uses its own json generator to isolate from entity writers
|
// Write domain uses its own json generator to isolate from entity writers
|
||||||
JsonGenerator jsonGeneratorLocal
|
JsonGenerator jsonGeneratorLocal
|
||||||
= new JsonFactory().createGenerator(outStreamDomain);
|
= new JsonFactory().createGenerator((OutputStream)outStreamDomain);
|
||||||
jsonGeneratorLocal.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
jsonGeneratorLocal.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
|
||||||
objMapper.writeValue(jsonGeneratorLocal, domain);
|
objMapper.writeValue(jsonGeneratorLocal, domain);
|
||||||
outStreamDomain.hflush();
|
outStreamDomain.hflush();
|
||||||
|
Loading…
Reference in New Issue
Block a user