Fix various exceptions causing ISEs on GET /rhn/common/DownloadFile.do

This patch fixes various exceptions that are otherwise causing ISEs when receiving requests to `/rhn/common/DownloadFile.do` (which can happen with e.g. Qualys security scanners).