You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/01/11 18:40:34 UTC

[GitHub] merlimat commented on issue #3362: java.lang.IllegalArgumentException: Illegal base64 character 2d

merlimat commented on issue #3362: java.lang.IllegalArgumentException: Illegal base64 character 2d
URL: https://github.com/apache/pulsar/issues/3362#issuecomment-453615684
 
 
   @sautran The code there should be like : 
   
   ```java
    private K getKey(String topic, Message<byte[]> msg) {
           if (!msg.hasKey()) {
               return null;
           }
   
           if (keyDeserializer instanceof StringDeserializer) {
               return (K) msg.getKey();
           } else {
               // Assume base64 encoding
               byte[] data = Base64.getDecoder().decode(msg.getKey());
               return keyDeserializer.deserialize(topic, data);
           }
       }
   ```
   
   Did you set the `StringDeserializer` for the key?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services