Project

Profile

Help

Bug #2181

closed

Try/catch within a loop gives wrong output

Added by Michael Kay about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XQuery conformance
Sprint/Milestone:
Start date:
2014-10-13
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

Description

Gunther Rademacher reports on saxon:help

Additionally, I have observed a strange result from this one:

try {parse-xml("p1")} catch * {$err:code},

try {parse-xml("p2")} catch * {$err:code},

for $p in ("p1", "p2") return

try {parse-xml($p)} catch * {$err:code}

It returns just two error codes

err:FODC0006 err:FODC0006

though the console log indicates four failures:

Error on line 1 column 1

SXXP0003: Error reported by XML parser: Content is not allowed in prolog.

Error on line 1 column 1

SXXP0003: Error reported by XML parser: Content is not allowed in prolog.

Error on line 1 column 1

SXXP0003: Error reported by XML parser: Content is not allowed in prolog.

Error on line 1 column 1

SXXP0003: Error reported by XML parser: Content is not allowed in prolog.

Actions #1

Updated by Michael Kay about 10 years ago

Added QT3 test case try-catch-err-code-variable-14.

What's happening here is that the reference to $err:code is being turned into an internal function call, and the internal function call is then being loop-lifted out of the "for" loop as it's not recognized as having a dependency on the range variables of the loop expression.

Actions #2

Updated by Michael Kay about 10 years ago

  • Subject changed from Incorrect try/catch output to Try/catch within a loop gives wrong output
Actions #3

Updated by Michael Kay about 10 years ago

  • Status changed from New to Resolved
  • Found in version set to 9.6

Patch produced for 9.7, 9.6 and 9.5 branches: the DynamicErrorInfo is marked as having side-effects, to prevent it being loop-lifted out of its try/catch scope.

Actions #4

Updated by O'Neil Delpratt about 10 years ago

Bug fix applied to the Saxon maintenance release 9.5.1.8

Saxon 9.6 pending

Actions #5

Updated by O'Neil Delpratt about 10 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.2

Bug fix applied to the maintenance release Saxon 9.6.0.2

Actions #6

Updated by O'Neil Delpratt almost 9 years ago

  • Sprint/Milestone set to 9.6.0.2
  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.2 added

Please register to edit this issue

Also available in: Atom PDF