mirror of https://github.com/apache/lucene.git
LUCENE-6795: Improve SystemInfoHandler for IBM J9 OperatingSystemMXBean (some properties may throw UOE)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1702669 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
421afac9a9
commit
208a153780
|
@ -29,6 +29,7 @@ import java.lang.management.ManagementFactory;
|
|||
import java.lang.management.OperatingSystemMXBean;
|
||||
import java.lang.management.PlatformManagedObject;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.Charset;
|
||||
|
@ -216,9 +217,15 @@ public class SystemInfoHandler extends RequestHandlerBase
|
|||
final BeanInfo beanInfo = Introspector.getBeanInfo(intf, intf.getSuperclass(), Introspector.IGNORE_ALL_BEANINFO);
|
||||
for (final PropertyDescriptor desc : beanInfo.getPropertyDescriptors()) {
|
||||
final String name = desc.getName();
|
||||
final Object v = desc.getReadMethod().invoke(obj);
|
||||
if(v != null && info.get(name) == null) {
|
||||
info.add(name, v);
|
||||
if (info.get(name) == null) {
|
||||
try {
|
||||
final Object v = desc.getReadMethod().invoke(obj);
|
||||
if(v != null) {
|
||||
info.add(name, v);
|
||||
}
|
||||
} catch (InvocationTargetException ite) {
|
||||
// ignore (some properties throw UOE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue