Fix ResourceHttpMessageConverter to not throw NullPointerException

for Resource implementation in which getFilename() returns null

ResourceHttpMessageConverter tries to use the filename to determine the
media type, but for Resource implementations such as ByteArrayResource
it is null, which causes NullPointerException. The fix checks whether
getFilename returns null before attempting to determine the media type
by it.

The problem was originally reported in Spring Social Google in an
attempt to use ByteArrayResource in the method that uploads
to Google Drive.

Issue: SPR-10848