Project

Profile

Help

Bug #5637

closed

More detailed message for regular expression error

Added by Octavian Nadolu over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2022-08-08
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

If validate the following XSL with Saxon 11.4 I get an error message:

"Error in regular expression: Incorrect syntax for Java regular expression".

I expect to have also the reason of the regexp error in the message. Something like this:

"Error in regular expression: Incorrect syntax for Java regular expression: Unclosed group near index 7 ((.+)"

Maybe you can modify the " throw XPathException" from JavaRegularExpression class something like this:

throw new XPathException("Incorrect syntax for Java regular expression: " + e.getMessage(), e);

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">
    <xsl:template match="/">
        <xsl:analyze-string select="." regex=" ((\.+)" flags=";j">
            <xsl:matching-substring/>
        </xsl:analyze-string>
    </xsl:template>
</xsl:stylesheet>

Please register to edit this issue

Also available in: Atom PDF