[Java] Add missing Locale to String.format() invocations (#21871)

* [Java] Add missing Locale to String.format() invocations

* chore: ./bin/generate-samples.sh ./bin/configs/*.yaml
This commit is contained in:
Jochen Schalanda 2025-09-03 08:52:49 +02:00 committed by GitHub
parent d1df75c61d
commit babb3e272b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2539 changed files with 5392 additions and 2392 deletions

View File

@ -41,6 +41,7 @@ import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
import java.util.Locale;
import java.net.URLEncoder;
@ -694,6 +695,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}

View File

@ -50,6 +50,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.function.Supplier;
import java.util.TimeZone;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -929,6 +930,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}

View File

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;
@ -115,7 +116,7 @@ public class {{classname}} extends BaseApi {
localVarQueryParameterBaseName = "{{{baseName}}}";
{{#isArray}}
for (int i=0; i < {{paramName}}.size(); i++) {
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i)));
}
{{/isArray}}
{{^isArray}}

View File

@ -4,6 +4,7 @@ package {{invokerPackage}}.auth;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import java.util.Locale;
public class ApiKeyAuth implements RequestInterceptor {
private final String location;
@ -39,7 +40,7 @@ public class ApiKeyAuth implements RequestInterceptor {
} else if ("header".equals(location)) {
template.header(paramName, apiKey);
} else if ("cookie".equals(location)) {
template.header("Cookie", String.format("%s=%s", paramName, apiKey));
template.header("Cookie", String.format(Locale.ROOT, "%s=%s", paramName, apiKey));
}
}
}

View File

@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/models}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -366,8 +366,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{items.dataType}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -381,8 +381,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -399,8 +399,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{items.dataType}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -410,8 +410,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -424,8 +424,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for ({{items.dataType}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -441,8 +441,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -461,8 +461,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -475,8 +475,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -486,7 +486,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -502,7 +502,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -54,6 +54,7 @@ import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
{{#jsr310}}
@ -1223,6 +1224,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (index < 0 || index >= serverConfigurations.size()) {
throw new ArrayIndexOutOfBoundsException(
String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d",
index, serverConfigurations.size()));
}

View File

@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -6,6 +6,7 @@ import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@ -70,7 +71,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return new{{classname}};
{{/mappedModels}}
default:
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
}
{{/discriminator}}
@ -157,7 +158,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
}
/**

View File

@ -54,6 +54,7 @@ import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
{{#jsr310}}
@ -1223,6 +1224,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (index < 0 || index >= serverConfigurations.size()) {
throw new ArrayIndexOutOfBoundsException(
String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d",
index, serverConfigurations.size()));
}

View File

@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -6,6 +6,7 @@ import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@ -70,7 +71,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return new{{classname}};
{{/mappedModels}}
default:
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
}
{{/discriminator}}
@ -157,7 +158,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
}
/**

View File

@ -9,6 +9,7 @@ import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
{{#imports}}import {{import}};
{{/imports}}
{{#serializableModel}}

View File

@ -4,6 +4,7 @@ import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@ -241,8 +242,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(_item))));
}
i++;
@ -251,8 +252,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^uniqueItems}}
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(getActualInstance().get(i)))));
}
}
@ -265,8 +266,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -276,8 +277,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if ((({{{dataType}}})getActualInstance()).get(i) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -289,8 +290,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
if (_item != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(_item))));
}
i++;
@ -301,8 +302,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if (getActualInstance().get(i) != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(i)))));
}
}
@ -316,8 +317,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items.isPrimitiveType}}
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
getActualInstance().get(_key), ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key)))));
}
}
@ -326,8 +327,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
if ((({{{dataType}}})getActualInstance()).get(_key) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -336,7 +337,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isMap}}
{{#isPrimitiveType}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
@ -347,7 +348,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isModel}}
{{^isModel}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
}
{{/isModel}}
{{/isPrimitiveType}}

View File

@ -47,6 +47,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
{{#asyncNative}}
@ -580,7 +581,7 @@ public class {{classname}} {
if ({{paramName}} != null) {
{{#isArray}}
for (int i=0; i < {{paramName}}.size(); i++) {
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format("{{baseName}}[%d]", i)));
localVarQueryStringJoiner.add({{paramName}}.get(i).toUrlQueryString(String.format(Locale.ROOT, "{{baseName}}[%d]", i)));
}
{{/isArray}}
{{^isArray}}

View File

@ -24,6 +24,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -12,6 +12,7 @@ import com.google.gson.stream.JsonWriter;
{{#isUri}}
import java.net.URI;
{{/isUri}}
import java.util.Locale;
/**
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
@ -78,7 +79,7 @@ import java.net.URI;
prefix = "";
}
return String.format("%s=%s", prefix, this.toString());
return String.format(Locale.ROOT, "%s=%s", prefix, this.toString());
}
{{/supportUrlQuery}}

View File

@ -4,6 +4,7 @@ import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
@ -68,7 +69,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return new{{classname}};
{{/mappedModels}}
default:
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", discriminatorValue));
}
{{/discriminator}}
@ -112,7 +113,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1", match));
}
/**
@ -274,8 +275,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(_item))));
}
i++;
@ -284,8 +285,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^uniqueItems}}
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(getActualInstance().get(i)))));
}
}
@ -298,8 +299,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -309,8 +310,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if ((({{{dataType}}})getActualInstance()).get(i) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -322,8 +323,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
int i = 0;
for ({{{items.dataType}}} _item : ({{{dataType}}})getActualInstance()) {
if (_item != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf(_item))));
}
i++;
@ -334,8 +335,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if (getActualInstance().get(i) != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(i)))));
}
}
@ -349,8 +350,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items.isPrimitiveType}}
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
getActualInstance().get(_key), ApiClient.urlEncode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key)))));
}
}
@ -359,8 +360,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
if ((({{{dataType}}})getActualInstance()).get(_key) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -369,7 +370,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isMap}}
{{#isPrimitiveType}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
@ -380,7 +381,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isModel}}
{{^isModel}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance()))));
}
{{/isModel}}
{{/isPrimitiveType}}

View File

@ -389,8 +389,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(_item))));
}
i++;
@ -399,8 +399,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^uniqueItems}}
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString({{getter}}().get(i)))));
}
}
@ -413,8 +413,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -424,8 +424,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -437,8 +437,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(_item))));
}
i++;
@ -449,8 +449,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString({{getter}}().get(i)))));
}
}
@ -464,8 +464,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^items.isModel}}
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), ApiClient.urlEncode(ApiClient.valueToString({{getter}}().get(_key)))));
}
}
@ -474,8 +474,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -484,7 +484,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isMap}}
{{#isPrimitiveType}}
if ({{getter}}() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString({{{getter}}}()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString({{{getter}}}()))));
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
@ -495,7 +495,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{/isModel}}
{{^isModel}}
if ({{getter}}() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString({{{getter}}}()))));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString({{{getter}}}()))));
}
{{/isModel}}
{{/isPrimitiveType}}

View File

@ -1546,7 +1546,8 @@ public class ApiClient {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}
baseURL = servers.get(serverIndex).URL(serverVariables);
@ -1618,11 +1619,11 @@ public class ApiClient {
*/
public void processCookieParams(Map<String, String> cookieParams, Request.Builder reqBuilder) {
for (Entry<String, String> param : cookieParams.entrySet()) {
reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
}
for (Entry<String, String> param : defaultCookieMap.entrySet()) {
if (!cookieParams.containsKey(param.getKey())) {
reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
reqBuilder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
}
}
}

View File

@ -10,6 +10,7 @@ import java.util.HashSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Locale;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -120,14 +121,14 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isArray}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
actualAdapter = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}};
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
actualAdapter = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}};
{{/isPrimitiveType}}
@ -146,7 +147,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
@ -155,13 +156,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -179,7 +180,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return ret;
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e);
}
{{/hasVars}}
@ -194,7 +195,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return ret;
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for {{{.}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{.}}} failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e);
}
{{/hasVars}}
@ -202,7 +203,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/anyOf}}
{{/composedSchemas}}
throw new IOException(String.format("Failed deserialization for {{classname}}: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
}
}.nullSafe();
}
@ -321,13 +322,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isArray}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -344,7 +345,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
@ -352,13 +353,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -377,13 +378,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/hasVars}}
return;
} catch (Exception e) {
errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
// continue to the next one
}
{{/vendorExtensions.x-duplicated-data-type}}
{{/anyOf}}
{{/composedSchemas}}
throw new IOException(String.format("The JSON string is invalid for {{classname}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
throw new IOException(String.format(Locale.ROOT, "The JSON string is invalid for {{classname}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString()));
}
/**

View File

@ -4,6 +4,7 @@ package {{invokerPackage}};
import java.util.Map;
import java.util.List;
import java.util.Locale;
{{#caseInsensitiveResponseHeaders}}
import java.util.Map.Entry;
import java.util.TreeMap;
@ -170,7 +171,7 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us
* @return The exception message
*/
public String getMessage() {
return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
return String.format(Locale.ROOT, "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders());
}
{{#errorObjectType}}

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
import java.util.Objects;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -2,6 +2,7 @@ import java.io.IOException;
{{#isUri}}
import java.net.URI;
{{/isUri}}
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
@ -79,7 +80,7 @@ import com.google.gson.stream.JsonWriter;
prefix = "";
}
return String.format("%s=%s", prefix, this.toString());
return String.format(Locale.ROOT, "%s=%s", prefix, this.toString());
}
{{/supportUrlQuery}}
}

View File

@ -10,6 +10,7 @@ import java.util.HashSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Locale;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -140,7 +141,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return new{{classname}};
{{/mappedModels}}
default:
log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", jsonObject.get("{{{propertyBaseName}}}").getAsString()));
log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for {{classname}}. Possible values:{{#mappedModels}} {{{mappingName}}}{{/mappedModels}}", jsonObject.get("{{{propertyBaseName}}}").getAsString()));
}
}
@ -161,14 +162,14 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isMap}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
actualAdapter = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}};
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
actualAdapter = adapter{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}};
{{/isPrimitiveType}}
@ -188,7 +189,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
@ -197,13 +198,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -218,7 +219,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isMap}}
if (!jsonElement.isJsonObject()) {
throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
}
{{^isFreeFormObject}}
@ -228,13 +229,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -252,7 +253,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
log.log(Level.FINER, "Input data matches schema '{{{dataType}}}'");
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema '{{{dataType}}}'", e);
}
{{/hasVars}}
@ -266,7 +267,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
log.log(Level.FINER, "Input data matches schema '{{{.}}}'");
} catch (Exception e) {
// deserialization failed, continue
errorMessages.add(String.format("Deserialization for {{{.}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{.}}} failed with `%s`.", e.getMessage()));
log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e);
}
{{/hasVars}}
@ -280,7 +281,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
return ret;
}
throw new IOException(String.format("Failed deserialization for {{classname}}: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString()));
throw new IOException(String.format(Locale.ROOT, "Failed deserialization for {{classname}}: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString()));
}
}.nullSafe();
}
@ -401,13 +402,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{^isArray}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!jsonElement.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -425,7 +426,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isMap}}
{{#isArray}}
if (!jsonElement.isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
}
JsonArray array = jsonElement.getAsJsonArray();
// validate array items
@ -433,13 +434,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -453,7 +454,7 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/isArray}}
{{#isMap}}
if (!jsonElement.isJsonObject()) {
throw new IllegalArgumentException(String.format("Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be a object type in the JSON string but got `%s`", jsonElement.toString()));
}
{{^isFreeFormObject}}
@ -463,13 +464,13 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{#items}}
{{#isNumber}}
if (!jsonElement.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(String.format("Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected json element to be of type Number in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isNumber}}
{{^isNumber}}
{{#isPrimitiveType}}
if (!element.getAsJsonPrimitive().is{{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}}()) {
throw new IllegalArgumentException(String.format("Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected array items to be of type {{#isBoolean}}Boolean{{/isBoolean}}{{#isString}}String{{/isString}}{{^isString}}{{^isBoolean}}Number{{/isBoolean}}{{/isString}} in the JSON string but got `%s`", jsonElement.toString()));
}
{{/isPrimitiveType}}
{{/isNumber}}
@ -489,14 +490,14 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
{{/hasVars}}
validCount++;
} catch (Exception e) {
errorMessages.add(String.format("Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
errorMessages.add(String.format(Locale.ROOT, "Deserialization for {{{dataType}}} failed with `%s`.", e.getMessage()));
// continue to the next one
}
{{/vendorExtensions.x-duplicated-data-type}}
{{/oneOf}}
{{/composedSchemas}}
if (validCount != 1) {
throw new IOException(String.format("The JSON string is invalid for {{classname}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString()));
throw new IOException(String.format(Locale.ROOT, "The JSON string is invalid for {{classname}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString()));
}
}

View File

@ -18,6 +18,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import {{invokerPackage}}.JSON;
@ -351,7 +352,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString()));
}
}
{{^hasChildren}}
@ -361,7 +362,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!{{classname}}.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
{{/isAdditionalPropertiesTrue}}
@ -371,7 +372,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : {{classname}}.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
}
}
{{/-first}}
@ -387,7 +388,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#required}}
// ensure the json data is an array
if (!jsonObj.get("{{{baseName}}}").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
}
JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}");
@ -402,7 +403,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if (jsonArray{{name}} != null) {
// ensure the json data is an array
if (!jsonObj.get("{{{baseName}}}").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
}
// validate the optional field `{{{baseName}}}` (array)
@ -417,7 +418,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^required}}
// ensure the optional json data is an array if present
if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull() && !jsonObj.get("{{{baseName}}}").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
}
{{/required}}
{{#required}}
@ -425,7 +426,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if (jsonObj.get("{{{baseName}}}") == null) {
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
} else if (!jsonObj.get("{{{baseName}}}").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
}
{{/required}}
{{/items.isModel}}
@ -433,7 +434,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isContainer}}
{{#isString}}
if ({{#notRequiredOrIsNullable}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/notRequiredOrIsNullable}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
}
{{/isString}}
{{#isModel}}
@ -486,7 +487,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
break;
{{/mappedModels}}
default:
throw new IllegalArgumentException(String.format("The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue));
throw new IllegalArgumentException(String.format(Locale.ROOT, "The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue));
}
{{/discriminator}}
{{/hasChildren}}
@ -553,7 +554,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object

View File

@ -50,6 +50,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
@ -758,6 +759,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}
@ -853,7 +855,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String delimiter = "";
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
final String value = entry.getValue().get(entry.getValue().size() - 1);
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
cookieValue.append(String.format(Locale.ROOT, "%s%s=%s", delimiter, entry.getKey(), value));
delimiter = "; ";
}
return cookieValue.toString();

View File

@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/models}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -407,8 +407,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
int i = 0;
for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -422,8 +422,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -440,8 +440,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -451,8 +451,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -465,8 +465,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -482,8 +482,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -502,8 +502,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -516,8 +516,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -527,7 +527,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -543,7 +543,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -63,6 +63,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
@ -860,7 +861,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String delimiter = "";
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
final String value = entry.getValue().get(entry.getValue().size() - 1);
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
cookieValue.append(String.format(Locale.ROOT, "%s%s=%s", delimiter, entry.getKey(), value));
delimiter = "; ";
}
return cookieValue.toString();

View File

@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/models}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -407,8 +407,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -422,8 +422,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -440,8 +440,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -451,8 +451,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -465,8 +465,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -482,8 +482,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -502,8 +502,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -516,8 +516,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -527,7 +527,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -543,7 +543,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -5,6 +5,7 @@ package {{invokerPackage}}.auth;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import okhttp3.Interceptor;
import okhttp3.Request;
@ -66,7 +67,7 @@ public class ApiKeyAuth implements Interceptor {
.build();
} else if ("cookie".equals(location)) {
request = request.newBuilder()
.addHeader("Cookie", String.format("%s=%s", paramName, apiKey))
.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", paramName, apiKey))
.build();
}
return chain.proceed(request);

View File

@ -20,6 +20,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
@ -62,14 +63,14 @@ public class Play24CallFactory implements okhttp3.Call.Factory {
rb.addHeader(header.getKey(), header.getValue());
}
for (Map.Entry<String, String> cookie : this.extraCookies.entrySet()) {
rb.addHeader("Cookie", String.format("%s=%s", cookie.getKey(), cookie.getValue()));
rb.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getKey(), cookie.getValue()));
}
// add extra query params
if (!this.extraQueryParams.isEmpty()) {
String newQuery = request.url().uri().getQuery();
for (Pair queryParam : this.extraQueryParams) {
String param = String.format("%s=%s", queryParam.getName(), queryParam.getValue());
String param = String.format(Locale.ROOT, "%s=%s", queryParam.getName(), queryParam.getValue());
if (newQuery == null) {
newQuery = param;
} else {
@ -176,7 +177,7 @@ public class Play24CallFactory implements okhttp3.Call.Factory {
String delimiter = "";
final StringBuilder cookieHeader = new StringBuilder();
for (final String cookie : cookies) {
cookieHeader.append(String.format("%s%s", delimiter, cookie));
cookieHeader.append(String.format(Locale.ROOT, "%s%s", delimiter, cookie));
delimiter = "; ";
}
wsRequest.setHeader("Cookie", cookieHeader.toString());
@ -221,7 +222,7 @@ public class Play24CallFactory implements okhttp3.Call.Factory {
}
}
for (final WSCookie cookie : r.getCookies()) {
builder.addHeader("Cookie", String.format("%s=%s", cookie.getName(), cookie.getValue()));
builder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getName(), cookie.getValue()));
}
builder.protocol(Protocol.HTTP_1_1);

View File

@ -20,6 +20,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletionStage;
@ -71,14 +72,14 @@ public class Play25CallFactory implements okhttp3.Call.Factory {
rb.addHeader(header.getKey(), header.getValue());
}
for (Map.Entry<String, String> cookie : this.extraCookies.entrySet()) {
rb.addHeader("Cookie", String.format("%s=%s", cookie.getKey(), cookie.getValue()));
rb.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getKey(), cookie.getValue()));
}
// add extra query params
if (!this.extraQueryParams.isEmpty()) {
String newQuery = request.url().uri().getQuery();
for (Pair queryParam : this.extraQueryParams) {
String param = String.format("%s=%s", queryParam.getName(), queryParam.getValue());
String param = String.format(Locale.ROOT, "%s=%s", queryParam.getName(), queryParam.getValue());
if (newQuery == null) {
newQuery = param;
} else {
@ -181,7 +182,7 @@ public class Play25CallFactory implements okhttp3.Call.Factory {
String delimiter = "";
final StringBuilder cookieHeader = new StringBuilder();
for (final String cookie : cookies) {
cookieHeader.append(String.format("%s%s", delimiter, cookie));
cookieHeader.append(String.format(Locale.ROOT, "%s%s", delimiter, cookie));
delimiter = "; ";
}
wsRequest.setHeader("Cookie", cookieHeader.toString());
@ -230,7 +231,7 @@ public class Play25CallFactory implements okhttp3.Call.Factory {
}
}
for (final WSCookie cookie : r.getCookies()) {
builder.addHeader("Cookie", String.format("%s=%s", cookie.getName(), cookie.getValue()));
builder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getName(), cookie.getValue()));
}

View File

@ -21,6 +21,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
@ -80,14 +81,14 @@ public class Play26CallFactory implements okhttp3.Call.Factory {
rb.addHeader(header.getKey(), header.getValue());
}
for (Map.Entry<String, String> cookie : this.extraCookies.entrySet()) {
rb.addHeader("Cookie", String.format("%s=%s", cookie.getKey(), cookie.getValue()));
rb.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getKey(), cookie.getValue()));
}
// add extra query params
if (!this.extraQueryParams.isEmpty()) {
String newQuery = request.url().uri().getQuery();
for (Pair queryParam : this.extraQueryParams) {
String param = String.format("%s=%s", queryParam.getName(), queryParam.getValue());
String param = String.format(Locale.ROOT, "%s=%s", queryParam.getName(), queryParam.getValue());
if (newQuery == null) {
newQuery = param;
} else {
@ -260,7 +261,7 @@ public class Play26CallFactory implements okhttp3.Call.Factory {
}
}
for (final WSCookie cookie : r.getCookies()) {
builder.addHeader("Cookie", String.format("%s=%s", cookie.getName(), cookie.getValue()));
builder.addHeader("Cookie", String.format(Locale.ROOT, "%s=%s", cookie.getName(), cookie.getValue()));
}
builder.message(r.getStatusText());

View File

@ -529,7 +529,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
String delimiter = "";
for (final Map.Entry<String, String> entry : cookies.entries()) {
if (entry.getValue() != null) {
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), entry.getValue()));
cookieValue.append(String.format(Locale.ROOT, "%s%s=%s", delimiter, entry.getKey(), entry.getValue()));
delimiter = "; ";
}
}

View File

@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter;
{{/models}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -407,8 +407,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
int i = 0;
for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -422,8 +422,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -440,8 +440,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -451,8 +451,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -465,8 +465,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -482,8 +482,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -502,8 +502,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -516,8 +516,8 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -527,7 +527,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -543,7 +543,7 @@ public {{>sealed}}class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#v
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -8,6 +8,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -12,6 +12,7 @@ import com.google.gson.stream.JsonWriter;
{{#isUri}}
import java.net.URI;
{{/isUri}}
import java.util.Locale;
/**
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
@ -114,7 +115,7 @@ import java.net.URI;
prefix = "";
}
return String.format("%s=%s", prefix, this.toString());
return String.format(Locale.ROOT, "%s=%s", prefix, this.toString());
}
{{/supportUrlQuery}}
}

View File

@ -406,8 +406,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.datatypeWithEnum}}} _item : {{getter}}()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -421,8 +421,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -439,8 +439,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
int i = 0;
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(_item.toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
@ -450,8 +450,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
joiner.add({{getter}}().get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add({{getter}}().get(i).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -464,8 +464,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for ({{{items.dataType}}} _item : {{getter}}()) {
if (_item != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -481,8 +481,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
for (int i = 0; i < {{getter}}().size(); i++) {
if ({{getter}}().get(i) != null) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf({{getter}}().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -501,8 +501,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
try {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
{{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -515,8 +515,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
if ({{getter}}() != null) {
for (String _key : {{getter}}().keySet()) {
if ({{getter}}().get(_key) != null) {
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
joiner.add({{getter}}().get(_key).toUrlQueryString(String.format(Locale.ROOT, "%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
@ -526,7 +526,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#isPrimitiveType}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -542,7 +542,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{^isModel}}
if ({{getter}}() != null) {
try {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf({{{getter}}}()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -34,7 +34,7 @@ public class OpenAPIUtils {
if (constraintViolations.size() > 0) {
StringBuilder errors = new StringBuilder();
for (ConstraintViolation<T> constraints : constraintViolations) {
errors.append(String.format("%s.%s %s\n",
errors.append(String.format(Locale.ROOT, "%s.%s %s\n",
constraints.getRootBeanClass().getSimpleName(),
constraints.getPropertyPath(),
constraints.getMessage()));

View File

@ -29,6 +29,7 @@ import java.security.interfaces.RSAPublicKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
@Singleton
@ -131,7 +132,7 @@ public class SecurityAPIUtils {
final PublicKey publicKey = jwk.getPublicKey();
if (!(publicKey instanceof RSAPublicKey)) {
throw new IllegalArgumentException(String.format("Key with ID %s was found in JWKS but is not a RSA-key.", keyId));
throw new IllegalArgumentException(String.format(Locale.ROOT, "Key with ID %s was found in JWKS but is not a RSA-key.", keyId));
}
Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null);

View File

@ -33,7 +33,7 @@ import feign.RequestTemplate;
{{/hasOAuthMethods}}
{{/hasAuthMethods}}
import org.springframework.context.annotation.Configuration;
import java.util.Locale;
public class ClientConfiguration {
@ -108,7 +108,7 @@ public class ClientConfiguration {
public String getBearerToken() {
final OAuth2AccessToken accessToken = getAccessToken();
return String.format( "%s %s", accessToken.getTokenType().getValue(), accessToken.getTokenValue() );
return String.format( Locale.ROOT, "%s %s", accessToken.getTokenType().getValue(), accessToken.getTokenValue() );
}
}
{{/hasOAuthMethods}}

View File

@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.List;
{{/x-helidon-v3}}
import java.util.Map;
import java.util.Locale;
import java.util.Objects;
{{^x-helidon-v3}}
import java.util.Optional;
@ -27,7 +28,7 @@ public final class ValidatorUtils {
public static boolean validateMin(Integer value, Integer min) {
checkNonNull(value);
if (value < min) {
throw new ValidationException(String.format("%s is less than %s", value, min));
throw new ValidationException(String.format(Locale.ROOT, "%s is less than %s", value, min));
}
return true;
}
@ -35,7 +36,7 @@ public final class ValidatorUtils {
public static boolean validateMax(Integer value, Integer max) {
checkNonNull(value);
if (value > max) {
throw new ValidationException(String.format("%s is more than %s", value, max));
throw new ValidationException(String.format(Locale.ROOT, "%s is more than %s", value, max));
}
return true;
}
@ -72,7 +73,7 @@ public final class ValidatorUtils {
if (value.matches(pattern)) {
return true;
}
throw new ValidationException(String.format("'%s' does not match the pattern '%s'", value, pattern));
throw new ValidationException(String.format(Locale.ROOT, "'%s' does not match the pattern '%s'", value, pattern));
}
public static boolean validateMin(BigDecimal value, String stringMinValue, boolean inclusive) {
@ -89,7 +90,7 @@ public final class ValidatorUtils {
}
}
throw new ValidationException(
String.format("%s is not valid value. Min value '%s'. Inclusive - %s.", value, stringMinValue, inclusive)
String.format(Locale.ROOT, "%s is not valid value. Min value '%s'. Inclusive - %s.", value, stringMinValue, inclusive)
);
}
@ -107,7 +108,7 @@ public final class ValidatorUtils {
}
}
throw new ValidationException(
String.format("%s is not valid value. Max value '%s'. Inclusive - %s.", value, stringMaxValue, inclusive)
String.format(Locale.ROOT, "%s is not valid value. Max value '%s'. Inclusive - %s.", value, stringMaxValue, inclusive)
);
}
@ -168,7 +169,7 @@ public final class ValidatorUtils {
<T> T check(String paramName, T paramValue, List<T> validValues) {
if (!validValues.contains(paramValue)) {
errorsCollector.fatal(String.format("Invalid value %s = '%s' not among %s",
errorsCollector.fatal(String.format(Locale.ROOT, "Invalid value %s = '%s' not among %s",
paramName,
paramValue,
validValues));
@ -178,21 +179,21 @@ public final class ValidatorUtils {
<T> T require(String paramName, T paramValue) {
if (paramValue == null || ((paramValue instanceof Optional opt) && opt.isEmpty())) {
errorsCollector.fatal(String.format("Missing required param: %s", paramName));
errorsCollector.fatal(String.format(Locale.ROOT, "Missing required param: %s", paramName));
}
return paramValue;
}
<T> List<T> require(String paramName, List<T> paramValues) {
if (paramValues.isEmpty()) {
errorsCollector.fatal(String.format("Empty required parameter: %s", paramName));
errorsCollector.fatal(String.format(Locale.ROOT, "Empty required parameter: %s", paramName));
}
return paramValues;
}
<T> T require(String paramName, Optional<T> optionalValue) {
if (optionalValue.isEmpty()) {
errorsCollector.fatal(String.format("Empty required parameter: %s", paramName));
errorsCollector.fatal(String.format(Locale.ROOT, "Empty required parameter: %s", paramName));
}
return optionalValue.orElse(null);
}
@ -200,7 +201,7 @@ public final class ValidatorUtils {
boolean validateMin(String paramName, Long value, Long min, boolean isExclusive) {
boolean result = value == null || value > min || !isExclusive && value.equals(min);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %d violates %sminimum %d",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %d violates %sminimum %d",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -248,7 +249,7 @@ public final class ValidatorUtils {
boolean validateMin(String paramName, Float value, Float min, boolean isExclusive) {
boolean result = value == null || value.compareTo(min) > 0 || isExclusive && value.equals(min);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %f violates %sminimum %f",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %f violates %sminimum %f",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -268,7 +269,7 @@ public final class ValidatorUtils {
boolean validateMin(String paramName, BigDecimal value, BigDecimal min, boolean isExclusive) {
boolean result = value == null || value.compareTo(min) > 0 || !isExclusive && value.equals(min);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %f violates %sminimum %f",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %f violates %sminimum %f",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -284,7 +285,7 @@ public final class ValidatorUtils {
boolean validateMax(String paramName, Long value, Long max, boolean isExclusive) {
boolean result = value == null || value < max || !isExclusive && value.equals(max);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %d violates %smaximum %d",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %d violates %smaximum %d",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -332,7 +333,7 @@ public final class ValidatorUtils {
boolean validateMax(String paramName, Float value, Float max, boolean isExclusive) {
boolean result = value == null || value.compareTo(max) < 0 || isExclusive && value.equals(max);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %f violates %smaximum %f",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %f violates %smaximum %f",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -352,7 +353,7 @@ public final class ValidatorUtils {
boolean validateMax(String paramName, BigDecimal value, BigDecimal max, boolean isExclusive) {
boolean result = value == null || value.compareTo(max) < 0 || !isExclusive && value.equals(max);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s %f violates %smaximum %f",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s %f violates %smaximum %f",
paramName,
value,
isExclusive ? "exclusive " : "",
@ -368,7 +369,7 @@ public final class ValidatorUtils {
boolean validatePattern(String paramName, String value, String pattern) {
boolean result = value == null || value.matches(pattern);
if (!result) {
errorsCollector.fatal(String.format("Parameter %s '%s' does not match pattern '%s'",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s '%s' does not match pattern '%s'",
paramName,
value,
pattern));
@ -391,7 +392,7 @@ public final class ValidatorUtils {
default -> value.getClass().isArray() ? Array.getLength(value) : -1;
};
if (size == -1) {
errorsCollector.fatal(String.format("Parameter %s with type %s unrecognized for validating size",
errorsCollector.fatal(String.format(Locale.ROOT, "Parameter %s with type %s unrecognized for validating size",
paramName,
value.getClass().getName()));
return false;

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}

View File

@ -1,5 +1,6 @@
package {{package}}
import java.util.Locale
import java.util.Objects
{{#imports}}import {{import}}
{{/imports}}

View File

@ -52,6 +52,7 @@ import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
import java.util.Locale;
import java.net.URLEncoder;
@ -711,6 +712,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}

View File

@ -50,6 +50,7 @@ import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
{{#jsr310}}
{{#threetenbp}}
import org.threeten.bp.OffsetDateTime;
@ -1086,6 +1087,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
if (index < 0 || index >= serverConfigurations.size()) {
throw new ArrayIndexOutOfBoundsException(
String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d",
index, serverConfigurations.size()));
}

View File

@ -8,6 +8,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
{{/useReflectionEqualsHashCode}}
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
{{#imports}}
import {{import}};
{{/imports}}

View File

@ -56,6 +56,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.function.Supplier;
import java.util.TimeZone;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -846,6 +847,7 @@ public class ApiClient extends JavaTimeFormatter {
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
Locale.ROOT,
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}

View File

@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.StringJoiner;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -170,7 +171,7 @@ public class Bird {
// add `size` to the URL query string
if (getSize() != null) {
try {
joiner.add(String.format("%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -180,7 +181,7 @@ public class Bird {
// add `color` to the URL query string
if (getColor() != null) {
try {
joiner.add(String.format("%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -170,7 +171,7 @@ public class Category {
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -180,7 +181,7 @@ public class Category {
// add `name` to the URL query string
if (getName() != null) {
try {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -222,7 +223,7 @@ public class DataQuery extends Query {
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -233,8 +234,8 @@ public class DataQuery extends Query {
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
try {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getOutcomes().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -246,7 +247,7 @@ public class DataQuery extends Query {
// add `suffix` to the URL query string
if (getSuffix() != null) {
try {
joiner.add(String.format("%ssuffix%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSuffix()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%ssuffix%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSuffix()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -256,7 +257,7 @@ public class DataQuery extends Query {
// add `text` to the URL query string
if (getText() != null) {
try {
joiner.add(String.format("%stext%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getText()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%stext%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getText()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -266,7 +267,7 @@ public class DataQuery extends Query {
// add `date` to the URL query string
if (getDate() != null) {
try {
joiner.add(String.format("%sdate%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDate()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sdate%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDate()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -508,8 +509,8 @@ public class DefaultValue {
for (int i = 0; i < getArrayStringEnumRefDefault().size(); i++) {
if (getArrayStringEnumRefDefault().get(i) != null) {
try {
joiner.add(String.format("%sarray_string_enum_ref_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_enum_ref_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringEnumRefDefault().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -523,8 +524,8 @@ public class DefaultValue {
if (getArrayStringEnumDefault() != null) {
for (int i = 0; i < getArrayStringEnumDefault().size(); i++) {
try {
joiner.add(String.format("%sarray_string_enum_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_enum_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringEnumDefault().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -537,8 +538,8 @@ public class DefaultValue {
if (getArrayStringDefault() != null) {
for (int i = 0; i < getArrayStringDefault().size(); i++) {
try {
joiner.add(String.format("%sarray_string_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringDefault().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -551,8 +552,8 @@ public class DefaultValue {
if (getArrayIntegerDefault() != null) {
for (int i = 0; i < getArrayIntegerDefault().size(); i++) {
try {
joiner.add(String.format("%sarray_integer_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_integer_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayIntegerDefault().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -565,8 +566,8 @@ public class DefaultValue {
if (getArrayString() != null) {
for (int i = 0; i < getArrayString().size(); i++) {
try {
joiner.add(String.format("%sarray_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayString().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -579,8 +580,8 @@ public class DefaultValue {
if (getArrayStringNullable() != null) {
for (int i = 0; i < getArrayStringNullable().size(); i++) {
try {
joiner.add(String.format("%sarray_string_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringNullable().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -593,8 +594,8 @@ public class DefaultValue {
if (getArrayStringExtensionNullable() != null) {
for (int i = 0; i < getArrayStringExtensionNullable().size(); i++) {
try {
joiner.add(String.format("%sarray_string_extension_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_extension_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringExtensionNullable().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -606,7 +607,7 @@ public class DefaultValue {
// add `string_nullable` to the URL query string
if (getStringNullable() != null) {
try {
joiner.add(String.format("%sstring_nullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStringNullable()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sstring_nullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStringNullable()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -205,7 +206,7 @@ public class NumberPropertiesOnly {
// add `number` to the URL query string
if (getNumber() != null) {
try {
joiner.add(String.format("%snumber%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getNumber()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%snumber%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getNumber()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -215,7 +216,7 @@ public class NumberPropertiesOnly {
// add `float` to the URL query string
if (getFloat() != null) {
try {
joiner.add(String.format("%sfloat%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getFloat()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sfloat%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getFloat()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -225,7 +226,7 @@ public class NumberPropertiesOnly {
// add `double` to the URL query string
if (getDouble() != null) {
try {
joiner.add(String.format("%sdouble%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDouble()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sdouble%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDouble()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -356,7 +357,7 @@ public class Pet {
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -366,7 +367,7 @@ public class Pet {
// add `name` to the URL query string
if (getName() != null) {
try {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -382,8 +383,8 @@ public class Pet {
if (getPhotoUrls() != null) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
try {
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getPhotoUrls().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
@ -396,8 +397,8 @@ public class Pet {
if (getTags() != null) {
for (int i = 0; i < getTags().size(); i++) {
if (getTags().get(i) != null) {
joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(getTags().get(i).toUrlQueryString(String.format(Locale.ROOT, "%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
@ -405,7 +406,7 @@ public class Pet {
// add `status` to the URL query string
if (getStatus() != null) {
try {
joiner.add(String.format("%sstatus%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStatus()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sstatus%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStatus()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -218,7 +219,7 @@ public class Query {
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -229,8 +230,8 @@ public class Query {
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
try {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getOutcomes().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.UnsupportedEncodingException;
@ -23,6 +24,7 @@ import java.util.StringJoiner;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Locale;
/**
* Gets or Sets StringEnumRef
@ -72,7 +74,7 @@ public enum StringEnumRef {
prefix = "";
}
return String.format("%s=%s", prefix, this.toString());
return String.format(Locale.ROOT, "%s=%s", prefix, this.toString());
}
}

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -170,7 +171,7 @@ public class Tag {
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -180,7 +181,7 @@ public class Tag {
// add `name` to the URL query string
if (getName() != null) {
try {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -139,7 +140,7 @@ public class TestFormObjectMultipartRequestMarker {
// add `name` to the URL query string
if (getName() != null) {
try {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -235,7 +236,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
// add `size` to the URL query string
if (getSize() != null) {
try {
joiner.add(String.format("%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%ssize%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSize()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -245,7 +246,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
// add `color` to the URL query string
if (getColor() != null) {
try {
joiner.add(String.format("%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%scolor%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getColor()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -255,7 +256,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
// add `id` to the URL query string
if (getId() != null) {
try {
joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
@ -265,7 +266,7 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
// add `name` to the URL query string
if (getName() != null) {
try {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -151,8 +152,8 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
if (getValues() != null) {
for (int i = 0; i < getValues().size(); i++) {
try {
joiner.add(String.format("%svalues%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%svalues%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getValues().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported

View File

@ -15,6 +15,7 @@ package org.openapitools.client.auth;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import java.util.Locale;
public class ApiKeyAuth implements RequestInterceptor {
private final String location;
@ -50,7 +51,7 @@ public class ApiKeyAuth implements RequestInterceptor {
} else if ("header".equals(location)) {
template.header(paramName, apiKey);
} else if ("cookie".equals(location)) {
template.header("Cookie", String.format("%s=%s", paramName, apiKey));
template.header("Cookie", String.format(Locale.ROOT, "%s=%s", paramName, apiKey));
}
}
}

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
@ -22,6 +23,7 @@ import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.util.Locale;
/**
* Gets or Sets StringEnumRef

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -15,6 +15,7 @@ package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Locale;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;

View File

@ -42,6 +42,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -52,6 +52,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -49,6 +49,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -49,6 +49,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -49,6 +49,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -55,6 +55,7 @@ import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Locale;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -173,12 +174,12 @@ public class Bird {
// add `size` to the URL query string
if (getSize() != null) {
joiner.add(String.format("%ssize%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSize()))));
joiner.add(String.format(Locale.ROOT, "%ssize%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSize()))));
}
// add `color` to the URL query string
if (getColor() != null) {
joiner.add(String.format("%scolor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getColor()))));
joiner.add(String.format(Locale.ROOT, "%scolor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getColor()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -173,12 +174,12 @@ public class Category {
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -222,31 +223,31 @@ public class DataQuery extends Query {
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `outcomes` to the URL query string
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getOutcomes().get(i)))));
}
}
// add `suffix` to the URL query string
if (getSuffix() != null) {
joiner.add(String.format("%ssuffix%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuffix()))));
joiner.add(String.format(Locale.ROOT, "%ssuffix%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuffix()))));
}
// add `text` to the URL query string
if (getText() != null) {
joiner.add(String.format("%stext%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getText()))));
joiner.add(String.format(Locale.ROOT, "%stext%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getText()))));
}
// add `date` to the URL query string
if (getDate() != null) {
joiner.add(String.format("%sdate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDate()))));
joiner.add(String.format(Locale.ROOT, "%sdate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDate()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -501,8 +502,8 @@ public class DefaultValue {
if (getArrayStringEnumRefDefault() != null) {
for (int i = 0; i < getArrayStringEnumRefDefault().size(); i++) {
if (getArrayStringEnumRefDefault().get(i) != null) {
joiner.add(String.format("%sarray_string_enum_ref_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_enum_ref_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayStringEnumRefDefault().get(i)))));
}
}
@ -511,8 +512,8 @@ public class DefaultValue {
// add `array_string_enum_default` to the URL query string
if (getArrayStringEnumDefault() != null) {
for (int i = 0; i < getArrayStringEnumDefault().size(); i++) {
joiner.add(String.format("%sarray_string_enum_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_enum_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayStringEnumDefault().get(i)))));
}
}
@ -520,8 +521,8 @@ public class DefaultValue {
// add `array_string_default` to the URL query string
if (getArrayStringDefault() != null) {
for (int i = 0; i < getArrayStringDefault().size(); i++) {
joiner.add(String.format("%sarray_string_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayStringDefault().get(i)))));
}
}
@ -529,8 +530,8 @@ public class DefaultValue {
// add `array_integer_default` to the URL query string
if (getArrayIntegerDefault() != null) {
for (int i = 0; i < getArrayIntegerDefault().size(); i++) {
joiner.add(String.format("%sarray_integer_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_integer_default%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayIntegerDefault().get(i)))));
}
}
@ -538,8 +539,8 @@ public class DefaultValue {
// add `array_string` to the URL query string
if (getArrayString() != null) {
for (int i = 0; i < getArrayString().size(); i++) {
joiner.add(String.format("%sarray_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayString().get(i)))));
}
}
@ -547,8 +548,8 @@ public class DefaultValue {
// add `array_string_nullable` to the URL query string
if (getArrayStringNullable() != null) {
for (int i = 0; i < getArrayStringNullable().size(); i++) {
joiner.add(String.format("%sarray_string_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayStringNullable().get(i)))));
}
}
@ -556,15 +557,15 @@ public class DefaultValue {
// add `array_string_extension_nullable` to the URL query string
if (getArrayStringExtensionNullable() != null) {
for (int i = 0; i < getArrayStringExtensionNullable().size(); i++) {
joiner.add(String.format("%sarray_string_extension_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sarray_string_extension_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getArrayStringExtensionNullable().get(i)))));
}
}
// add `string_nullable` to the URL query string
if (getStringNullable() != null) {
joiner.add(String.format("%sstring_nullable%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStringNullable()))));
joiner.add(String.format(Locale.ROOT, "%sstring_nullable%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStringNullable()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -207,17 +208,17 @@ public class NumberPropertiesOnly {
// add `number` to the URL query string
if (getNumber() != null) {
joiner.add(String.format("%snumber%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNumber()))));
joiner.add(String.format(Locale.ROOT, "%snumber%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNumber()))));
}
// add `float` to the URL query string
if (getFloat() != null) {
joiner.add(String.format("%sfloat%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFloat()))));
joiner.add(String.format(Locale.ROOT, "%sfloat%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFloat()))));
}
// add `double` to the URL query string
if (getDouble() != null) {
joiner.add(String.format("%sdouble%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDouble()))));
joiner.add(String.format(Locale.ROOT, "%sdouble%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDouble()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -354,12 +355,12 @@ public class Pet {
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
// add `category` to the URL query string
@ -370,8 +371,8 @@ public class Pet {
// add `photoUrls` to the URL query string
if (getPhotoUrls() != null) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i)))));
}
}
@ -380,15 +381,15 @@ public class Pet {
if (getTags() != null) {
for (int i = 0; i < getTags().size(); i++) {
if (getTags().get(i) != null) {
joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
joiner.add(getTags().get(i).toUrlQueryString(String.format(Locale.ROOT, "%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
// add `status` to the URL query string
if (getStatus() != null) {
joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus()))));
joiner.add(String.format(Locale.ROOT, "%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -220,14 +221,14 @@ public class Query {
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `outcomes` to the URL query string
if (getOutcomes() != null) {
for (int i = 0; i < getOutcomes().size(); i++) {
joiner.add(String.format("%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
joiner.add(String.format(Locale.ROOT, "%soutcomes%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getOutcomes().get(i)))));
}
}

View File

@ -19,11 +19,13 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Locale;
/**
* Gets or Sets StringEnumRef
@ -73,7 +75,7 @@ public enum StringEnumRef {
prefix = "";
}
return String.format("%s=%s", prefix, this.toString());
return String.format(Locale.ROOT, "%s=%s", prefix, this.toString());
}
}

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -173,12 +174,12 @@ public class Tag {
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -142,7 +143,7 @@ public class TestFormObjectMultipartRequestMarker {
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();

View File

@ -19,6 +19,7 @@ import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import java.util.Locale;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@ -235,22 +236,22 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
// add `size` to the URL query string
if (getSize() != null) {
joiner.add(String.format("%ssize%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSize()))));
joiner.add(String.format(Locale.ROOT, "%ssize%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSize()))));
}
// add `color` to the URL query string
if (getColor() != null) {
joiner.add(String.format("%scolor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getColor()))));
joiner.add(String.format(Locale.ROOT, "%scolor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getColor()))));
}
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
joiner.add(String.format(Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
joiner.add(String.format(Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();

Some files were not shown because too many files have changed in this diff Show More