Index: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
===================================================================
--- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java	(revision 1750454)
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java	(working copy)
@@ -86,6 +86,7 @@
 import com.mongodb.BulkWriteOperation;
 import com.mongodb.BulkWriteResult;
 import com.mongodb.BulkWriteUpsert;
+import com.mongodb.CommandResult;
 import com.mongodb.DB;
 import com.mongodb.DBCollection;
 import com.mongodb.DBCursor;
@@ -1572,7 +1573,22 @@
         final long start = System.currentTimeMillis();
         // assumption here: server returns UTC - ie the returned
         // date object is correctly taking care of time zones.
-        final Date serverLocalTime = db.command("serverStatus").getDate("localTime");
+        final CommandResult serverStatus = db.command("serverStatus");
+        if (serverStatus == null) {
+            // OAK-4107 : extra safety
+            LOG.warn("determineServerTimeDifferenceMillis: db.serverStatus returned null - cannot determine time difference - assuming 0ms.");
+            return 0;
+        }
+        final Date serverLocalTime = serverStatus.getDate("localTime");
+        if (serverLocalTime == null) {
+        	// OAK-4107 : looks like this can happen - at least
+        	// has been seen once on mongo 3.0.9
+        	// let's handle this gently and issue a log.warn
+        	// instead of throwing a NPE
+        	LOG.warn("determineServerTimeDifferenceMillis: db.serverStatus.localTime returned null - cannot determine time difference - assuming 0ms. "
+        	        + "(Result details: exception=" + serverStatus.getException() + ", errorMessage=" + serverStatus.getErrorMessage() + ")");
+        	return 0;
+        }
         final long end = System.currentTimeMillis();
 
         final long midPoint = (start + end) / 2;
