|
37 | 37 | import java.io.IOException; |
38 | 38 | import java.io.InputStream; |
39 | 39 | import java.io.OutputStream; |
| 40 | +import java.io.UnsupportedEncodingException; |
| 41 | + |
40 | 42 | import java.net.HttpURLConnection; |
41 | 43 | import java.net.URL; |
42 | 44 | import java.net.URLConnection; |
| 45 | +import java.net.URLEncoder; |
43 | 46 | import java.nio.charset.StandardCharsets; |
44 | 47 | import java.security.cert.X509Certificate; |
45 | 48 | import java.util.ArrayList; |
@@ -311,7 +314,7 @@ public Set<ObjectName> getCacheMembers(String sServiceName, String sCacheName, S |
311 | 314 | { |
312 | 315 | URLBuilder urlBuilder = getBasePath().addPathSegment(SERVICES) |
313 | 316 | .addPathSegment(encodeServiceName(sServiceName)).addPathSegment(CACHES) |
314 | | - .addPathSegment(sCacheName).addPathSegment(MEMBERS); |
| 317 | + .addPathSegment(encodeCacheName(sCacheName)).addPathSegment(MEMBERS); |
315 | 318 | if (sDomainPartition != null) |
316 | 319 | { |
317 | 320 | urlBuilder.addQueryParameter("domainPartition", sDomainPartition); |
@@ -986,7 +989,7 @@ public JsonNode getDataForStorageManagerMembers(String sServiceName, String sDom |
986 | 989 | throws Exception |
987 | 990 | { |
988 | 991 | URLBuilder urlBuilder = getBasePath().addPathSegment(SERVICES) |
989 | | - .addPathSegment(encodeServiceName(sServiceName)).addPathSegment(CACHES).addPathSegment(sCacheName) |
| 992 | + .addPathSegment(encodeServiceName(sServiceName)).addPathSegment(CACHES).addPathSegment(encodeCacheName(sCacheName)) |
990 | 993 | .addPathSegment(MEMBERS).addQueryParameter(FIELDS, |
991 | 994 | "nodeId,locksGranted,locksPending,listenerRegistrations,maxQueryDurationMillis,maxQueryDescription," + |
992 | 995 | "nonOptimizedQueryAverageMillis,optimizedQueryAverageMillis,indexTotalUnits,indexingTotalMillis," + |
@@ -1016,7 +1019,7 @@ public JsonNode getDataForCacheMembers(String sServiceName, String sCacheName, S |
1016 | 1019 | throws Exception |
1017 | 1020 | { |
1018 | 1021 | URLBuilder urlBuilder = getBasePath().addPathSegment(SERVICES) |
1019 | | - .addPathSegment(encodeServiceName(sServiceName)).addPathSegment(CACHES).addPathSegment(sCacheName) |
| 1022 | + .addPathSegment(encodeServiceName(sServiceName)).addPathSegment(CACHES).addPathSegment(encodeCacheName(sCacheName)) |
1020 | 1023 | .addPathSegment(MEMBERS); |
1021 | 1024 | if (sDomainPartition != null) |
1022 | 1025 | { |
@@ -1817,6 +1820,24 @@ private String encodeServiceName(String sServiceName) |
1817 | 1820 | return sServiceName.replaceAll("\"", ""); |
1818 | 1821 | } |
1819 | 1822 |
|
| 1823 | + /** |
| 1824 | + * Encode a cache name. |
| 1825 | + * |
| 1826 | + * @param sCacheName service name to encode |
| 1827 | + * @return encoded cache name |
| 1828 | + */ |
| 1829 | + private String encodeCacheName(String sCacheName) |
| 1830 | + { |
| 1831 | + try |
| 1832 | + { |
| 1833 | + return URLEncoder.encode(sCacheName, "UTF8"); |
| 1834 | + } |
| 1835 | + catch (UnsupportedEncodingException e) |
| 1836 | + { |
| 1837 | + return sCacheName; |
| 1838 | + } |
| 1839 | + } |
| 1840 | + |
1820 | 1841 | /** |
1821 | 1842 | * Internal class to build a URL. |
1822 | 1843 | */ |
|
0 commit comments