Skip to content

Commit 0a28aad

Browse files
Matthew McGarveywing328
authored andcommitted
[MAVEN PLUGIN] Checking for null configOptions before looking for property (#7613)
* Checking for null configOptions * Inline configOptions check
1 parent f41683a commit 0a28aad

File tree

1 file changed

+13
-10
lines changed
  • modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin

1 file changed

+13
-10
lines changed

modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
/*
44
* Copyright 2001-2005 The Apache Software Foundation.
5-
*
5+
*
66
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
77
* in compliance with the License. You may obtain a copy of the License at
8-
*
8+
*
99
* http://www.apache.org/licenses/LICENSE-2.0
10-
*
10+
*
1111
* Unless required by applicable law or agreed to in writing, software distributed under the License
1212
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
1313
* or implied. See the License for the specific language governing permissions and limitations under
@@ -210,6 +210,9 @@ public class CodeGenMojo extends AbstractMojo {
210210

211211
/**
212212
* A map of additional properties that can be referenced by the mustache templates
213+
* <additionalProperties>
214+
* <additionalProperty>key=value</additionalProperty>
215+
* </additionalProperties>
213216
*/
214217
@Parameter(name = "additionalProperties")
215218
private List<String> additionalProperties;
@@ -218,7 +221,7 @@ public class CodeGenMojo extends AbstractMojo {
218221
* A map of reserved names and how they should be escaped
219222
*/
220223
@Parameter(name = "reservedWordsMappings")
221-
private List<String> reservedWordsMappings;
224+
private List<String> reservedWordsMappings;
222225

223226
/**
224227
* Generate the apis
@@ -466,32 +469,32 @@ public void execute() throws MojoExecutionException {
466469
}
467470

468471
//Apply Instantiation Types
469-
if (instantiationTypes != null && !configOptions.containsKey("instantiation-types")) {
472+
if (instantiationTypes != null && (configOptions == null || !configOptions.containsKey("instantiation-types"))) {
470473
applyInstantiationTypesKvpList(instantiationTypes, configurator);
471474
}
472475

473476
//Apply Import Mappings
474-
if (importMappings != null && !configOptions.containsKey("import-mappings")) {
477+
if (importMappings != null && (configOptions == null || !configOptions.containsKey("import-mappings"))) {
475478
applyImportMappingsKvpList(importMappings, configurator);
476479
}
477480

478481
//Apply Type Mappings
479-
if (typeMappings != null && !configOptions.containsKey("type-mappings")) {
482+
if (typeMappings != null && (configOptions == null || !configOptions.containsKey("type-mappings"))) {
480483
applyTypeMappingsKvpList(typeMappings, configurator);
481484
}
482485

483486
//Apply Language Specific Primitives
484-
if (languageSpecificPrimitives != null && !configOptions.containsKey("language-specific-primitives")) {
487+
if (languageSpecificPrimitives != null && (configOptions == null || !configOptions.containsKey("language-specific-primitives"))) {
485488
applyLanguageSpecificPrimitivesCsvList(languageSpecificPrimitives, configurator);
486489
}
487490

488491
//Apply Additional Properties
489-
if (additionalProperties != null && !configOptions.containsKey("additional-properties")) {
492+
if (additionalProperties != null && (configOptions == null || !configOptions.containsKey("additional-properties"))) {
490493
applyAdditionalPropertiesKvpList(additionalProperties, configurator);
491494
}
492495

493496
//Apply Reserved Words Mappings
494-
if (reservedWordsMappings != null && !configOptions.containsKey("reserved-words-mappings")) {
497+
if (reservedWordsMappings != null && (configOptions == null || !configOptions.containsKey("reserved-words-mappings"))) {
495498
applyReservedWordsMappingsKvpList(reservedWordsMappings, configurator);
496499
}
497500

0 commit comments

Comments
 (0)