in dubbo-admin-server/src/main/java/org/apache/dubbo/admin/common/util/ParseUtils.java [230:270]
public static Map<String, String> parseQuery(String keyPrefix, String query) {
if (query == null)
return new HashMap<String, String>();
if (keyPrefix == null)
keyPrefix = "";
Matcher matcher = QUERY_PATTERN.matcher(query);
Map<String, String> routeQuery = new HashMap<String, String>();
String key = null;
while (matcher.find()) { // Match one by one
String separator = matcher.group(1);
String content = matcher.group(2);
if (separator == null || separator.length() == 0
|| "&".equals(separator)) {
if (key != null)
throw new IllegalStateException("Illegal query string \""
+ query + "\", The error char '" + separator
+ "' at index " + matcher.start() + " before \""
+ content + "\".");
key = content;
} else if ("=".equals(separator)) {
if (key == null)
throw new IllegalStateException("Illegal query string \""
+ query + "\", The error char '" + separator
+ "' at index " + matcher.start() + " before \""
+ content + "\".");
routeQuery.put(keyPrefix + key, content);
key = null;
} else {
if (key == null)
throw new IllegalStateException("Illegal query string \""
+ query + "\", The error char '" + separator
+ "' at index " + matcher.start() + " before \""
+ content + "\".");
}
}
/*if (key != null)
throw new IllegalStateException("Illegal route rule \"" + query
+ "\", The error in the end char: " + key);*/
return routeQuery;
}