This is an automated email from the ASF dual-hosted git repository. amichai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
commit 2a8d1c405bd4c5f3102b60a8349aa9aac8954cd6 Author: Amichai Rothman <[email protected]> AuthorDate: Sun Mar 15 12:48:18 2026 +0200 Refactor ExportRegistrationImpl.update() --- .../apache/aries/rsa/core/ExportRegistrationImpl.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java b/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java index 9a722885..08149d3e 100644 --- a/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java +++ b/rsa/src/main/java/org/apache/aries/rsa/core/ExportRegistrationImpl.java @@ -49,7 +49,7 @@ public class ExportRegistrationImpl implements ExportRegistration { private int instanceCount; private volatile boolean closed; - private EventProducer sender; + private final EventProducer sender; private ExportRegistrationImpl(ExportRegistrationImpl parent, CloseHandler rsaCore, @@ -186,22 +186,16 @@ public class ExportRegistrationImpl implements ExportRegistration { if (ref == null) { return null; } - ServiceReference<?> sref = ref.getExportedService(); - HashMap<String, Object> props = new HashMap<>(properties); - EndpointDescription oldEpd = ref.getExportedEndpoint(); - copyIfNull(props, oldEpd, RemoteConstants.ENDPOINT_ID); - copyIfNull(props, oldEpd, RemoteConstants.SERVICE_IMPORTED_CONFIGS); + Map<String, Object> oldProps = ref.getExportedEndpoint().getProperties(); + Map<String, Object> props = new HashMap<>(properties); + props.putIfAbsent(RemoteConstants.ENDPOINT_ID, oldProps.get(RemoteConstants.ENDPOINT_ID)); + props.putIfAbsent(RemoteConstants.SERVICE_IMPORTED_CONFIGS, oldProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS)); + ServiceReference<?> sref = ref.getExportedService(); EndpointDescription epd = new EndpointDescription(sref, props); exportReference = new ExportReferenceImpl(sref, epd); this.sender.notifyUpdate(ref); return epd; } - - private void copyIfNull(HashMap<String, Object> props, EndpointDescription oldEpd, String key) { - if (props.get(key) == null) { - props.put(key, oldEpd.getProperties().get(key)); - } - } }
