private static void validateCreation ( String method , SipApplicationSession app ) { if ( method . equals ( Request . ACK ) ) { throw new IllegalArgumentException ( "Wrong method to create request with[" + Request . ACK + "]!" ) ; } if ( method . equals ( Request . PRACK ) ) { throw new IllegalArgumentException ( "Wrong method to create request with[" + Request . PRACK + "]!" ) ; } if ( method . equals ( Request . CANCEL ) ) { throw new IllegalArgumentException ( "Wrong method to create request with[" + Request . CANCEL + "]!" ) ; } if ( ! ( ( MobicentsSipApplicationSession ) app ) . isValidInternal ( ) ) { throw new IllegalArgumentException ( "Cant associate request with invalidaded sip session application!" ) ; } }
Does basic check for illegal methods wrong state if it finds it throws exception