private void ensureParams ( ) { if ( this . isDirty ) { // note, it would only be dirty if we actually have inserted a value // so therefore no need to check that the parammap is null final Buffer restOfParams = this . params ; this . params = allcoateNewParamBuffer ( ) ; for ( final Map . Entry < Buffer , Buffer > entry : this . paramMap . entrySet ( ) ) { this . params . write ( SipParser . SEMI ) ; final Buffer key = entry . getKey ( ) ; final Buffer value = entry . getValue ( ) ; key . getBytes ( 0 , this . params ) ; if ( value != null && ! value . isEmpty ( ) ) { this . params . write ( SipParser . EQ ) ; value . getBytes ( 0 , this . params ) ; } } this . paramMap . clear ( ) ; restOfParams . getBytes ( this . params ) ; this . originalParams = this . params . slice ( ) ; this . isDirty = false ; } }
Make sure that the internal params buffer is actually valid etc .