Skip to content

Commit

Permalink
CLDR-17504 update SupplementalDataInfo reader to not use reentrant XP…
Browse files Browse the repository at this point in the history
…athParts

- push XPathParts.size() API up to XPathValue.size()
- use SimpleXPathParts instead of XPathParts in SupplementalDataInfo
  • Loading branch information
srl295 committed Apr 12, 2024
1 parent dd2c30f commit 7e38630
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ protected void handleAddAttribute(String attribute, String value) {
static SimpleXPathParts getFrozenInstance(String xpath) {
return new SimpleXPathParts(xpath);
}

@Override
public int size() {
return elements.size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ public void cleanup() {
@Override
public void handlePathValue(String path, String value) {
try {
XPathParts parts = XPathParts.getFrozenInstance(path);
XPathValue parts = SimpleXPathParts.getFrozenInstance(path);
String level0 = parts.getElement(0);
String level1 = parts.size() < 2 ? null : parts.getElement(1);
String level2 = parts.size() < 3 ? null : parts.getElement(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public boolean containsAttributeValue(String attribute, String value) {
return false;
}

/** How many elements are in this xpath? */
@Override
public int size() {
return elements.size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ public interface XPathValue {
* Returns null if there's nothing.
*/
String getAttributeValue(int i, String string);

/** How many elements are in this xpath? */
int size();
}

0 comments on commit 7e38630

Please sign in to comment.