From bb2e99ea011a94f51034f69513be079e401f50c8 Mon Sep 17 00:00:00 2001 From: Barzilai Spinak Date: Mon, 20 Nov 2023 15:06:39 -0300 Subject: [PATCH] Avoid long-lived reference to DOM Element within lambda closure --- .../qrest/src/main/java/org/jpos/qrest/participant/Router.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/qrest/src/main/java/org/jpos/qrest/participant/Router.java b/modules/qrest/src/main/java/org/jpos/qrest/participant/Router.java index e91b136618..6b4feb9ad5 100644 --- a/modules/qrest/src/main/java/org/jpos/qrest/participant/Router.java +++ b/modules/qrest/src/main/java/org/jpos/qrest/participant/Router.java @@ -72,13 +72,14 @@ public String select(long id, Serializable context) { public void setConfiguration(Element e) throws ConfigurationException { try { for (Element r : e.getChildren("route")) { + String name = r.getAttributeValue("name"); routes.computeIfAbsent( r.getAttributeValue("method"), k -> new ArrayList<>()).add( new Route<>( r.getAttributeValue("path"), r.getAttributeValue("method"), - (t, s) -> r.getAttributeValue("name")) + (t, s) -> name) ); } } catch (Throwable t) {