Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • briar briar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 780
    • Issues 780
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 13
    • Merge requests 13
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • briar
  • briarbriar
  • Issues
  • #1576
Closed
Open
Created Jun 05, 2019 by akwizgran@akwizgranOwner

IllegalStateException when sharing remote contact link

The following crash happens when sharing a remote contact link from another app while signed out:

java.lang.IllegalStateException
        at org.briarproject.bramble.db.H2Database.createConnection(H2Database.java:94)
        at org.briarproject.bramble.db.JdbcDatabase.startTransaction(JdbcDatabase.java:547)
        at org.briarproject.bramble.db.JdbcDatabase.startTransaction(JdbcDatabase.java:96)
        at org.briarproject.bramble.db.DatabaseComponentImpl.startTransaction(DatabaseComponentImpl.java:160)
        at org.briarproject.bramble.db.DatabaseComponentImpl.transactionWithResult(DatabaseComponentImpl.java:207)
        at org.briarproject.bramble.contact.ContactManagerImpl.getHandshakeLink(ContactManagerImpl.java:138)
        at org.briarproject.briar.android.contact.add.remote.AddContactViewModel.lambda$loadHandshakeLink$0$AddContactViewModel(AddContactViewModel.java:62)

The cause is similar to #1482 (closed): we're accessing the DB before knowing whether we're signed in.

The solution we created for #1482 (closed) requires us to defer all database work until onResume(), and check isSignedIn() before doing any database work. The fact that we've seen a second bug so soon after fixing the first may suggest that it's going to be hard to remember those constraints in every case.

Another possible workaround would be for H2Database#createConnection() to throw a DbClosedException rather than an IllegalStateException if there's no DB key.

Assignee
Assign to
Time tracking