From c88174eafdb2ec759db97b9e7d07947f4734734d Mon Sep 17 00:00:00 2001 From: kymbalon Date: Mon, 8 Apr 2019 15:39:29 +0200 Subject: [PATCH] Null-safe check of CodegenSecurity Booleans (#2608) (#2619) * Null-safe check of CodegenSecurity Booleans (#2608) * Null-safe check of CodegenSecurity Booleans (#2608) --- .../java/org/openapitools/codegen/DefaultGenerator.java | 6 +++--- .../java/org/openapitools/codegen/utils/ProcessUtils.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 2438781a0b7..48083534dd5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -1249,7 +1249,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { private boolean hasOAuthMethods(List authMethods) { for (CodegenSecurity cs : authMethods) { - if (cs.isOAuth) { + if (Boolean.TRUE.equals(cs.isOAuth)) { return true; } } @@ -1259,7 +1259,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { private boolean hasBearerMethods(List authMethods) { for (CodegenSecurity cs : authMethods) { - if (cs.isBasicBearer) { + if (Boolean.TRUE.equals(cs.isBasicBearer)) { return true; } } @@ -1271,7 +1271,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { List oauthMethods = new ArrayList<>(); for (CodegenSecurity cs : authMethods) { - if (cs.isOAuth) { + if (Boolean.TRUE.equals(cs.isOAuth)) { oauthMethods.add(cs); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ProcessUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ProcessUtils.java index ab8fe446fb8..c2d7859ecb2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ProcessUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ProcessUtils.java @@ -59,7 +59,7 @@ public class ProcessUtils { for (CodegenOperation operation : ops) { if (operation.authMethods != null && !operation.authMethods.isEmpty()) { for (CodegenSecurity cs : operation.authMethods) { - if (cs.isOAuth) { + if (Boolean.TRUE.equals(cs.isOAuth)) { return true; } } @@ -83,7 +83,7 @@ public class ProcessUtils { for (CodegenOperation operation : ops) { if (operation.authMethods != null && !operation.authMethods.isEmpty()) { for (CodegenSecurity cs : operation.authMethods) { - if (cs.isBasicBearer) { + if (Boolean.TRUE.equals(cs.isBasicBearer)) { return true; } }