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

NPE in DBTCPConnector#_error method

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.3
    • Component/s: None
    • Labels:
      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 Antoine Girbal
            Reporter:
            dagi Roman Pichlik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: