Github user arunmahadevan commented on a diff in the pull request:

    https://github.com/apache/storm/pull/894#discussion_r45563324
  
    --- Diff: external/storm-kafka/src/jvm/storm/kafka/StringScheme.java ---
    @@ -20,23 +20,27 @@
     import backtype.storm.spout.Scheme;
     import backtype.storm.tuple.Fields;
     import backtype.storm.tuple.Values;
    +import backtype.storm.utils.Utils;
     
    -import java.io.UnsupportedEncodingException;
    +import java.nio.ByteBuffer;
    +import java.nio.charset.Charset;
    +import java.nio.charset.StandardCharsets;
     import java.util.List;
     
     public class StringScheme implements Scheme {
    -
    +    private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
         public static final String STRING_SCHEME_KEY = "str";
     
    -    public List<Object> deserialize(byte[] bytes) {
    +    public List<Object> deserialize(ByteBuffer bytes) {
             return new Values(deserializeString(bytes));
         }
     
    -    public static String deserializeString(byte[] string) {
    -        try {
    -            return new String(string, "UTF-8");
    -        } catch (UnsupportedEncodingException e) {
    -            throw new RuntimeException(e);
    +    public static String deserializeString(ByteBuffer string) {
    +        if (!string.hasArray()) {
    --- End diff --
    
    I think this should be `if (string.hasArray())`



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to