> @@ -339,7 +339,9 @@ public boolean apply(SoftwareDescription input) {
>
> private OperatingSystem getOperatingSystem(Map.Entry<String,
> SoftwareDescription> entry) {
> SoftwareDescription softwareDescription = entry.getValue();
> - if (isOperatingSystem(softwareDescription)) {
> + if (!isOperatingSystem(softwareDescription)) {
> + return null;
I think this method should be changed:
* Why does it receive a `Map.Entry` parameter? Change it to receive a String
and a SoftwareDescription object, to make its signature more clean and
meaningful.
* Also, returning `null` is evil. Avoid that. As this is a private method only
used to populate values in a Set, just make it return void and refactor to
something like `addOperatingSystemToSet`, and pass the Set as a parameter too.
This way the method logic is self-contained and you're not propagating details
such as the null value (which can introduce NPE issues) to the outside.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/568/files#r18695140