提交 71bcf9fa 编写于 作者: E Eddie Ringle

Fix usage of deprecated MimeUtil functions

Signed-off-by: NEddie Ringle <eddie@eringle.net>
上级 4b46e0cb
......@@ -421,7 +421,7 @@ public class RestAdapter {
}
byte[] bodyBytes = ((TypedByteArray) body).getBytes();
String bodyCharset = MimeUtil.parseCharset(body.mimeType());
String bodyCharset = MimeUtil.parseCharset(body.mimeType(), "UTF-8");
log.log(new String(bodyBytes, bodyCharset));
} else if (logLevel.ordinal() >= LogLevel.HEADERS_AND_ARGS.ordinal()) {
if (!request.getHeaders().isEmpty()) {
......@@ -468,7 +468,7 @@ public class RestAdapter {
byte[] bodyBytes = ((TypedByteArray) body).getBytes();
bodySize = bodyBytes.length;
String bodyMime = body.mimeType();
String bodyCharset = MimeUtil.parseCharset(bodyMime);
String bodyCharset = MimeUtil.parseCharset(bodyMime, "UTF-8");
log.log(new String(bodyBytes, bodyCharset));
}
}
......
......@@ -21,6 +21,7 @@ public class MimeUtilTest {
assertThat(parseCharset("text/plain; notthecharset=utf-16;", "UTF-8")).isEqualToIgnoringCase("UTF-8");
}
@SuppressWarnings("deprecation")
@Test public void oldCharsetParsing() {
assertThat(parseCharset("text/plain;charset=utf-8")).isEqualToIgnoringCase("UTF-8");
assertThat(parseCharset("text/plain; charset=utf-8")).isEqualToIgnoringCase("UTF-8");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册