mvnd --status throws NumberFormatException in 0.0.9 #147

This commit is contained in:
Peter Palaga
2020-10-26 09:02:13 +01:00
parent a1d8d951cf
commit 73e8a9acb3

View File

@@ -56,7 +56,13 @@ public class OsUtils {
final List<String> output = new ArrayList<String>(1);
exec(cmd, output);
if (output.size() == 1) {
return Long.parseLong(output.get(0));
try {
return Long.parseLong(output.get(0).trim());
} catch (NumberFormatException e) {
LOGGER.warn("Could not parse the output of " + Stream.of(cmd).collect(Collectors.joining(" "))
+ " as a long:\n"
+ output.stream().collect(Collectors.joining("\n")));
}
} else {
LOGGER.warn("Unexpected output of " + Stream.of(cmd).collect(Collectors.joining(" ")) + ":\n"
+ output.stream().collect(Collectors.joining("\n")));