Skip to content
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

NPE when cacheFrom is missing from config #1274

Closed
travishaagen opened this issue Oct 9, 2019 · 5 comments
Closed

NPE when cacheFrom is missing from config #1274

travishaagen opened this issue Oct 9, 2019 · 5 comments

Comments

@travishaagen
Copy link
Contributor

Description

A NullPointerException is thrown when cacheFrom is missing from the configuration.

Caused by: java.lang.NullPointerException
    at io.fabric8.maven.docker.config.handler.property.PropertyConfigHandler.extractBuildConfiguration (PropertyConfigHandler.java:140)
    at io.fabric8.maven.docker.config.handler.property.PropertyConfigHandler.resolve (PropertyConfigHandler.java:73)
...

Info

The fix is most likely to update the following line in PropertyConfigHandler to check for config.getCacheFrom() returning null, instead of calling .toString() in all cases:

.cacheFrom(valueProvider.getString(CACHE_FROM, config == null ? null : config.getCacheFrom().toString()))

The workaround is to provide an empty tag in the config:

                            <build>
                                <dockerFile>Dockerfile</dockerFile>
                                <cacheFrom/>
                            </build>
@rohanKanojia
Copy link
Member

@travishaagen Which version are you using?

@travishaagen
Copy link
Contributor Author

I was going from 0.28.0 to 0.31.0.

@rohanKanojia
Copy link
Member

oh, so it's still reproducible on 0.31.0. Could you please raise a PR to resolve this?

travishaagen added a commit to travishaagen/docker-maven-plugin that referenced this issue Oct 9, 2019
@travishaagen
Copy link
Contributor Author

Done! :)

@rhuss
Copy link
Collaborator

rhuss commented Oct 10, 2019

thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants