exceptionfactory commented on code in PR #9998:
URL: https://github.com/apache/nifi/pull/9998#discussion_r2159272493


##########
nifi-extension-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBControllerService.java:
##########
@@ -96,27 +99,53 @@ protected MongoClient createClient(ConfigurationContext 
context, MongoClient exi
         }
 
         try {
-            final String uri = 
context.getProperty(URI).evaluateAttributeExpressions().getValue();
+            String uri = 
context.getProperty(URI).evaluateAttributeExpressions().getValue();
             final String user = 
context.getProperty(DB_USER).evaluateAttributeExpressions().getValue();
             final String passw = 
context.getProperty(DB_PASSWORD).evaluateAttributeExpressions().getValue();
 
             final MongoClientSettings.Builder builder = 
MongoClientSettings.builder();
-            final ConnectionString cs = new ConnectionString(uri);
 
-            if (user != null && passw != null) {
-                final String database = cs.getDatabase() == null ? "admin" : 
cs.getDatabase();
+            // Regex to find authMechanism value (case-insensitive)
+            final Pattern authMechanismPattern = 
Pattern.compile("(?i)(?:[?&])authmechanism=([^&]*)");

Review Comment:
   This pattern can be defined in a static variable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to