in tablestore/src/main/java/com/alicloud/openservices/tablestore/core/protocol/timeseries/TimeseriesResponseFactory.java [65:100]
public static SortedMap<String, String> parseTagsOrAttrs(String tagsStr) {
SortedMap<String, String> tags = new TreeMap<String, String>();
if (tagsStr.isEmpty()) {
return tags;
}
if (tagsStr.length() < 2 || tagsStr.charAt(0) != '[' || tagsStr.charAt(tagsStr.length() - 1) != ']') {
throw new ClientException("invalid tags or attributes string: " + tagsStr);
}
int keyStart = -1;
int valueStart = -1;
for (int i = 1; i < tagsStr.length() - 1; i++) {
if (tagsStr.charAt(i) != '"') {
throw new ClientException("invalid tags or attributes string: " + tagsStr);
}
keyStart = ++i;
while ((i < tagsStr.length() - 1) && (tagsStr.charAt(i) != '=') && (tagsStr.charAt(i) != '"')) {
i++;
}
if (tagsStr.charAt(i) != '=') {
throw new ClientException("invalid tags or attributes string: " + tagsStr);
}
valueStart = ++i;
while ((i < tagsStr.length() - 1) && (tagsStr.charAt(i) != '"')) {
i++;
}
if (tagsStr.charAt(i) != '"') {
throw new ClientException("invalid tags or attributes string: " + tagsStr);
}
tags.put(tagsStr.substring(keyStart, valueStart - 1), tagsStr.substring(valueStart, i));
i += 1;
if ((i < tagsStr.length() - 1) && (tagsStr.charAt(i) != ',')) {
throw new ClientException("invalid tags or attributes string: " + tagsStr);
}
}
return tags;
}