@@ -30,11 +30,12 @@ public class ManageClient extends LoggingObject {
3030 private RestTemplate securityUserRestTemplate ;
3131 private PayloadParser payloadParser ;
3232
33- /**
34- * Can use this constructor when the default values in ManageConfig will work.
35- */
33+ /**
34+ * Creates an uninitialized instance that requires a {@code ManageConfig} to be provided in order to be operable.
35+ *
36+ * @deprecated since 4.5.0; will be removed in 5.0.0
37+ */
3638 public ManageClient () {
37- this (new ManageConfig ());
3839 }
3940
4041 public ManageClient (ManageConfig config ) {
@@ -266,23 +267,27 @@ public HttpEntity<String> buildXmlEntity(String xml) {
266267
267268 protected void logRequest (String path , String contentType , String method ) {
268269 if (logger .isInfoEnabled ()) {
269- String username = manageConfig != null ? manageConfig .getUsername () : "(unknown)" ;
270- logger .info (String .format ("Sending %s %s request as user '%s' to path: %s" , contentType , method , username , buildUri (path )));
270+ String username = manageConfig != null ?
271+ String .format ("as user '%s' " , manageConfig .getUsername ()) : "" ;
272+ logger .info ("Sending {} {} request {}to path: {}" , contentType , method , username , buildUri (path ));
271273 }
272274 }
273275
274276 protected void logSecurityUserRequest (String path , String contentType , String method ) {
275277 if (logger .isInfoEnabled ()) {
276- logger .info (String .format ("Sending %s %s request as user '%s' (who should have the 'manage-admin' and 'security' roles) to path: %s" ,
277- contentType , method , determineUsernameForSecurityUserRequest (), buildUri (path )));
278+ String username = determineUsernameForSecurityUserRequest ();
279+ if (!"" .equals (username )) {
280+ username = String .format ("as user '%s' (who should have the 'manage-admin' and 'security' roles) " , username );
281+ }
282+ logger .info ("Sending {} {} request {}to path: {}" , contentType , method , username , buildUri (path ));
278283 }
279284 }
280285
281286 protected String determineUsernameForSecurityUserRequest () {
282- String username = "(unknown) " ;
287+ String username = "" ;
283288 if (manageConfig != null ) {
284289 username = manageConfig .getSecurityUsername ();
285- if (StringUtils .isEmpty (username )) {
290+ if (! StringUtils .hasText (username )) {
286291 username = manageConfig .getUsername ();
287292 }
288293 }
0 commit comments