RF-12224: make the file quantity checking thread-safe
RF-12224: support case of empty extension

as discussed in
https://github.com/richfaces4/components/pull/78#pullrequestreviewcomment-5058926