sonar 대응

This commit is contained in:
현성필
2023-08-22 14:28:51 +09:00
parent 1063aaf19e
commit 1d45c8a6b5
3 changed files with 18 additions and 29 deletions
@@ -49,15 +49,11 @@ public class NettyApiClient {
.option(ChannelOption.TCP_NODELAY, true)
.handler(new ChannelInitializer<Channel>() {
@Override
public void initChannel(Channel ch) {
public void initChannel(Channel ch) throws SSLException {
if (server.getScheme().equalsIgnoreCase("https")) {
try {
final SslContext sslCtx = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).build();
ch.pipeline().addLast(sslCtx.newHandler(ch.alloc(), host, port));// Add SSL handler
} catch (SSLException e) {
throw new RuntimeException(e);
}
final SslContext sslCtx = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).build();
ch.pipeline().addLast(sslCtx.newHandler(ch.alloc(), host, port));// Add SSL handler
}
ch.pipeline().addLast(new HttpClientCodec());
@@ -91,7 +87,7 @@ public class NettyApiClient {
if (!apiRequest.getHeaders().isEmpty()) {
HttpHeaders customHeaders = new DefaultHttpHeaders();
apiRequest.getHeaders().stream().filter(ApiRequestKeyValueDTO::isEnabled).forEach(header -> {
if(StringUtils.isNotEmpty(header.getKey()) && StringUtils.isNotEmpty(header.getValue())){
if (StringUtils.isNotEmpty(header.getKey()) && StringUtils.isNotEmpty(header.getValue())) {
customHeaders.set(header.getKey(), header.getValue());
}
});