Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2994

Put/get/put Puts double bytes on Java ByteBuffer

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      When putting bytes, getting those bytes, and then putting them again on the Java byte buffer, double the number of bytes are put onto the byte buffer. Consider the following

      Unable to find source-code formatter for language: ruby. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      (rdb:1) p @bytes.length
      1000033
      (rdb:1) eval buf = BSON::ByteBuffer.new
      #<BSON::ByteBuffer:0x7cbe3a05>
      (rdb:1) eval buf.put_bytes(@bytes)
      #<BSON::ByteBuffer:0x7cbe3a05>
      (rdb:1) p buf.length
      1000033
      (rdb:1) eval buf.get_bytes(@bytes.length).length
      1000033
      (rdb:1) p buf.length
      0
      (rdb:1) eval buf.put_bytes(@bytes)
      #<BSON::ByteBuffer:0x7cbe3a05>
      (rdb:1) p buf.length
      2000066
      

      At the end, the buffer is double the length we expect it to be.

            Assignee:
            Unassigned Unassigned
            Reporter:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: