HADOOP-11378. Fix new findbugs warnings in hadoop-kms. Contributed by Li Lu.

This commit is contained in:
Haohui Mai 2014-12-09 13:10:03 -08:00
parent 6df457a3d7
commit 1340617535
2 changed files with 5 additions and 1 deletions

View File

@ -550,6 +550,8 @@ Release 2.7.0 - UNRELEASED
HADOOP-11379. Fix new findbugs warnings in hadoop-auth*. (Li Lu via wheat9) HADOOP-11379. Fix new findbugs warnings in hadoop-auth*. (Li Lu via wheat9)
HADOOP-11378. Fix new findbugs warnings in hadoop-kms. (Li Lu via wheat9)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -32,6 +32,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -62,7 +63,8 @@ public class KMSJSONWriter implements MessageBodyWriter<Object> {
Annotation[] annotations, MediaType mediaType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> stringObjectMultivaluedMap, MultivaluedMap<String, Object> stringObjectMultivaluedMap,
OutputStream outputStream) throws IOException, WebApplicationException { OutputStream outputStream) throws IOException, WebApplicationException {
Writer writer = new OutputStreamWriter(outputStream); Writer writer = new OutputStreamWriter(outputStream, Charset
.forName("UTF-8"));
ObjectMapper jsonMapper = new ObjectMapper(); ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj); jsonMapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);
} }