diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java index 42865b4cbcd1..fd7f105715b9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AdaCodegen.java @@ -21,11 +21,10 @@ import java.io.IOException; import java.io.Writer; +import org.apache.commons.lang3.StringUtils; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; import org.openapitools.codegen.*; -import org.openapitools.codegen.utils.ModelUtils; - public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig { @@ -54,7 +53,7 @@ public void processOpts() { if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { packageName = (String) additionalProperties.get(CodegenConstants.PACKAGE_NAME); } - if (packageName == "") { + if (StringUtils.isEmpty(packageName)) { packageName = modelPackage; } String srcPrefix = "src" + File.separator; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java index fa103a1a3256..db7799d827b2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java @@ -170,7 +170,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation if (response != null) { CodegenProperty cm = fromProperty("response", response); op.vendorExtensions.put("x-codegen-response", cm); - if (cm.datatype == "HttpContent") { + if ("HttpContent".equals(cm.datatype)) { op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java index 2cde67af48ab..3e7f02671ab9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java @@ -53,7 +53,7 @@ public CppQt5ClientCodegen() { outputFolder = "generated-code/qt5cpp"; // set modelNamePrefix as default for QT5CPP - if ("".equals(modelNamePrefix)) { + if (StringUtils.isEmpty(modelNamePrefix)) { modelNamePrefix = PREFIX; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java index 5e17b9197338..d5cce8cb2ee4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestClientCodegen.java @@ -241,7 +241,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation if (response != null) { CodegenProperty cm = fromProperty("response", response); op.vendorExtensions.put("x-codegen-response", cm); - if (cm.datatype == "HttpContent") { + if ("HttpContent".equals(cm.datatype)) { op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java index cb5aed630a00..e419d4270351 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java @@ -281,7 +281,7 @@ public String escapeReservedWord(String name) { @Override public String toOperationId(String operationId) { // throw exception if method name is empty - if ("".equals(operationId)) { + if (StringUtils.isEmpty(operationId)) { throw new RuntimeException("Empty method name (operationId) not allowed"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index e4443782b826..d403f1562a77 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -20,6 +20,7 @@ import io.swagger.v3.oas.models.Operation; import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenProperty; @@ -107,7 +108,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index e4dc8a90ca68..ed0a18fc8f40 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -19,6 +19,7 @@ import io.swagger.v3.oas.models.Operation; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenModel; @@ -147,7 +148,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { @@ -156,7 +157,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.subresourceOperation = !co.path.isEmpty(); } List opList = operations.get(basePath); - if (opList == null) { + if (opList == null || opList.isEmpty()) { opList = new ArrayList(); operations.put(basePath, opList); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java index 86947dd58a93..387d75dead6f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java @@ -18,7 +18,6 @@ package org.openapitools.codegen.languages; import org.openapitools.codegen.*; -import org.openapitools.codegen.languages.features.BeanValidationFeatures; import io.swagger.v3.oas.models.*; import java.util.*; @@ -171,7 +170,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { @@ -180,7 +179,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.subresourceOperation = !co.path.isEmpty(); } List opList = operations.get(basePath); - if (opList == null) { + if (opList == null || opList.isEmpty()) { opList = new ArrayList(); operations.put(basePath, opList); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMSF4JServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMSF4JServerCodegen.java index 8bb85d0fcc2a..046a3084de1f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMSF4JServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMSF4JServerCodegen.java @@ -152,7 +152,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java index e59d6f85656f..22e874ba6006 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java @@ -126,7 +126,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty("")) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { @@ -135,7 +135,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.subresourceOperation = !co.path.isEmpty(); } List opList = operations.get(basePath); - if (opList == null) { + if (opList == null || opList.isEmpty()) { opList = new ArrayList(); operations.put(basePath, opList); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyServerCodegen.java index 16b1135d8d6b..52b0ab16d967 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyServerCodegen.java @@ -18,7 +18,6 @@ package org.openapitools.codegen.languages; import org.openapitools.codegen.*; -import org.openapitools.codegen.languages.features.BeanValidationFeatures; import org.openapitools.codegen.languages.features.JbossFeature; import io.swagger.v3.oas.models.*; import org.apache.commons.lang3.BooleanUtils; @@ -129,7 +128,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera basePath = basePath.substring(0, pos); } - if (basePath == "") { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { @@ -138,7 +137,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.subresourceOperation = !co.path.isEmpty(); } List opList = operations.get(basePath); - if (opList == null) { + if (opList == null || opList.isEmpty()) { opList = new ArrayList(); operations.put(basePath, opList); }