Open JordanTerri opened 3 years ago
I'll check it out
It looks like AcceptLanguageParser.parse
creates an AcceptLanguageList
containing two empty AcceptLanguage
objects (i.e. with languageRange == null
) from this string:
Accept-Language: ,\n
Then the test converts that back to a string using ((SIPHeader) hdr.clone()).encode().trim() + "\n"
and gets this different string:
Accept-Language:\n
This is then parsed to get an AcceptLanguageList
containing one empty AcceptLanguage
object, which does not match the first AcceptLanguageList
which had two of them.
I believe that empty languages should not be added to the accept list:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#14.4
language-range = (1*8ALPHA *("-" 1*8alphanum)) / "*"
So, a language-range cannot be an empty string, it must contain an alphabetical character or be *
.
The fix then would be for AcceptLanguageParser
to ignore empty language ranges, and ParserTestCase.testParser
not to expect that "List should contain at least 1 header".
The test doesn't pass when executed.