- throw new SourceException(ctx.getStatementSourceReference(), e,
- "Failed to parse node '%s' in path '%s'", nodeName, path);
- }
- }
-
- return SchemaNodeIdentifier.create(qNames, PATH_ABS.matcher(path).matches());
- }
-
- /**
- * Cleanup any resources attached to the current thread. Threads interacting with this class can cause thread-local
- * caches to them. Invoke this method if you want to detach those resources.
- */
- public static void detachFromCurrentThread() {
- XPATH_FACTORY.remove();
- }
-
- private static String addPrefixToYangXPathFunctions(final String path, final StmtContext<?, ?, ?> ctx) {
- if (ctx.getRootVersion() == YangVersion.VERSION_1_1) {
- // FIXME once Java 9 is available, change this to StringBuilder as Matcher.appendReplacement() and
- // Matcher.appendTail() will accept StringBuilder parameter in Java 9
- final StringBuffer result = new StringBuffer();
- final String prefix = YANG_XPATH_FUNCTIONS_PREFIX + ":";
- final Matcher matcher = YANG_XPATH_FUNCTIONS_PATTERN.matcher(path);
- while (matcher.find()) {
- matcher.appendReplacement(result, prefix + matcher.group());
+ throw new SourceException(ctx, e, "Failed to parse node '%s' in path '%s'", nodeName, path);