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 in docker:save when supplying file name without directory #1203

Closed
wrosenuance opened this issue Apr 11, 2019 · 0 comments
Closed

NPE in docker:save when supplying file name without directory #1203

wrosenuance opened this issue Apr 11, 2019 · 0 comments

Comments

@wrosenuance
Copy link
Contributor

Description

If the docker.save.file system property is used to override the output location for docker:save and the property value is just a file name without a directory, the plugin throws an NPE.

Info

  • d-m-p version : 0.29-SNAPSHOT
  • Maven version (mvn -v) : 3.5.4

The issue is in ensureSaveDir(), which does not check for a null result from getParentFile(), which happens when the File does not specify a directory.

    private void ensureSaveDir(String fileName) throws MojoExecutionException {
        File saveDir = new File(fileName).getParentFile();
        if (!saveDir.exists()) {
            if (!saveDir.mkdirs()) {
                throw new MojoExecutionException("Can not create directory " + saveDir + " for storing save file");
            }
        }
    }

I will submit a PR to fix, it's easy.

wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 11, 2019
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 12, 2019
rhuss pushed a commit that referenced this issue Apr 12, 2019
rhuss pushed a commit that referenced this issue Apr 12, 2019
* Issue #1203 NPE if docker:save called with filename only.

Signed-off-by: William Rose <[email protected]>

* Issue #1205 Increase GZIP compression speed for docker:save.

Signed-off-by: William Rose <[email protected]>
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

1 participant