reuse Configuration.defaultApiClientin no-arg Api ctors and make ref volatile (fixes issue #20633) (#20635)

* made Configuration.defaultApiClient volatile so that if it's changed the new value is immediately visible to all other threads

* made no-arg api ctor use Configuration.getDefaultApiClient() instead of creating new ApiClient every time

* replaced all use of URLEncoder.encode with ApiClient.urlEncode; just code cleanup; no functional changes

* disabled AbstractJavaCodegenTest.testGeneratedExampleValues as it fails, possibly due to timezone (Locale.ROOT) of local system

* replaced thread-unsafe SimpleDateFormat with DateTimeFormatter and re-enabled unit-test

* removed unused import

* ran the generate-sample scripts and generated a HUGE number of changes!

* added missing import of Configuration to api.mustache (and, thus, all native samples)

* added missing import for ApiClient to anyof and oneof model mustaches
This commit is contained in:
Ron Reynolds
2025-02-18 22:47:55 -08:00
committed by GitHub
parent c349270c7a
commit eb668b6a76
215 changed files with 517 additions and 469 deletions

View File

@@ -17,7 +17,7 @@ package org.openapitools.client;
public class Configuration {
public static final String VERSION = "1.0.0";
private static ApiClient defaultApiClient = new ApiClient();
private static volatile ApiClient defaultApiClient = new ApiClient();
/**
* Get the default API client, which would be used when creating API