There is an existing Credentials#addAll which combines two Credentials, but it overwrites all existing Credentials. There should be a Credentials#mergeAll that will not overwrite. This will facility the cleanup of code in TokenCache denoted with:
The token cache basically needs to merge the contents of a binary credentials file when it fails to find a token. Performing the merge within Credentials is cleaner, and will break the cross-component dependency whereby the TokenCache currently has to have intimate knowledge of how the FileSystem will key tokens in the cache.