diff --git a/jpos/src/main/java/org/jpos/transaction/Context.java b/jpos/src/main/java/org/jpos/transaction/Context.java index 1d70e3e0eb..c55a8ffe55 100644 --- a/jpos/src/main/java/org/jpos/transaction/Context.java +++ b/jpos/src/main/java/org/jpos/transaction/Context.java @@ -279,14 +279,12 @@ public synchronized Map getMap() { } protected void dumpMap (PrintStream p, String indent) { - if (map != null) { - Map cloned; - cloned = Collections.synchronizedMap (new LinkedHashMap<>()); - synchronized(map) { - cloned.putAll(map); - } - cloned.entrySet().forEach(e -> dumpEntry(p, indent, e)); + Map m = getMap(); + Map cloned = Collections.synchronizedMap (new LinkedHashMap<>()); + synchronized(m) { + cloned.putAll(m); } + cloned.entrySet().forEach(e -> dumpEntry(p, indent, e)); } protected void dumpEntry (PrintStream p, String indent, Map.Entry entry) { @@ -298,7 +296,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(""); @@ -329,10 +331,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. @@ -402,7 +409,7 @@ public PausedTransaction getPausedTransaction() { public PausedTransaction getPausedTransaction(long timeout) { return get (PAUSED_TRANSACTION.toString(), timeout); } - + public void setTimeout (long timeout) { this.timeout = timeout; }