protected void validateAttributePresentity ( ) throws IllegalStateException { if ( ! rfc3489CompatibilityMode ) { return ; } for ( char i = StunAttribute . MAPPED_ADDRESS ; i < StunAttribute . REFLECTED_FROM ; i ++ ) { if ( getAttributePresentity ( i ) == M && getAttribute ( i ) == null ) { throw new IllegalStateException ( "A mandatory attribute (type=" + ( int ) i + ") is missing!" ) ; } } }
Verify that the message has all obligatory attributes and throw an exception if this is not the case .