This is an automated email from the ASF dual-hosted git repository.
nagarwal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git
The following commit(s) were added to refs/heads/master by this push:
new e103165 [CLEAN] replace utf-8 constant with StandardCharsets.UTF_8
e103165 is described below
commit e1031650833e3d359e00473884ceac272eac3afa
Author: lamber-ken <[email protected]>
AuthorDate: Wed Jan 8 11:12:10 2020 +0800
[CLEAN] replace utf-8 constant with StandardCharsets.UTF_8
---
.../main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java | 4 ++--
.../src/main/java/org/apache/hudi/common/util/HoodieAvroUtils.java | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java
b/hudi-common/src/main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java
index fcca320..f16ef2f 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java
@@ -30,7 +30,7 @@ import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.Serializable;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -327,7 +327,7 @@ public class HoodieCommitMetadata implements Serializable {
public static <T> T fromBytes(byte[] bytes, Class<T> clazz) throws
IOException {
try {
- return fromJsonString(new String(bytes, Charset.forName("utf-8")),
clazz);
+ return fromJsonString(new String(bytes, StandardCharsets.UTF_8), clazz);
} catch (Exception e) {
throw new IOException("unable to read commit metadata", e);
}
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieAvroUtils.java
b/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieAvroUtils.java
index 40f907a..d030ce8 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieAvroUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/util/HoodieAvroUtils.java
@@ -40,6 +40,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -217,7 +218,7 @@ public class HoodieAvroUtils {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
OutputStream out = new DeflaterOutputStream(baos);
- out.write(text.getBytes("UTF-8"));
+ out.write(text.getBytes(StandardCharsets.UTF_8));
out.close();
} catch (IOException e) {
throw new HoodieIOException("IOException while compressing text " +
text, e);
@@ -234,7 +235,7 @@ public class HoodieAvroUtils {
while ((len = in.read(buffer)) > 0) {
baos.write(buffer, 0, len);
}
- return new String(baos.toByteArray(), "UTF-8");
+ return new String(baos.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
throw new HoodieIOException("IOException while decompressing text", e);
}