Project

Profile

Help

Bug #5313

closed

NullReferenceException from validate command line when invalid argument used

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
Command Line
Sprint/Milestone:
-
Start date:
2022-02-12
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

From Forum post https://saxonica.plan.io/boards/3/topics/8360

I have tried the validate option of SaxonCS from the command line, mistyping the -xsd option as -xs, that didn't give a clean error or warning (as the Java version of 10 EE does) but a NullReferenceException:

> SaxonCS.exe'validate -xs:assert-example1.xsd -s:sample1.xml
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Saxon.Eej.Validate.quit(String message, Int32 code) in C:\Users\ndw\saxondev\build\cs\Saxon\Eej\Validate.cs:line 301
   at Saxon.Eej.Validate.doValidate(String[] args) in C:\Users\ndw\saxondev\build\cs\Saxon\Eej\Validate.cs:line 63
   at Saxon.Eej.Validate.main(String[] args) in C:\Users\ndw\saxondev\build\cs\Saxon\Eej\Validate.cs:line 17
   at Saxon.Cmd.Command.Main(String[] args) in C:\Users\ndw\saxondev\src\main\saxon-cs\engine\Saxon\Cmd\Command.cs:line 22

Problem reproduced.

Actions #1

Updated by Michael Kay almost 3 years ago

  • Subject changed from SaxonCS: NullReferenceException from validate command line when invalid argument used to NullReferenceException from validate command line when invalid argument used
  • Status changed from New to In Progress
  • Platforms Java added

Applies also to SaxonJ.

In Validate.quit(), we're trying to write the error message to config.getLogger(), but config is not initialised yet.

Actions #2

Updated by Michael Kay almost 3 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch 11, trunk added

Fixed by aligning Validate.quit() with Transform.quit() and Query.quit().

Actions #3

Updated by Debbie Lockett almost 3 years ago

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

Bug fix applied in the Saxon 11.2 maintenance release.

Please register to edit this issue

Also available in: Atom PDF