@Test public void testProcess2() throws Throwable { BSHRequestListener bSHRequestListener = new BSHRequestListener(); ISOMsg m = new ISOMsg(); m.setMTI("testBSHRequestListenerMti"); boolean result = bSHRequestListener.process(new LogChannel(), m); assertFalse(result, "result"); assertNull(bSHRequestListener.whitelist, "bSHRequestListener.whitelist"); }
public boolean process (ISOSource source, ISOMsg m) { try{ String mti = m.getMTI (); if (!whitelist.contains(mti) && !whitelist.contains("*")) mti = "unsupported"; for (String aBshSource : bshSource) { try { Interpreter bsh = new Interpreter(); bsh.set("source", source); bsh.set("message", m); bsh.set("log", this); bsh.set("cfg", cfg); int idx = aBshSource.indexOf(MTI_MACRO); String script; if (idx >= 0) { script = aBshSource.substring(0, idx) + mti + aBshSource.substring(idx + MTI_MACRO.length()); } else { script = aBshSource; } Object ret= bsh.source(script); if (ret != null && (!(ret instanceof Boolean) || (Boolean)ret)) { return true; } } catch (Exception e) { warn(e); } } }catch (Exception e){ warn(e); return false; } return false; }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public boolean process (ISOSource source, ISOMsg m) { try{ String mti = m.getMTI (); if (!whitelist.contains(mti) && !whitelist.contains("*")) mti = "unsupported"; for (String aBshSource : bshSource) { try { Interpreter bsh = new Interpreter(); bsh.set("source", source); bsh.set("message", m); bsh.set("log", this); bsh.set("cfg", cfg); int idx = aBshSource.indexOf(MTI_MACRO); String script; if (idx >= 0) { script = aBshSource.substring(0, idx) + mti + aBshSource.substring(idx + MTI_MACRO.length()); } else { script = aBshSource; } Object ret= bsh.source(script); if (ret != null && (!(ret instanceof Boolean) || (Boolean)ret)) { return true; } } catch (Exception e) { warn(e); } } }catch (Exception e){ warn(e); return false; } return false; } }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public boolean process (ISOSource source, ISOMsg m) { try{ String mti = m.getMTI (); if (!whitelist.contains(mti) && !whitelist.contains("*")) mti = "unsupported"; for (String aBshSource : bshSource) { try { Interpreter bsh = new Interpreter(); bsh.set("source", source); bsh.set("message", m); bsh.set("log", this); bsh.set("cfg", cfg); int idx = aBshSource.indexOf(MTI_MACRO); String script; if (idx >= 0) { script = aBshSource.substring(0, idx) + mti + aBshSource.substring(idx + MTI_MACRO.length()); } else { script = aBshSource; } Object ret= bsh.source(script); if (ret != null && (!(ret instanceof Boolean) || (Boolean)ret)) { return true; } } catch (Exception e) { warn(e); } } }catch (Exception e){ warn(e); return false; } return false; } BSHRequestListener(); }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public boolean process (ISOSource source, ISOMsg m) { try{ String mti = m.getMTI (); if (!whitelist.contains(mti) && !whitelist.contains("*")) mti = "unsupported"; for (String aBshSource : bshSource) { try { Interpreter bsh = new Interpreter(); bsh.set("source", source); bsh.set("message", m); bsh.set("log", this); bsh.set("cfg", cfg); int idx = aBshSource.indexOf(MTI_MACRO); String script; if (idx >= 0) { script = aBshSource.substring(0, idx) + mti + aBshSource.substring(idx + MTI_MACRO.length()); } else { script = aBshSource; } Object ret= bsh.source(script); if (ret != null && (!(ret instanceof Boolean) || (Boolean)ret)) { return true; } } catch (Exception e) { warn(e); } } }catch (Exception e){ warn(e); return false; } return false; } BSHRequestListener(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m); }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public boolean process (ISOSource source, ISOMsg m) { try{ String mti = m.getMTI (); if (!whitelist.contains(mti) && !whitelist.contains("*")) mti = "unsupported"; for (String aBshSource : bshSource) { try { Interpreter bsh = new Interpreter(); bsh.set("source", source); bsh.set("message", m); bsh.set("log", this); bsh.set("cfg", cfg); int idx = aBshSource.indexOf(MTI_MACRO); String script; if (idx >= 0) { script = aBshSource.substring(0, idx) + mti + aBshSource.substring(idx + MTI_MACRO.length()); } else { script = aBshSource; } Object ret= bsh.source(script); if (ret != null && (!(ret instanceof Boolean) || (Boolean)ret)) { return true; } } catch (Exception e) { warn(e); } } }catch (Exception e){ warn(e); return false; } return false; } BSHRequestListener(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m);  }