if (r.getCode() == Command.ERROR) {
if (!((Boolean) r.getParamAt(0)).booleanValue()) {
// Unexpected exception thrown in the remote site
String msg = new String("Exception "+(String) r.getParamAt(1)+" occurred in remote site processing command "+c.getCode()+". "+(String) r.getParamAt(2));
logger.log(Logger.SEVERE,msg);
throw new IMTPException(msg);
}
else if (((String) r.getParamAt(1)).equals("jade.core.IMTPException")) {
throw new IMTPException((String) r.getParamAt(2));
}
}
return r;
}
catch (ICPException icpe) {
// The destination is unreachable.
if (timeout == 0) {
// The command can't be postponed
throw new IMTPException("Destination unreachable", icpe);
}
else {
logger.log(Logger.WARNING, "Dispatch failed. Command postponed. "+icpe.getMessage());
// FIXME: if timeout > 0 we should add a timer
postpone(c);
return null;
}
}
catch (LEAPSerializationException lse) {
throw new IMTPException("Serialization error", lse);
}
finally {
enableFlush();
}
}