From 0e1e70e3e99ab4d4c4c7c804ea1253225ce30d19 Mon Sep 17 00:00:00 2001 From: jansupol Date: Thu, 13 Jul 2023 09:13:59 +0200 Subject: [PATCH] Save time by not inspecting configuration for property when in PropertiesDelegate Signed-off-by: jansupol --- .../jersey/internal/PropertiesResolver.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/PropertiesResolver.java b/core-common/src/main/java/org/glassfish/jersey/internal/PropertiesResolver.java index 4b1727fc70..d2e1135662 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/PropertiesResolver.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/PropertiesResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023 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 @@ -84,16 +84,15 @@ public T resolveProperty(String name, T defaultValue) { } private T resolveProperty(final String name, Object defaultValue, final Class type) { - // Check runtime configuration first - Object result = configuration.getProperty(name); - if (result != null) { - defaultValue = result; - } - - // Check request properties next - result = delegate.getProperty(name); + // Check request properties property + Object result = delegate.getProperty(name); if (result == null) { - result = defaultValue; + + // Check runtime configuration next + result = configuration.getProperty(name); + if (result == null) { + result = defaultValue; + } } return (result == null) ? null : PropertiesHelper.convertValue(result, type);