@Test public void testLogThrowsNullPointerException() throws Throwable { try { new ProtectedLogListener().log(null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.util.LogEvent.getPayLoad()\" because \"ev\" is null", ex.getMessage(), "ex.getMessage()"); } } }
public LogEvent log (LogEvent ev) { synchronized (ev.getPayLoad()) { final List<Object> payLoad = ev.getPayLoad(); int size = payLoad.size(); for (int i=0; i<size; i++) { Object obj = payLoad.get (i); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) ((ISOMsg) obj).clone(); try { checkProtected (m); checkHidden (m); } catch (ISOException e) { ev.addMessage (e); } payLoad.set (i, m); } else if (obj instanceof SimpleMsg){ try { checkProtected((SimpleMsg) obj); } catch (ISOException e) { ev.addMessage (e); } } } } return ev; }
ProtectedLogListener implements LogListener, Configurable { public LogEvent log (LogEvent ev) { synchronized (ev.getPayLoad()) { final List<Object> payLoad = ev.getPayLoad(); int size = payLoad.size(); for (int i=0; i<size; i++) { Object obj = payLoad.get (i); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) ((ISOMsg) obj).clone(); try { checkProtected (m); checkHidden (m); } catch (ISOException e) { ev.addMessage (e); } payLoad.set (i, m); } else if (obj instanceof SimpleMsg){ try { checkProtected((SimpleMsg) obj); } catch (ISOException e) { ev.addMessage (e); } } } } return ev; } }
ProtectedLogListener implements LogListener, Configurable { public LogEvent log (LogEvent ev) { synchronized (ev.getPayLoad()) { final List<Object> payLoad = ev.getPayLoad(); int size = payLoad.size(); for (int i=0; i<size; i++) { Object obj = payLoad.get (i); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) ((ISOMsg) obj).clone(); try { checkProtected (m); checkHidden (m); } catch (ISOException e) { ev.addMessage (e); } payLoad.set (i, m); } else if (obj instanceof SimpleMsg){ try { checkProtected((SimpleMsg) obj); } catch (ISOException e) { ev.addMessage (e); } } } } return ev; } ProtectedLogListener(); }
ProtectedLogListener implements LogListener, Configurable { public LogEvent log (LogEvent ev) { synchronized (ev.getPayLoad()) { final List<Object> payLoad = ev.getPayLoad(); int size = payLoad.size(); for (int i=0; i<size; i++) { Object obj = payLoad.get (i); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) ((ISOMsg) obj).clone(); try { checkProtected (m); checkHidden (m); } catch (ISOException e) { ev.addMessage (e); } payLoad.set (i, m); } else if (obj instanceof SimpleMsg){ try { checkProtected((SimpleMsg) obj); } catch (ISOException e) { ev.addMessage (e); } } } } return ev; } ProtectedLogListener(); void setConfiguration(Configuration cfg); LogEvent log(LogEvent ev); }
ProtectedLogListener implements LogListener, Configurable { public LogEvent log (LogEvent ev) { synchronized (ev.getPayLoad()) { final List<Object> payLoad = ev.getPayLoad(); int size = payLoad.size(); for (int i=0; i<size; i++) { Object obj = payLoad.get (i); if (obj instanceof ISOMsg) { ISOMsg m = (ISOMsg) ((ISOMsg) obj).clone(); try { checkProtected (m); checkHidden (m); } catch (ISOException e) { ev.addMessage (e); } payLoad.set (i, m); } else if (obj instanceof SimpleMsg){ try { checkProtected((SimpleMsg) obj); } catch (ISOException e) { ev.addMessage (e); } } } } return ev; } ProtectedLogListener(); void setConfiguration(Configuration cfg); LogEvent log(LogEvent ev); static final String WIPED; static final byte[] BINARY_WIPED; }