diff --git a/core/src/main/java/com/spotify/metrics/jvm/FileDescriptorGaugeSet.java b/core/src/main/java/com/spotify/metrics/jvm/FileDescriptorGaugeSet.java index c6497c8..d709dd2 100644 --- a/core/src/main/java/com/spotify/metrics/jvm/FileDescriptorGaugeSet.java +++ b/core/src/main/java/com/spotify/metrics/jvm/FileDescriptorGaugeSet.java @@ -51,7 +51,13 @@ public Map getMetrics() { gauges.put(metricId, new Gauge() { @Override public Object getValue() { - return fileDescriptorRatioGauge.getValue(); + // Java 9 will throw java.lang.reflect.InaccessibleObjectException + // which does not exist in Java 8, therefore return 0. + try { + return fileDescriptorRatioGauge.getValue(); + } catch (final Exception e) { + return 0; + } } }); return Collections.unmodifiableMap(gauges);