NPE in DBTCPConnector#_error method

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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();
          }
      

              Assignee:
              Antoine Girbal (Inactive)
              Reporter:
              Roman Pichlik
              None
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: