I'm still not wild about caching the result since again, (a) the value is never discarded, so it's not a cache and (b) backing systems could choose to change this value on a subsequent call. However, both FileSystem and DistributedFileSystem are doing some questionable things with this API, so I'll worry about those issues later, if we run into them.
+1 on current patch. Failed tests are spurious. Attaching a version for 2.7 (same except location of JsonUtils). Will commit both after Jenkins has a pass over backport.