@Test public void testFilterThrowsVetoException1() throws Throwable { XSLTFilter xSLTFilter = new XSLTFilter(); try { xSLTFilter.filter(new PADChannel(new CTCSubFieldPackager()), null, new LogEvent("testXSLTFilterTag")); fail("Expected VetoException to be thrown"); } catch (ISOFilter.VetoException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertEquals("java.lang.NullPointerException", ex.getMessage(), "ex.getMessage()"); assertNull(ex.getNested().getMessage(), "ex.getNested().getMessage()"); } else { assertEquals("java.lang.NullPointerException: Cannot invoke \"org.jpos.iso.ISOMsg.setPackager(org.jpos.iso.ISOPackager)\" because \"m\" is null", ex.getMessage(), "ex.getMessage()"); assertEquals("Cannot invoke \"org.jpos.iso.ISOMsg.setPackager(org.jpos.iso.ISOPackager)\" because \"m\" is null", ex.getNested().getMessage(), "ex.getNested().getMessage()"); } assertNull(xSLTFilter.tfactory.getURIResolver(), "xSLTFilter.tfactory.getURIResolver()"); assertNull(xSLTFilter.transformer, "xSLTFilter.transformer"); } }
public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException { try { m.setPackager (packager); ByteArrayOutputStream os = new ByteArrayOutputStream(); if (reread || transformer == null) transformer = tfactory.newTransformer( new StreamSource(xsltfile) ); transformer.transform ( new StreamSource(new ByteArrayInputStream (m.pack())), new StreamResult(os) ); m.unpack (os.toByteArray()); } catch (Exception e) { throw new VetoException(e); } return m; }
XSLTFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException { try { m.setPackager (packager); ByteArrayOutputStream os = new ByteArrayOutputStream(); if (reread || transformer == null) transformer = tfactory.newTransformer( new StreamSource(xsltfile) ); transformer.transform ( new StreamSource(new ByteArrayInputStream (m.pack())), new StreamResult(os) ); m.unpack (os.toByteArray()); } catch (Exception e) { throw new VetoException(e); } return m; } }
XSLTFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException { try { m.setPackager (packager); ByteArrayOutputStream os = new ByteArrayOutputStream(); if (reread || transformer == null) transformer = tfactory.newTransformer( new StreamSource(xsltfile) ); transformer.transform ( new StreamSource(new ByteArrayInputStream (m.pack())), new StreamResult(os) ); m.unpack (os.toByteArray()); } catch (Exception e) { throw new VetoException(e); } return m; } XSLTFilter();  XSLTFilter(String xsltfile, boolean reread); }
XSLTFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException { try { m.setPackager (packager); ByteArrayOutputStream os = new ByteArrayOutputStream(); if (reread || transformer == null) transformer = tfactory.newTransformer( new StreamSource(xsltfile) ); transformer.transform ( new StreamSource(new ByteArrayInputStream (m.pack())), new StreamResult(os) ); m.unpack (os.toByteArray()); } catch (Exception e) { throw new VetoException(e); } return m; } XSLTFilter();  XSLTFilter(String xsltfile, boolean reread); void setConfiguration(Configuration cfg); ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt); }
XSLTFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) throws VetoException { try { m.setPackager (packager); ByteArrayOutputStream os = new ByteArrayOutputStream(); if (reread || transformer == null) transformer = tfactory.newTransformer( new StreamSource(xsltfile) ); transformer.transform ( new StreamSource(new ByteArrayInputStream (m.pack())), new StreamResult(os) ); m.unpack (os.toByteArray()); } catch (Exception e) { throw new VetoException(e); } return m; } XSLTFilter();  XSLTFilter(String xsltfile, boolean reread); void setConfiguration(Configuration cfg); ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt);  }