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

NPE in DBTCPConnector#_error method

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.3
    • None
    • None

    Description

      Steps to reproduce:

      • stop mongod service (single machine deployment)
      • use a driver

      java.lang.NullPointerException
      	at com.mongodb.DBTCPConnector._error(DBTCPConnector.java:287)
      	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:213)
      	at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:296)
      	at com.mongodb.DBCursor._check(DBCursor.java:356)
      	at com.mongodb.DBCursor._hasNext(DBCursor.java:486)
      	at com.mongodb.DBCursor.hasNext(DBCursor.java:511)

      The _error method doesn't count that _rsStatus might be null.

          boolean _error( Throwable t, boolean slaveOk )
              throws MongoException {
              if ( _rsStatus.hasServerUp() ){
                  // the replset has at least 1 server up, try to see if should switch master
                  checkMaster( true , !slaveOk );
              }
              return _rsStatus.hasServerUp();
          }

      Attachments

        Activity

          People

            antoine Antoine Girbal
            dagi Roman Pichlik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: