Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-89

Calling Replicator#stop() on a replicator that hasn't started throws NPE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.6.0
    • 2.5.0, 2.1.0, 2.1.5, 2.1.2, 2.0.0, 2.0.2
    • Java-Android
    • Security Level: Public
    • None

    Description

      Following on from CBL-88, the idea for a quick workaround of just trying to stop the replicator anyway also fails as we hit a different NPE in checking the activity level (potentially the same root cause though - that the status is null)

      Basic repro:

      public class MainActivity extends AppCompatActivity {
       
          Database db;
          Replicator r;
          URI u;
       
          @Override
          protected void onCreate (Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
       
              DatabaseConfiguration dbc = new DatabaseConfiguration(this);
              try {
                  db = new Database("test", dbc);
              } catch (CouchbaseLiteException e) {
                  e.printStackTrace();
              }
       
              try {
                  u = new URI("ws://localhost");
              } catch (URISyntaxException e) {
                  e.printStackTrace();
              }
              ReplicatorConfiguration rpc = new ReplicatorConfiguration(db, new URLEndpoint(u));
       
              r = new Replicator(rpc);
              try {
                  r.getStatus();
              } catch (NullPointerException e) {
                  e.printStackTrace();// CBL-88
              }
              r.stop();
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            The Lite The Lite
            James Flather James Flather (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty