summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2019-07-02 17:25:31 +0100
committerTobias Thierer <tobiast@google.com>2019-07-08 19:11:11 +0100
commitcf9e9b31cad7aaad89dfdbaf38d10e946feb4858 (patch)
tree736730fe7fd841ae6795ca33fb680ab2328528dd /annotations/generate_annotated_java_files.py
parent2e156c0e84abcaea3744f89ad4489002387498f1 (diff)
Fix DefaultFileNameMap behavior for URL cases involving a fragment.
DefaultFileNameMap searched for occurrences of each of '/', '.', '#' in the full string given rather than only the portions remaining after cutting off ignored parts (e.g., '/' or '.' that occurred as part of the fragment). The logic did check for a '.' that occurred before the last '/' but it didn't check for a '.' that occurred after '#'. Further, the logic checked for the last occurrence of '#'. It appears that RFC 3986 only allows a single '#' in a URI and java.net.URL does indeed throw URISyntaxException when more than one is present; however, android.net.Uri accepts multiple '#' and considers the fragment to start after the first one; therefore, this CL also changes the logic to cut off the fragment part at the first, rather than last, occurrence of '#'. Further, the logic recognized directories (ending in '/'), but only for URLs that did not include a fragment (it would have returned null rather than "text/html" for such URLs). This CL fixes all of the above by splitting off parts of the URL in priority order, using substring(). This might have a very minor performance hit because character data might be copied multiple times, but is easier to follow. This CL also expands test coverage to cover some cases that would previously have failed. Fixes: 37035456 Test: atest CtsLibcoreTestCases:libcore.java.net.URLConnectionTest Change-Id: I26fbecc4e1da0cf1065ea8a4fa43920035d97a1c
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions