Add java 9 support for bootclasspath to JvmInfo (it throws UOE otherwise which is not properly handled)

This commit is contained in:
Robert Muir 2015-09-10 22:15:27 -04:00
parent fb3bd2bb43
commit 552d5b0f65
1 changed files with 10 additions and 1 deletions

View File

@ -73,7 +73,16 @@ public class JvmInfo implements Streamable, ToXContent {
// ignore
}
info.inputArguments = runtimeMXBean.getInputArguments().toArray(new String[runtimeMXBean.getInputArguments().size()]);
info.bootClassPath = runtimeMXBean.getBootClassPath();
try {
info.bootClassPath = runtimeMXBean.getBootClassPath();
} catch (UnsupportedOperationException e) {
// oracle java 9
info.bootClassPath = System.getProperty("sun.boot.class.path");
if (info.bootClassPath == null) {
// something else
info.bootClassPath = "<unknown>";
}
}
info.classPath = runtimeMXBean.getClassPath();
info.systemProperties = runtimeMXBean.getSystemProperties();