Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1618

BasicBSONList doesn't support zero-length "" key

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.0.0
    • Affects Version/s: 2.12.3
    • Component/s: BSON
    • Environment:
      Windows mongodb 2.6.6 and java-driver 2.12.4
      not checked other platform

      make data by c-driver

      bson_append_array_begin( &bson, "array", -1, &bson_array );
      bson_append_int32( &bson_array, "", -1, 1 );
      bson_append_int32( &bson_array, "", -1, 2 );
      bson_append_array_end( &bson, &bson_array );
      
      view

      mongo cli work
      csharp-driver work

      but java-driver got exception

      java.lang.IllegalArgumentException: BasicBSONList can only work with numeric keys, not: []
      at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:165)
      at org.bson.types.BasicBSONList._getInt(BasicBSONList.java:156)
      at org.bson.types.BasicBSONList.put(BasicBSONList.java:70)
      at org.bson.BasicBSONCallback._put(BasicBSONCallback.java:184)
      at org.bson.BasicBSONCallback.gotLong(BasicBSONCallback.java:132)
      at org.bson.BasicBSONDecoder.decodeElement(BasicBSONDecoder.java:222)
      at org.bson.BasicBSONDecoder.decodeElement(BasicBSONDecoder.java:271)
      at org.bson.BasicBSONDecoder._decode(BasicBSONDecoder.java:154)
      at org.bson.BasicBSONDecoder.decode(BasicBSONDecoder.java:132)
      at com.mongodb.DefaultDBDecoder.decode(DefaultDBDecoder.java:62)
      at com.mongodb.Response.<init>(Response.java:85)
      at com.mongodb.DBPort$1.execute(DBPort.java:141)
      at com.mongodb.DBPort$1.execute(DBPort.java:135)
      at com.mongodb.DBPort.doOperation(DBPort.java:164)
      at com.mongodb.DBPort.call(DBPort.java:135)
      at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:292)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:271)
      at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
      at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66)
      at com.mongodb.DBCursor._check(DBCursor.java:458)
      at com.mongodb.DBCursor._hasNext(DBCursor.java:546)
      at com.mongodb.DBCursor.hasNext(DBCursor.java:571)
      at com.edgytech.umongo.CollectionPanel$1.doRun(CollectionPanel.java:259)
      at com.edgytech.umongo.DbJob$1.doInBackground(DbJob.java:86)
      at javax.swing.SwingWorker$1.call(SwingWorker.java:277)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at javax.swing.SwingWorker.run(SwingWorker.java:316)
      at com.edgytech.swingfast.ScalableThreadPool$ScalableThreadpoolWorker.run(ScalableThreadPool.java:48)
      at java.lang.Thread.run(Thread.java:662)

            Assignee:
            Unassigned Unassigned
            Reporter:
            KK.Kon Kiyofumi Kondoh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: