@Override public boolean sendMessage(IMessage message) throws TransportException, OverloadException, InternalException { if (dictionary != null && dictionary.isEnabled()) { logger.debug("Message validation is ENABLED. Going to validate message before sending."); dictionary.validate(message, false); } return !stopping && fsm.handleEvent(new FsmEvent(EventTypes.SEND_MSG_EVENT, message)); }
boolean incoming = event.getType() == EventTypes.RECEIVE_MSG_EVENT; ValidatorLevel incomingLevel = dictionary.getReceiveLevel(); if (incoming && dictionary != null && dictionary.isEnabled() && incomingLevel != ValidatorLevel.OFF) { logger.debug("Performing validation to INCOMING message since validator is ENABLED."); new Object[] { (dictionary != null && dictionary.isEnabled()), incoming, incomingLevel });
@Override public void validate(DiameterAvp avp) throws AvpNotAllowedException { Dictionary dictionary = DictionarySingleton.getDictionary(); if (dictionary.isConfigured() && dictionary.isEnabled()) { AvpRepresentation rep = dictionary.getAvp(avp.getCode(), avp.getVendorId()); // check for grouped? if (rep != null && rep.isGrouped()) { try { GroupedAvpImpl impl = (GroupedAvpImpl) avp; rep.validate(impl.getGenericData()); } catch (ClassCastException cce) { throw new AvpNotAllowedException("Failed to validate avp, its not grouped!", cce, avp.getCode(), avp.getVendorId()); } } } }
@Override public void validate(DiameterMessage msg) throws AvpNotAllowedException { Dictionary dictionary = DictionarySingleton.getDictionary(); if (dictionary.isConfigured() && dictionary.isEnabled()) { DiameterCommand com = msg.getCommand(); MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest()); if (rep != null) { DiameterMessageImpl impl = (DiameterMessageImpl) msg; try { rep.validate(impl.getGenericData(), ValidatorLevel.ALL); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId()); } } } }
if (!dictionary.isEnabled()) {
if (!dictionary.isEnabled()) {