Skip to content

Commit

Permalink
Merge pull request #584 from sumeetphadnis/master
Browse files Browse the repository at this point in the history
FSDProtectedLogListener now supports a parameter to optionally print ellipsis for truncated fields
  • Loading branch information
ar authored Apr 16, 2024
2 parents 5577de8 + 20b80ef commit e38fa15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jpos/src/main/java/org/jpos/util/FSDProtectedLogListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
import org.jpos.iso.FSDISOMsg;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOUtil;
import java.util.List;

Expand Down Expand Up @@ -68,6 +67,7 @@ public class FSDProtectedLogListener implements LogListener, Configurable
String[] protectFields = null;
String[] wipeFields = null;
String[] truncateFields = null;
boolean truncateAddEllipsis = false;
Configuration cfg = null;
public static final String WIPED = "[WIPED]";
public static final byte[] BINARY_WIPED = ISOUtil.hex2byte ("AA55AA55");
Expand All @@ -94,6 +94,7 @@ public void setConfiguration (Configuration cfg)
truncateFields = ISOUtil.toStringArray (cfg.get ("truncate", ""));
protectFields = ISOUtil.toStringArray (cfg.get ("protect", ""));
wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", ""));
truncateAddEllipsis = cfg.getBoolean("truncate-add-ellipsis", false);
}
public synchronized LogEvent log (LogEvent ev) {
synchronized (ev.getPayLoad()) {
Expand Down Expand Up @@ -144,7 +145,7 @@ private void checkTruncated(FSDMsg m) {
// NOPMD: NOP
}
if (v != null && v.length() > len) {
m.set(f, v.substring(0, len));
m.set(f, v.substring(0, len) + (truncateAddEllipsis ? "...":""));
}
}
}
Expand Down

0 comments on commit e38fa15

Please sign in to comment.