Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1555

Default Transcoder class - DecodeString method doesn't manage null string

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5.1
    • 2.5.3
    • None
    • None

    Description

      protected string DecodeString(byte[] buffer, int offset, int length)
      {
          var result = string.Empty;
          if (buffer != null && buffer.Length > 0 && length > 0)
          {
              result = Encoding.UTF8.GetString(buffer, offset, length);
          }
          return result;
      }
      

      When a null string is inserted with the Encode method the decodeString method used by Decode transform it in emptyString.

      So the Encode / Decode is not idempotent for the strings

      maybe is better to use string result= null instead of var result = string.Empty;

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          jmorris Jeff Morris added a comment -

          Stefano Limonta - thanks for reporting!

          jmorris Jeff Morris added a comment - Stefano Limonta - thanks for reporting!

          People

            jmorris Jeff Morris
            stefano.limonta Stefano Limonta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty