From f89034214c623aa1d1780a2f1ecb3ca94abe2932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alcarraz?= Date: Thu, 17 Aug 2023 19:31:01 -0500 Subject: [PATCH 1/2] Only set mux key once. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrés Alcarraz --- jpos/src/main/java/org/jpos/q2/iso/QMUX.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java index fa3811be5e..0453a2061b 100644 --- a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java +++ b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java @@ -75,14 +75,12 @@ public void initService () throws ConfigurationException { throw new ConfigurationException ("Misconfigured QMUX. Please verify in/out queues"); } ignorerc = Environment.get(e.getChildTextTrim ("ignore-rc")); - key = toStringArray(DEFAULT_KEY, ", ", null); + key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); returnRejects = cfg.getBoolean("return-rejects", false); for (Element keyElement : e.getChildren("key")) { String mtiOverride = QFactory.getAttributeValue(keyElement, "mti"); if (mtiOverride != null && mtiOverride.length() >= 2) { mtiKey.put (mtiOverride.substring(0,2), toStringArray(keyElement.getTextTrim(), ", ", null)); - } else { - key = toStringArray(e.getChildTextTrim("key"), ", ", DEFAULT_KEY); } } ready = toStringArray(Environment.get(e.getChildTextTrim ("ready"))); From 85ebb8d24e77bb4994b6a273443807de408373fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alcarraz?= Date: Thu, 17 Aug 2023 20:09:46 -0500 Subject: [PATCH 2/2] Implement property expansion for mux key. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrés Alcarraz --- jpos/src/main/java/org/jpos/q2/iso/QMUX.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java index 0453a2061b..7e5b43ed2d 100644 --- a/jpos/src/main/java/org/jpos/q2/iso/QMUX.java +++ b/jpos/src/main/java/org/jpos/q2/iso/QMUX.java @@ -470,10 +470,9 @@ public void dump (PrintStream p, String indent) { metrics.dump (p, indent); } private String[] toStringArray(String s, String delimiter, String def) { - if (s == null) - s = def; + s = (s != null) ? Environment.get(s) : def; String[] arr = null; - if (s != null && s.length() > 0) { + if (s != null && !s.isEmpty()) { StringTokenizer st; if (delimiter != null) st = new StringTokenizer(s, delimiter);