use of org.jpos.iso.ISOFilter.VetoException in project jPOS by jpos.
the class BaseChannel method send.
/**
* sends an ISOMsg over the TCP/IP session
* @param m the Message to be sent
* @exception IOException
* @exception ISOException
* @exception ISOFilter.VetoException;
*/
public void send(ISOMsg m) throws IOException, ISOException {
LogEvent evt = new LogEvent(this, "send");
try {
if (!isConnected())
throw new IOException("unconnected ISOChannel");
m.setDirection(ISOMsg.OUTGOING);
ISOPackager p = getDynamicPackager(m);
m.setPackager(p);
m = applyOutgoingFilters(m, evt);
evt.addMessage(m);
// filter may have dropped this info
m.setDirection(ISOMsg.OUTGOING);
// and could have dropped packager as well
m.setPackager(p);
byte[] b = pack(m);
synchronized (serverOutLock) {
sendMessageLength(b.length + getHeaderLength(m));
sendMessageHeader(m, b.length);
sendMessage(b, 0, b.length);
sendMessageTrailer(m, b);
serverOut.flush();
}
cnt[TX]++;
setChanged();
notifyObservers(m);
} catch (VetoException e) {
// if a filter vets the message it was not added to the event
evt.addMessage(m);
evt.addMessage(e);
throw e;
} catch (ISOException e) {
evt.addMessage(e);
throw e;
} catch (IOException e) {
evt.addMessage(e);
throw e;
} catch (Exception e) {
evt.addMessage(e);
throw new IOException("unexpected exception", e);
} finally {
Logger.log(evt);
}
}
Aggregations