-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException for yml configuration files with empty list ([]) #1572
Comments
Problem is in |
Without a stack trace, I don't know exactly where the NPE is occurring, but if it's due to a missing origin then I think an investigation here is warranted. A property isn't guaranteed to have an origin so its absence needs to be tolerated. |
Here's the exception that's thrown when using Spring Cloud Commons 2.2.2.RELEASE:
|
Related and a duplicate |
Where is the ticked to Spring Boot issue? Please, provide. |
@yan-khonski-it There's a link to it above. spring-projects/spring-boot#20506 was opened. |
Requesting config-server for config of a service will throw a NullPointException when using yml configuration which contains an empty list([]).
This only occurs when using accept header
application/vnd.spring-cloud.config-server.v2+json
which is the new default when using a config-client.Problem is that the origin is null at https://github.com/spring-cloud/spring-cloud-config/blob/v2.2.2.RELEASE/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/PassthruEnvironmentRepository.java#L101
Reproduction
Create spring-config-server from https://start.spring.io/ and setup a local repo.
(Using Spring Boot 2.2.5)
Add following sample (
demo-client.yml
) into repo and commitStart config-server and try to access this configuration file.
Working (old without accept header)
curl http://localhost:8888/demo-client/default
Exception
curl -H "accept: application/vnd.spring-cloud.config-server.v2+json" http://localhost:8888/demo-client/default
Newer config-clients are accessing this through the new media-type (config-sever.v2).
See https://github.com/spring-cloud/spring-cloud-config/blob/v2.2.2.RELEASE/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java#L254
The text was updated successfully, but these errors were encountered: