fixed data path quoting in array issue

This commit is contained in:
Ziver Koc 2023-08-22 20:27:30 +02:00
parent a2694af70f
commit 5fd11daf15

View file

@ -69,10 +69,11 @@ public class DataNodePath {
} else if (operator == '.') { } else if (operator == '.') {
pathList.add(new NamedChildPathEntity(buffer.toString())); pathList.add(new NamedChildPathEntity(buffer.toString()));
} else if (operator == '[') { } else if (operator == '[') {
if (buffer.charAt(0) == '\'' && buffer.charAt(buffer.length()-1) == '\'') String str = buffer.toString();
pathList.add(new NamedChildPathEntity(StringUtil.trim(buffer.toString(), '\''))); if (StringUtil.isNumber(str))
pathList.add(new IndexChildPathEntity(Integer.parseInt(str)));
else else
pathList.add(new IndexChildPathEntity(Integer.parseInt(buffer.toString()))); pathList.add(new NamedChildPathEntity(str));
} }
buffer.delete(0, buffer.length()); buffer.delete(0, buffer.length());