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

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.3
    • Component/s: None
    • Labels:
      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

          Hide
          jmorris Jeff Morris added a comment -

          Stefano Limonta - thanks for reporting!

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

            People

            • Assignee:
              jmorris Jeff Morris
              Reporter:
              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

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.