Encode entry name before creating URL

During retrieving a resource from the class path a URL is
constructed from the resource name. If the resource name
contains characters that are special in the file part of a URL,
e.g. # or ? then they need to be encoded (e.g. into %23 and %3f
respectively) before passing to the URL in order to ensure that
the name survives intact through to the JarURLConnection which
decodes the URL to extract the file part which it uses to scan
the JAR.

This ensures that the entry/resource name is encoded properly
and adds tests to verify that for resources whose names contain
either # or ?.

Bug: 26137833
Change-Id: I8f31c35e42c0070a0ee78e0cd58b67ebd001fffe
3 files changed