Revision a8dd847c
Added by Katja Luther over 2 years ago
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/URI.java | ||
---|---|---|
112 | 112 |
if (url.getQuery() != null){ |
113 | 113 |
encodedUri = encodedUri.replace(url.getQuery(), UrlUtf8Coder.encode(url.getQuery())); |
114 | 114 |
} |
115 |
String[] fragmentElements = uriString.split("#"); |
|
116 |
|
|
117 |
for (int i = 1; i < fragmentElements.length; ++i){ |
|
118 |
String fragmentElement = fragmentElements[i]; |
|
119 |
if(fragmentElement.contains("\\")){ |
|
120 |
//TODO needs discussion if backslash should be converted to slash instead, for now we keep it more strict |
|
121 |
throw new URISyntaxException(uriString, "URI path must not contain backslash ('\')"); |
|
122 |
} |
|
123 |
String replacement = UrlUtf8Coder.encode(fragmentElement); |
|
124 |
encodedUri = encodedUri.replace(fragmentElement, replacement); |
|
125 |
} |
|
126 |
|
|
127 |
|
|
115 | 128 |
url = new URL(encodedUri); |
116 | 129 |
|
117 | 130 |
javaUri = url.toURI(); |
Also available in: Unified diff
ref #9114: implement encoding of fragment part of uri