Skip to content

Commit

Permalink
mvnd --status throws NumberFormatException in 0.0.9 #147
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Oct 26, 2020
1 parent a1d8d95 commit 73e8a9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion common/src/main/java/org/jboss/fuse/mvnd/common/OsUtils.java
Expand Up @@ -56,7 +56,13 @@ public static long findProcessRssInKb(long pid) {
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")));
Expand Down

0 comments on commit 73e8a9a

Please sign in to comment.