eduardofontes commented on a change in pull request #4759:
URL: https://github.com/apache/nifi/pull/4759#discussion_r558257547
##########
File path:
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBControllerService.java
##########
@@ -105,7 +110,18 @@ public final void closeClient() {
}
protected String getURI(final ConfigurationContext context) {
- return
context.getProperty(URI).evaluateAttributeExpressions().getValue();
+ final 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();
+ if (!_uri.contains("@") && user != null && passw != null) {
+ try {
+ return _uri.replaceFirst("://", "://" +
URLEncoder.encode(user, StandardCharsets.UTF_8.toString()) + ":" +
URLEncoder.encode(passw, StandardCharsets.UTF_8.toString()) + "@");
+ } catch (final UnsupportedEncodingException e) {
Review comment:
I agree with a WARM, but I think it will never be triggered.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]