Added better null check for imports
in codegen
#6079
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the PR
When generating client libs for the EVE Online ESI API a null pointer exception occured preventing the libs from being build.
Reproduce the error
git clone https://github.com/swagger-api/swagger-codegen
cd swagger-codegen
mvn clean package
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
-i https://esi.tech.ccp.is/latest/swagger.json
-l java
-o samples/client/eve-online-esi-api/java
Fix
I traced the root cause of the null pointer exception and prevented it by a not-null-check when adding the object in question.
Caution: I have absolutely no idea what the code were I implemented the fix does!!!
Please check the fix for any side effects. I only tested the fix with the petstore and eve specs and both can build their client libs.