NullPointerException for MediaType.getSchema()

See original GitHub issue

I’m facing a NullPointerException issue.

The command that I ran was: ./cats.jar --contract=openapi.yaml --server=https://subdomain.domain-name --paths=/v1/endpoint --headers=headers.yaml

Result Info

[********* ][*****] ● note     Proxy configuration to be used: DIRECT
[********* ][*****] ▶ start    Starting CATS, version 6.0.4, build-time 2021-07-23T06:05:54.116 UTC
[********* ][*****] ● note     Processing configuration...
[********* ][*****] ℹ info     No security custom Fuzzer file. SecurityFuzzer will be skipped!
[********* ][*****] ℹ info     No custom Fuzzer file. CustomFuzzer will be skipped!
[********* ][*****] ℹ info     No reference data file was supplied! Payloads supplied by Fuzzers will remain unchanged!
[********* ][*****] ▶ start    skipXXXForPath supplied arguments: []. Matching with registered fuzzers...
[********* ][*****] ☑ complete skipXXXForPath list after matching with registered fuzzers: []
[********* ][*****] ✖ error    Something went wrong while running CATS!
java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.media.MediaType.getSchema()" because the return value of "io.swagger.v3.oas.models.media.Content.get(Object)" is null
	at com.endava.cats.CatsMain.addToSchemas(CatsMain.java:123)
	at com.endava.cats.CatsMain.lambda$getSchemas$0(CatsMain.java:111)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:723)
	at com.endava.cats.CatsMain.getSchemas(CatsMain.java:111)
	at com.endava.cats.CatsMain.fuzzPath(CatsMain.java:355)
	at com.endava.cats.CatsMain.startFuzzing(CatsMain.java:175)
	at com.endava.cats.CatsMain.doLogic(CatsMain.java:166)
	at com.endava.cats.CatsMain.run(CatsMain.java:144)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:345)
	at com.endava.cats.CatsMain.main(CatsMain.java:102)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)

How can I fix this issue?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
en-miliecommented, Aug 25, 2021

@8luebottle I fixed this. For now CATS does not support other content types outside applixation/json. In your example the request body is a multipart/form-data. CATS will now print a warning instead of failing with NPE.

0reactions
8luebottlecommented, Aug 26, 2021

@en-milie Got it. I appreciate your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NullPointerException at io.swagger.v3.parser ...
NullPointerException at io.swagger.v3.parser.converter. ... description: Album information associated with the media type: string artist: ...
Read more >
io.swagger.v3.parser.util.OpenAPIDeserializer.getSchema ...
ObjectNode schema = (ObjectNode) schemaValue; Schema schemaObj = getSchema(schema, String.format("%s.%s", location, schemaName), result);
Read more >
NullPointerException MediaType in RestTemplate Spring boot
This is problem from 2.2.0 spring-boot. They set deprecation for default charset encoding. Try replacing with followingFor both type. json ...
Read more >
Example usage for java.lang NullPointerException getMessage
Introduction. In this page you can find the example usage for java.lang NullPointerException getMessage. Prototype. public String getMessage().
Read more >
Solr - java.lang.NullPointerException : createMainQuery
I ran into issues indexing a csv document, in the schema config i had specified a uniqueKey value, for some reason it kept...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found