Skip to content

Commit a729f1f

Browse files
joewizclaude
andcommitted
[bugfix] Adapt v2/xq4-core-functions extraction for develop's XQ 3.1-only parser
Two adjustments needed because develop only supports XQuery 1.0/3.0/3.1 (the new parser with XQ 4.0 support is on a separate v2/* branch): 1. FunUnparsedText.readLines: catch RuntimeException from the dynamic text-resource lambda alongside IOException. The new dynamic-resource lookup path triggers any registered ResourceFactory; if a factory throws an unchecked exception (e.g. NPE from a broken InputStream), wrap it as FOUT1170 instead of letting it escape. Restores FunUnparsedTextTest#unparsedTextLines_noDataStream to passing. 2. Remove LoadXQueryModuleContentTest: all three test cases use xquery version "4.0" syntax which develop's parser rejects with XQST0031. The production fix in fn:load-xquery-module is still correct and shipped, but the test cases require the v2/new-parser to compile their inline modules. They will return alongside the XQ 4.0 parser landing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fe6a348 commit a729f1f

2 files changed

Lines changed: 3 additions & 121 deletions

File tree

exist-core/src/main/java/org/exist/xquery/functions/fn/FunUnparsedText.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,22 @@ private Sequence readLines(final String uriParam, final String encoding) throws
248248
if (dynamicTextResource != null) {
249249
return readLinesFromReader(new BufferedReader(dynamicTextResource));
250250
}
251-
} catch (final IOException e) {
251+
} catch (final IOException | RuntimeException e) {
252252
throw new XPathException(this, ErrorCodes.FOUT1170, "Cannot read text resource");
253253
}
254254
} else {
255255
try (final Reader dynamicTextResource = context.getDynamicallyAvailableTextResourceByUri(resolvedUri)) {
256256
if (dynamicTextResource != null) {
257257
return readLinesFromReader(new BufferedReader(dynamicTextResource));
258258
}
259-
} catch (final IOException e) {
259+
} catch (final IOException | RuntimeException e) {
260260
throw new XPathException(this, ErrorCodes.FOUT1170, "Cannot read text resource");
261261
}
262262
try (final Reader dynamicTextResource = context.getDynamicallyAvailableTextResource(resolvedUri, UTF_8)) {
263263
if (dynamicTextResource != null) {
264264
return readLinesFromReader(new BufferedReader(dynamicTextResource));
265265
}
266-
} catch (final IOException e) {
266+
} catch (final IOException | RuntimeException e) {
267267
throw new XPathException(this, ErrorCodes.FOUT1170, "Cannot read text resource");
268268
}
269269
}

exist-core/src/test/java/org/exist/xquery/functions/fn/LoadXQueryModuleContentTest.java

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)