You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by da...@apache.org on 2023/08/21 11:34:41 UTC

[jackrabbit-oak] branch OAK-10410 created (now 525c688de0)

This is an automated email from the ASF dual-hosted git repository.

daim pushed a change to branch OAK-10410
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at 525c688de0 OAK-10410 : fixed potential NPE from AbstractMongoConnectionTest

This branch includes the following new commits:

     new 525c688de0 OAK-10410 : fixed potential NPE from AbstractMongoConnectionTest

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[jackrabbit-oak] 01/01: OAK-10410 : fixed potential NPE from AbstractMongoConnectionTest

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch OAK-10410
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 525c688de0272eb4746d330cac57b94d4ba7c4bc
Author: Rishabh Kumar <di...@adobe.com>
AuthorDate: Mon Aug 21 17:04:28 2023 +0530

    OAK-10410 : fixed potential NPE from AbstractMongoConnectionTest
---
 .../oak/plugins/document/AbstractMongoConnectionTest.java     | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractMongoConnectionTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractMongoConnectionTest.java
index 0a0b45a06a..de14377f85 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractMongoConnectionTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractMongoConnectionTest.java
@@ -26,6 +26,8 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 
+import static java.util.Objects.nonNull;
+
 /**
  * Base class for test cases that need a {@link MongoConnection}
  * to a clean test database. Tests in subclasses are automatically
@@ -76,9 +78,14 @@ public abstract class AbstractMongoConnectionTest extends DocumentMKTestBase {
 
     @After
     public void tearDownConnection() throws Exception {
-        String dbName = mongoConnection.getDBName();
+        String dbName = null;
+        if (nonNull(mongoConnection)) {
+            dbName = mongoConnection.getDBName();
+        }
         mk.dispose();
-        MongoUtils.dropCollections(dbName);
+        if (nonNull(dbName)) {
+            MongoUtils.dropCollections(dbName);
+        }
         Revision.resetClockToDefault();
         ClusterNodeInfo.resetClockToDefault();
     }