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

collection.remove() may return null when it should return WriteResult or throw an exception

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.5
    • API
    • None
    • Windows 7, MongoDB 1.8.2, Java Driver 2.6.5

    Description

      I'm experiencing <<null>> results when calling

      collection.remove(...)

      where the contract says that either a WriteResult is returned or an exception is thrown.

      I've tracked this down to DBTCPConnector#_checkWriteError that ends with

      WriteResult _checkWriteError( DB db , MyPort mp , DBPort port , WriteConcern concern )
      CommandResult e = null;
      e = port.runCommand( db , concern.getCommand() );
      if ( ! e.hasErr() )
      return new WriteResult( e , concern );
      e.throwOnError();
      return null;
      }

      if

      e.throwOnError();

      does not throw an exception ( ok() || !hasErr())

      return null;

      is returned.

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            cpesch Christian pesch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: