From c807b2abcfcfc22bf5acf04893c956629dff5812 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 29 Jan 2013 13:16:06 +0100 Subject: [PATCH] DATAMONGO-601 - Fixed exposing password by MongoDbUtils. MongoDbUtils is now not exposing the plain password in the exception message piped into CannotGetMongoDbConnectionException but uses the newly introduced toString() method of UserCredentials (see DATACMNS-275). --- .../org/springframework/data/mongodb/core/MongoDbUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java index b8fd5d34c..cc232cd2f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDbUtils.java @@ -112,8 +112,8 @@ public abstract class MongoDbUtils { String password = credentials.hasPassword() ? credentials.getPassword() : null; if (!db.authenticate(username, password == null ? null : password.toCharArray())) { - throw new CannotGetMongoDbConnectionException("Failed to authenticate to database [" + databaseName - + "], username = [" + username + "], password = [" + password + "]", databaseName, credentials); + throw new CannotGetMongoDbConnectionException("Failed to authenticate to database [" + databaseName + "], " + + credentials.toString(), databaseName, credentials); } } }