Thanks for the report. Unfortunately, you did not provide enough
information to reproduce this - for example, what platform are you
running on? Can you narrow it down to a single file of say 5 or so
lines? Can you reproduce the problem with shorter input lines?
My guess, although I need more info to confirm it, is that this is not a
bug, but rather that java-source-list contains some lines that differ in
case and/or punctuation but happen to collate identically. If so, then
sort -u is picking the lower-case version as the unique line, at which
point your grep for the case-sensitive X509Certificate is obviously failing.
The fact that you already proved that LC_ALL=C changes the behavior
lends credence to my supposition, since C is byte-sensitive, but most
other languages collate case-insensitively. See also the FAQ: