@@ -157,7 +157,7 @@ private RestTemplate createRestTemplate(MarketplaceInstanceConfig config) {
157157 restTemplate .setRequestFactory (requestFactory );
158158
159159 if (config .isTrustAllCertificates ()) {
160- log .warn ("Trust all certificates is enabled for Marketplace connection. "
160+ log .warn ("Trust all certificates is enabled for Marketplace API connection. "
161161 + "This should only be used in development environments!" );
162162 configureTrustAllCertificates (restTemplate );
163163 }
@@ -171,7 +171,6 @@ private RestTemplate createRestTemplate(MarketplaceInstanceConfig config) {
171171 *
172172 * @param restTemplate RestTemplate to configure
173173 */
174- @ SuppressWarnings ({"java:S4830" , "java:S1186" })
175174 private void configureTrustAllCertificates (RestTemplate restTemplate ) {
176175 try {
177176 TrustManager [] trustAllCerts = new TrustManager []{
@@ -189,16 +188,15 @@ public void checkServerTrusted(X509Certificate[] certs, String authType) {
189188 }
190189 }
191190 };
192-
193191 SSLContext sslContext = SSLContext .getInstance ("TLS" );
194192 sslContext .init (null , trustAllCerts , new java .security .SecureRandom ());
195193
196194 HttpsURLConnection .setDefaultSSLSocketFactory (sslContext .getSocketFactory ());
197195 // Intentionally disabling hostname verification for development environments
198196 HttpsURLConnection .setDefaultHostnameVerifier ((hostname , session ) -> true );
199197
200- } catch (NoSuchAlgorithmException | KeyManagementException e ) {
201- log .error ("Failed to configure SSL trust all certificates" , e );
198+ } catch (NoSuchAlgorithmException | KeyManagementException ex ) {
199+ log .error ("Failed to configure SSL trust all certificates for Marketplace API " , ex );
202200 }
203201 }
204202}
0 commit comments