com.couchbase.lite.support.action.ActionException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.InputStream com.couchbase.lite.support.security.SymmetricKey.decryptStream(java.io.InputStream)' on a null object reference


#1

I am facing an issue while I am trying to replace a database and then encrypting it.

That’s my code:

boolean isSuccessfullyReplaced = mManager .replaceDatabase(dbName, sourcePath);
Database database = mManager.getDatabase(dbName);
database.changeEncryptionKey(Constants.ENCRYPTION_KEY);

When it calls changeEncryptionKey method it is throwing an exception:

com.couchbase.lite.support.action.ActionException: java.lang.NullPointerException: Attempt to invoke virtual method ‘java.io.InputStream com.couchbase.lite.support.security.SymmetricKey.decryptStream(java.io.InputStream)’ on a null object reference

It is working fine for a database but not for the other one.

Can anyone help me how to solve this.

FYI @deep.kulshreshtha @pankaj.sharma


#2

Couchbase lite version used is 1.4.1 and Sync gateway 2.0 Couchbase server 5.1.1.

@househippo Can you help on this. As because of this exception we need to revert back the CBL encryption.