[Java][jersey2] Allow setting serverIndex to null (#6321)

This commit is contained in:
Slavek Kabrda 2020-05-17 17:44:54 +02:00 committed by GitHub
parent c81359304d
commit 66948e6570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View File

@ -251,7 +251,9 @@ public class ApiClient {
}
private void updateBasePath() {
setBasePath(servers.get(serverIndex).URL(serverVariables));
if (serverIndex != null) {
setBasePath(servers.get(serverIndex).URL(serverVariables));
}
}
{{#hasOAuthMethods}}
@ -1030,7 +1032,7 @@ public class ApiClient {
// Not using `.target(targetURL).path(path)` below,
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
String targetURL;
if (operationServers.containsKey(operation)) {
if (serverIndex != null && operationServers.containsKey(operation)) {
Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex;
Map<String, String> variables = operationServerVariables.containsKey(operation) ?
operationServerVariables.get(operation) : serverVariables;

View File

@ -168,7 +168,9 @@ public class ApiClient {
}
private void updateBasePath() {
setBasePath(servers.get(serverIndex).URL(serverVariables));
if (serverIndex != null) {
setBasePath(servers.get(serverIndex).URL(serverVariables));
}
}
private void setOauthBasePath(String basePath) {
@ -937,7 +939,7 @@ public class ApiClient {
// Not using `.target(targetURL).path(path)` below,
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
String targetURL;
if (operationServers.containsKey(operation)) {
if (serverIndex != null && operationServers.containsKey(operation)) {
Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex;
Map<String, String> variables = operationServerVariables.containsKey(operation) ?
operationServerVariables.get(operation) : serverVariables;

View File

@ -168,7 +168,9 @@ public class ApiClient {
}
private void updateBasePath() {
setBasePath(servers.get(serverIndex).URL(serverVariables));
if (serverIndex != null) {
setBasePath(servers.get(serverIndex).URL(serverVariables));
}
}
private void setOauthBasePath(String basePath) {
@ -937,7 +939,7 @@ public class ApiClient {
// Not using `.target(targetURL).path(path)` below,
// to support (constant) query string in `path`, e.g. "/posts?draft=1"
String targetURL;
if (operationServers.containsKey(operation)) {
if (serverIndex != null && operationServers.containsKey(operation)) {
Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex;
Map<String, String> variables = operationServerVariables.containsKey(operation) ?
operationServerVariables.get(operation) : serverVariables;