Enforce that a MimeMap's MIME types contain a '/' but extensions don't.
This guards against some kinds of programming errors in building
MimeMaps directly via MimeMap.Builder or indirectly through the
contents of the *mime.types data files:
- Specifying a MIME type where an extension is expected, or
vice versa.
- Specifying a path where only a file extension is expected.
No such enforcement is done during lookups - specifying an
inappropriate key will just result in no result being found.
Stronger requirements (e.g. a MIME type should contain _exactly_
one '/' and it should not occur at either end, and an extension
should not start with a '.') that could catch additional errors
are possible, but beyond the scope of this CL.
Bug: 122831291
Bug: 139895945
Test: atest CtsMimeMapTestCases
Test: atest CtsLibcoreTestCases:libcore.libcore.net.MimeMapTest
Change-Id: Ida961de1dbe2a8ae23097f95b3638e7e0e3500d6
2 files changed