From e542dd0589493af717f0d4c725a38f5d82ab0f1f Mon Sep 17 00:00:00 2001 From: Barzilai Spinak Date: Thu, 21 Nov 2024 18:59:46 -0300 Subject: [PATCH] Avoid exceptions when dumping ctx --- .../src/main/java/org/jpos/transaction/Context.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jpos/src/main/java/org/jpos/transaction/Context.java b/jpos/src/main/java/org/jpos/transaction/Context.java index ca1f740f23..d178acdd88 100644 --- a/jpos/src/main/java/org/jpos/transaction/Context.java +++ b/jpos/src/main/java/org/jpos/transaction/Context.java @@ -440,7 +440,11 @@ protected void dumpEntry (PrintStream p, String indent, Map.Entry Object value = entry.getValue(); if (value instanceof Loggeable) { p.println(); - ((Loggeable) value).dump(p, indent + " "); + try { + ((Loggeable) value).dump(p, indent + " "); + } catch (Exception ex) { + ex.printStackTrace(p); + } p.print(indent); } else if (value instanceof Element) { p.println(); @@ -470,10 +474,15 @@ else if (value instanceof LogEvent) { ((LogEvent) value).dump(p, indent); p.print(indent); } else if (value != null) { - LogUtil.dump(p, indent, value.toString()); + try { + LogUtil.dump(p, indent, value.toString()); + } catch (Exception ex) { + ex.printStackTrace(p); + } } p.println(); } + /** * return a LogEvent used to store trace information * about this transaction.