Cleanup exception handling after implementing multiple directory retries

Cleanup exception handling after implementing multiple directory retries
Throw a RuntimeException if we fail to retrieve the path after MAX_TRIES (10), first using directory caches, then falling back to authorities.

Tidy:
- Exception propagation
- Unused imports, variables, casts, boxing
- Javadoc issues
- Redundant template parameters
- Array sizes
- Poor autogenerated code
(Credit to jlint for picking up most of these issues)