e-gineering / gitflow-helper-maven-plugin

An extension and plugin that teaches Maven to work well with gitflow projects and CI servers.
Apache License 2.0
76 stars 21 forks source link

Fix NPE due to non-present snapshots element in repository configuration #80

Closed ukcrpb6 closed 6 years ago

ukcrpb6 commented 7 years ago

Prevent NPE from occurring due to non-present <snapshots><enabled>..…….</enabled></snapshots> entry in repository configuration (this block is optional). Fix bug in ExpansionBuffer whereby debugging causes mutation of the buffer

ukcrpb6 commented 7 years ago

Note that with regards to the expander, a more immutable replacement system could be achieved using something like: https://gist.github.com/ukcrpb6/9c64d9f4ef72b97763b7fe42746ab6a5

private static final NamedFormatter EXPANDER = NamedFormatter.on("\\$\\{", "\\}")
                .ignoreMissingProperties()
                .skipNulls()    
                .recursiveReplacement()
                .withoutFunctionSupport();

...

String output = EXPANDER.format(input, properties);

Note that the above is more complex than required as it abstracts placeholder replacement into a fluent builder and thus has many unused operations in this context