@@ -36,7 +36,7 @@ class AadInstanceDiscoveryProvider {
3636 static final TreeSet <String > TRUSTED_HOSTS_SET = new TreeSet <>(String .CASE_INSENSITIVE_ORDER );
3737 static final TreeSet <String > TRUSTED_SOVEREIGN_HOSTS_SET = new TreeSet <>(String .CASE_INSENSITIVE_ORDER );
3838
39- private static final Logger log = LoggerFactory .getLogger (AadInstanceDiscoveryProvider .class );
39+ private static final Logger LOG = LoggerFactory .getLogger (AadInstanceDiscoveryProvider .class );
4040
4141 static ConcurrentHashMap <String , InstanceDiscoveryMetadataEntry > cache = new ConcurrentHashMap <>();
4242
@@ -65,7 +65,7 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
6565 //If instanceDiscovery flag set to false OR this is a managed identity scenario, cache a basic instance metadata entry to skip this and future lookups
6666 if (msalRequest .application () instanceof ManagedIdentityApplication || !((AbstractClientApplicationBase ) msalRequest .application ()).instanceDiscovery ()) {
6767 if (cache .get (host ) == null ) {
68- log .debug ("Instance discovery set to false, caching a default entry." );
68+ LOG .debug ("Instance discovery set to false, caching a default entry." );
6969 cacheInstanceDiscoveryMetadata (host );
7070 }
7171 return cache .get (host );
@@ -78,10 +78,10 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
7878
7979 //If there is no cached instance metadata, do instance discovery cache the result
8080 if (cache .get (host ) == null ) {
81- log .debug ("No cached instance metadata, will attempt instance discovery." );
81+ LOG .debug ("No cached instance metadata, will attempt instance discovery." );
8282
8383 if (shouldUseRegionalEndpoint (msalRequest )) {
84- log .debug ("Region API used, will attempt to discover Azure region." );
84+ LOG .debug ("Region API used, will attempt to discover Azure region." );
8585
8686 //Server side telemetry requires the result from region discovery when any part of the region API is used
8787 String detectedRegion = discoverRegion (msalRequest , serviceBundle );
@@ -91,7 +91,7 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
9191 if (((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion () == null
9292 && ((AbstractClientApplicationBase ) msalRequest .application ()).autoDetectRegion ()
9393 && detectedRegion != null ) {
94- log .debug (String . format ( "Region autodetection found %s , this region will be used for future calls." , detectedRegion ) );
94+ LOG .debug ("Region autodetection found {} , this region will be used for future calls." , detectedRegion );
9595
9696 ((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion = detectedRegion ;
9797 host = getRegionalizedHost (authorityUrl .getHost (), ((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion ());
@@ -158,7 +158,7 @@ private static boolean shouldUseRegionalEndpoint(MsalRequest msalRequest){
158158 } else {
159159 //Avoid unnecessary warnings when looking for cached tokens by checking if request was a silent call
160160 if (msalRequest .getClass () != SilentRequest .class ) {
161- log .warn ("Regional endpoints are only available for client credential flow, request will fall back to using the global endpoint. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions" );
161+ LOG .warn ("Regional endpoints are only available for client credential flow, request will fall back to using the global endpoint. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions" );
162162 }
163163 return false ;
164164 }
@@ -239,7 +239,7 @@ static AadInstanceDiscoveryResponse sendInstanceDiscoveryRequest(URL authorityUr
239239 throw MsalServiceExceptionFactory .fromHttpResponse (httpResponse );
240240 }
241241 // instance discovery failed due to reasons other than an invalid authority, do not perform instance discovery again in this environment.
242- log .debug ("Instance discovery failed due to an unknown error, no more instance discovery attempts will be made." );
242+ LOG .debug ("Instance discovery failed due to an unknown error, no more instance discovery attempts will be made." );
243243 cacheInstanceDiscoveryMetadata (authorityUrl .getHost ());
244244 }
245245
@@ -291,7 +291,7 @@ static String discoverRegion(MsalRequest msalRequest, ServiceBundle serviceBundl
291291
292292 //Check if the REGION_NAME environment variable has a value for the region
293293 if (System .getenv (REGION_NAME ) != null ) {
294- log .info (String . format ( "Region found in environment variable: %s" , System .getenv (REGION_NAME ) ));
294+ LOG .info ("Region found in environment variable: {}" , System .getenv (REGION_NAME ));
295295 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_ENV_VARIABLE .telemetryValue );
296296
297297 return System .getenv (REGION_NAME );
@@ -305,23 +305,23 @@ static String discoverRegion(MsalRequest msalRequest, ServiceBundle serviceBundl
305305 Future <IHttpResponse > future = executor .submit (() -> executeRequest (IMDS_ENDPOINT , headers , msalRequest , serviceBundle ));
306306
307307 try {
308- log .info ("Starting call to IMDS endpoint." );
308+ LOG .info ("Starting call to IMDS endpoint." );
309309 IHttpResponse httpResponse = future .get (IMDS_TIMEOUT , IMDS_TIMEOUT_UNIT );
310310 //If call to IMDS endpoint was successful, return region from response body
311311 if (httpResponse .statusCode () == HttpStatus .HTTP_OK && !httpResponse .body ().isEmpty ()) {
312- log .info (String . format ( "Region retrieved from IMDS endpoint: %s " , httpResponse .body () ));
312+ LOG .info ("Region retrieved from IMDS endpoint: {} " , httpResponse .body ());
313313 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_IMDS .telemetryValue );
314314
315315 return httpResponse .body ();
316316 }
317- log .warn (String . format ( "Call to local IMDS failed with status code: %s , or response was empty" , httpResponse .statusCode () ));
317+ LOG .warn ("Call to local IMDS failed with status code: {} , or response was empty" , httpResponse .statusCode ());
318318 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_FAILED_AUTODETECT .telemetryValue );
319319 } catch (Exception ex ) {
320320 // handle other exceptions
321321 //IMDS call failed, cannot find region
322322 //The IMDS endpoint is only available from within an Azure environment, so the most common cause of this
323323 // exception will likely be java.net.SocketException: Network is unreachable: connect
324- log .warn (String . format ( "Exception during call to local IMDS endpoint: %s " , ex .getMessage () ));
324+ LOG .warn ("Exception during call to local IMDS endpoint: {} " , ex .getMessage ());
325325 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_FAILED_AUTODETECT .telemetryValue );
326326 future .cancel (true );
327327
0 commit comments