@@ -47,7 +47,7 @@ LeaseMgrFactory::create(const std::string& dbaccess) {
47
47
DatabaseConnection::ParameterMap parameters = DatabaseConnection::parse (dbaccess);
48
48
std::string redacted = DatabaseConnection::redactedAccessString (parameters);
49
49
50
- // Get the database type and open the corresponding database
50
+ // Get the database type and open the corresponding database.
51
51
DatabaseConnection::ParameterMap::iterator it = parameters.find (type);
52
52
if (it == parameters.end ()) {
53
53
LOG_ERROR (dhcpsrv_logger, DHCPSRV_NOTYPE_DB).arg (dbaccess);
@@ -88,8 +88,7 @@ LeaseMgrFactory::create(const std::string& dbaccess) {
88
88
89
89
// No match?
90
90
if (index == map_.end ()) {
91
- if ((db_type == " mysql" ) ||
92
- (db_type == " postgresql" )) {
91
+ if ((db_type == " mysql" ) || (db_type == " postgresql" )) {
93
92
LOG_ERROR (dhcpsrv_logger, DHCPSRV_UNKNOWN_DB).arg (db_type);
94
93
string with = (db_type == " postgresql" ? " pgsql" : db_type);
95
94
isc_throw (InvalidType, " The Kea server has not been compiled with "
@@ -106,10 +105,10 @@ LeaseMgrFactory::create(const std::string& dbaccess) {
106
105
// Call the factory.
107
106
getLeaseMgrPtr () = index->second (parameters);
108
107
109
- // Check the factory did not return NULL .
108
+ // Check the factory did not return null .
110
109
if (!getLeaseMgrPtr ()) {
111
110
isc_throw (Unexpected, " Lease database " << db_type <<
112
- " factory returned NULL " );
111
+ " factory returned null " );
113
112
}
114
113
}
115
114
@@ -159,7 +158,7 @@ LeaseMgrFactory::haveInstance() {
159
158
TrackingLeaseMgr&
160
159
LeaseMgrFactory::instance () {
161
160
TrackingLeaseMgr* lmptr = getLeaseMgrPtr ().get ();
162
- if (lmptr == NULL ) {
161
+ if (! lmptr) {
163
162
isc_throw (NoLeaseManager, " no current lease manager is available" );
164
163
}
165
164
return (*lmptr);
@@ -208,14 +207,18 @@ LeaseMgrFactory::registeredFactory(const std::string& db_type) {
208
207
}
209
208
210
209
void
211
- LeaseMgrFactory::printRegistered () {
210
+ LeaseMgrFactory::logRegistered () {
212
211
std::stringstream txt;
213
212
214
213
for (auto const & x : map_) {
215
- txt << x.first << " " ;
214
+ if (!txt.str ().empty ()) {
215
+ txt << " " ;
216
+ }
217
+ txt << x.first ;
216
218
}
217
219
218
- LOG_INFO (dhcpsrv_logger, DHCPSRV_LEASE_MGR_BACKENDS_REGISTERED).arg (txt.str ());
220
+ LOG_INFO (dhcpsrv_logger, DHCPSRV_LEASE_MGR_BACKENDS_REGISTERED)
221
+ .arg (txt.str ());
219
222
}
220
223
221
224
} // namespace dhcp
0 commit comments