Project

Profile

Help

Bug #2677

closed

Saxon/C PHP API getErrorMessage does not report useful error

Added by Philipp F over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Low
Category:
Saxon Internal
Start date:
2016-03-15
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
1.0.0
Fixed in version:
1.0.1
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

I am not sure if this is a bug, but if not it's a feature request :-)

When the XSLT compilation fails (for example on the XSL error I considered as bug here https://saxonica.plan.io/issues/2676) I don't get any useful information from getErrorMessage().

The code

$result = $saxon->transformToString();

if($result == NULL) {
    $errCount = $saxon->getExceptionCount();
    if($errCount > 0 ){
        for($i = 0; $i < $errCount; $i++) {
            $errCode = $saxon->getErrorCode(intval($i));
            $errMessage = $saxon->getErrorMessage(intval($i));
            echo 'Error: Code='.$errCode.' Message='.$errMessage;
        }
        $saxon->exceptionClear();
    }
}

gives the error

Error: Code=Unknown Message=net.sf.saxon.s9api.SaxonApiException : Stylesheet compilation failed: 1 error reported

in the /var/log/apache2/error.log a more useful error appears:

Error at xsl:call-template on line 11 column 37 of style.xml: XTSE0680: Parameter xxx is not declared in the called template

Is it possible to make the getErrorMessage() function retrieve this error code?

Actions #1

Updated by O'Neil Delpratt over 8 years ago

  • Status changed from New to In Progress
  • Found in version changed from 1.0.0 / 9.6.0.9 to 1.0.0

Thanks for submitting this bug issue and sending a repo. We will investigate the issue.

Actions #2

Updated by O'Neil Delpratt over 8 years ago

  • Category set to Saxon Internal

This is indeed a bug. In the Java code we seem not to be adding the exceptions to the list of exceptions as to when they occur. The only one added is the one throw from the transform method.

I have updated the XsltProcessor class in the Java code. Unit tests are needed to check.

Actions #3

Updated by O'Neil Delpratt over 8 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by O'Neil Delpratt over 8 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 1.0.1

Bug fix applied in the Saxon/C 1.0.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF