viclovsky / swagger-coverage

Tool which generates full picture of coverage of API tests based on OAS (Swagger) v2 and v3
Apache License 2.0
198 stars 37 forks source link

fix npe in case of operation without tags #68

Closed lostlittle closed 3 years ago

lostlittle commented 3 years ago

When spec contains operation without tags, error occurs:

java.lang.NullPointerException
    at java.base/java.util.Objects.requireNonNull(Objects.java:221)
    at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:178)
    at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.base/java.util.TreeMap$EntrySpliterator.forEachRemaining(TreeMap.java:2962)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.TagStatisticsBuilder.configure(TagStatisticsBuilder.java:48)
    at com.github.viclovsky.swagger.coverage.core.results.builder.postbuilder.TagStatisticsBuilder.configure(TagStatisticsBuilder.java:24)
    at com.github.viclovsky.swagger.coverage.configuration.Configuration.lambda$getStatisticsBuilders$2(Configuration.java:44)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at com.github.viclovsky.swagger.coverage.configuration.Configuration.getStatisticsBuilders(Configuration.java:46)
viclovsky commented 3 years ago

LGFM šŸ‘
Thanks for pull request.