Nitpicking the code

Minor changes here and there to remove warnings and make code cleaner and more uniform.
Let's just return null here. I could also see an argument for throwing a checked exception here and when cacheDir is null, but we should be consistent and we should let callers handle the failure themselves. On devices with low storage, this is expected behavior.