Revision 9916da4a
Added by Andreas Müller about 2 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java | ||
---|---|---|
97 | 97 |
protected URI getParsedText() throws Exception { |
98 | 98 |
String uriText = super.getText(); |
99 | 99 |
if(uriText!=null){ |
100 |
try{ |
|
101 |
return new URI(super.getText()); |
|
102 |
}catch(Exception e){ |
|
103 |
URL url = new URL(uriText); |
|
104 |
String[] pathElements = url.getPath().split("/"); |
|
105 |
|
|
106 |
for (String element: pathElements){ |
|
107 |
String replacement = UrlUtf8Coder.encode(element); |
|
108 |
uriText = uriText.replace(element, replacement); |
|
109 |
} |
|
110 |
if (url.getQuery() != null){ |
|
111 |
uriText = uriText.replace(url.getQuery(), UrlUtf8Coder.encode(url.getQuery())); |
|
112 |
} |
|
113 |
url = new URL(uriText); |
|
114 |
return URI.fromUrl(url); |
|
115 |
} |
|
100 |
return new URI(super.getText()); |
|
101 |
}else{ |
|
102 |
return null; |
|
116 | 103 |
} |
117 |
return null; |
|
118 | 104 |
} |
119 | 105 |
} |
Also available in: Unified diff
ref #9111, ref #9114 remove TaxEditor specific URI encoding code as encoding is handled in cdmlib now