The Maven plugin needs to have much more robust/defensive code. It is way too easy to produce a NPE with mvn spring-boot:run by just doing this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument></argument>
</arguments>
</configuration>
</plugin>
This looks like a bug in Maven to me that we'll probably need to work around. It appears to translate <argument></argument> into null. I'd expect an empty string instead.
@alan-czajkowski What version of Maven are you using?
@wilkinsona I wouldn't blame Maven for this, this can easily be expected behaviour, and I don't necessarily agree that an empty String would result from that, what needs to happen is that the code needs to be very defensive, you can very easily check for a non-blank value using:
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isBlank-java.lang.CharSequence-
I'm using Maven 3.5 (but that should be irrelevant)
as a little jab at Spring, this just doesn't cut it for me:
https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/util/StringUtils.html
馃槃
Thanks, but I'm well aware of how to check if a String is null or empty. I can even do it without using a third-party library.
@wilkinsona I wasn't trying to offend, I just like using utility classes/3rd-party libraries because they make the code nicer and easier to read, that is all
Duplicate of #9916
Most helpful comment
Thanks, but I'm well aware of how to check if a String is null or empty. I can even do it without using a third-party library.