Project

Profile

Help

Bug #5911

closed

SaxonCS crashes when package version number is wrong

Added by Michael Kay almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2023-03-08
Due date:
% Done:

100%

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

Description

If the package version number in xsl:use-package is not in the correct lexical form, for example "1.0.0", a crash of the form

Input string was not in a correct format.
System.FormatException: Input string was not in a correct format.
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
   at System.Int32.Parse(String s)
   at Saxon.Hej.style.PackageVersion..ctor(String s) in /Users/mike/....../Saxon/Hej/style/PackageVersion.cs:line 49

results

Actions #1

Updated by Michael Kay almost 2 years ago

The problem is that the transpiler isn't mapping Java exceptions to C# exceptions correctly, so we're catching the wrong exception. Perhaps it would be better to test the supplied version against a regex rather than rely on catching exceptions...

I thought about using the NestedIntegerValue class but that seems to have the same problem.

Actions #2

Updated by Michael Kay almost 2 years ago

  • Status changed from New to Resolved
  • Applies to branch 11, 12, trunk added
  • Fix Committed on Branch 12, trunk added
  • Platforms .NET added

Fixed on the 12.x and main branches (not fixed for 11.x)

Actions #3

Updated by O'Neil Delpratt almost 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.1 added

Bug fix applied in the Saxon 12.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF