diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/jmx/ExecutionStatisticsDynamicBean.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/jmx/ExecutionStatisticsDynamicBean.java index b040f2b975..8d79b45ced 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/jmx/ExecutionStatisticsDynamicBean.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/jmx/ExecutionStatisticsDynamicBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -173,10 +173,15 @@ public void setAttribute(Attribute attribute) @Override public AttributeList getAttributes(String[] attributes) { - AttributeList x = new AttributeList(); - for (String k : attributes) { - Attribute a = new Attribute(k, attributeValues.get(k).get()); - x.add(a); + final AttributeList x = new AttributeList(); + if (attributes == null) { + return x; + } + for (final String k : attributes) { + final Value value = attributeValues.get(k); + if (value != null) { + x.add(new Attribute(k, value.get())); + } } return x; }