Skip to content

Commit

Permalink
Improve logging of server id
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Feb 2, 2024
1 parent 4433a8f commit 2c7e5f5
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ScmRepository getConfiguredRepository(String url, ReleaseDescriptor relea
if (releaseDescriptor.getScmId() != null) {
server = settings.getServer(releaseDescriptor.getScmId());
if (server == null) {
logger.warn("No server with id {} found in Maven settings", releaseDescriptor.getScmId());
logger.warn("No server with id '{}' found in Maven settings", releaseDescriptor.getScmId());
}
}

Expand All @@ -120,26 +120,26 @@ public ScmRepository getConfiguredRepository(String url, ReleaseDescriptor relea
if (server != null) {
if (username == null && server.getUsername() != null) {
logger.debug(
"Using username from server id {} found in Maven settings", releaseDescriptor.getScmId());
"Using username from server id '{}' found in Maven settings", releaseDescriptor.getScmId());
username = server.getUsername();
}

if (password == null && server.getPassword() != null) {
logger.debug(
"Using password from server id {} found in Maven settings", releaseDescriptor.getScmId());
"Using password from server id '{}' found in Maven settings", releaseDescriptor.getScmId());
password = decrypt(server.getPassword(), server.getId());
}

if (privateKey == null && server.getPrivateKey() != null) {
logger.debug(
"Using private key from server id {} found in Maven settings",
"Using private key from server id '{}' found in Maven settings",
releaseDescriptor.getScmId());
privateKey = server.getPrivateKey();
}

if (passphrase == null && server.getPassphrase() != null) {
logger.debug(
"Using passphrase from server id {} found in Maven settings", releaseDescriptor.getScmId());
"Using passphrase from server id '{}' found in Maven settings", releaseDescriptor.getScmId());
passphrase = decrypt(server.getPassphrase(), server.getId());
}
}
Expand Down Expand Up @@ -190,11 +190,11 @@ public ScmRepository getConfiguredRepository(String url, ReleaseDescriptor relea
return repository;
}

private String decrypt(String str, String server) {
private String decrypt(String str, String serverId) {
try {
return mavenCrypto.decrypt(str);
} catch (MavenCryptoException e) {
String msg = "Failed to decrypt password/passphrase for server " + server + ", using auth token as is: "
String msg = "Failed to decrypt password/passphrase for server with id '" + serverId + "', using auth token as is: "
+ e.getMessage();
if (logger.isDebugEnabled()) {
logger.warn(msg, e);
Expand Down

0 comments on commit 2c7e5f5

Please sign in to comment.