Skip to content

Commit

Permalink
Merge pull request #2187 from shavinsenadheera/master
Browse files Browse the repository at this point in the history
Enhancing Debug Logs for Custom SSL Profile Workflow
  • Loading branch information
arunans23 authored Jul 11, 2024
2 parents ccd921b + 381dd3e commit 114603f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.net.ssl.SSLContext;

Expand All @@ -49,6 +51,7 @@
* particular server from the specified map it uses the default SSLContext.
*/
public class ClientConnFactory {
protected Log log = LogFactory.getLog(ClientConnFactory.class);;

private final HttpResponseFactory responseFactory;
private final ByteBufferAllocator allocator;
Expand Down Expand Up @@ -113,6 +116,9 @@ private SSLContext getSSLContextForHost(String host) {
if (customContext != null) {
return customContext;
} else {
if (log.isDebugEnabled()) {
log.debug("The sslByHostMap is null or Custom SSL context is null for the host : " + host);
}
return ssl != null ? ssl.getContext() : null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Arrays;

public class ClientConnFactoryBuilder {

Expand Down Expand Up @@ -251,6 +252,9 @@ private Map<String, SSLContext> getCustomSSLContexts(TransportOutDescription tra
}

String[] servers = serversElt.getText().split(",");
if (log.isDebugEnabled()) {
log.debug("Servers list of the custom SSL profile : " + Arrays.toString(servers));
}
OMElement ksElt = profile.getFirstChildWithName(new QName("KeyStore"));
OMElement trElt = profile.getFirstChildWithName(new QName("TrustStore"));
String noValCert = profile.getAttributeValue(new QName("novalidatecert"));
Expand All @@ -268,6 +272,9 @@ private Map<String, SSLContext> getCustomSSLContexts(TransportOutDescription tra
server = server.trim();
if (!contextMap.containsKey(server)) {
contextMap.put(server, sslContext);
if (log.isDebugEnabled()) {
log.debug("Update the SSL context map for the server: " + server);
}
} else {
if (log.isWarnEnabled()) {
log.warn(name + " Multiple SSL profiles were found for the server : " +
Expand Down

0 comments on commit 114603f

Please sign in to comment.