Project

Profile

Help

Bug #3952

closed

SchemaValidator 'lax' option causes crash

Added by O'Neil Delpratt about 6 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
High
Category:
-
Start date:
2018-10-05
Due date:
% Done:

100%

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

Description

When we use the 'lax' option on SchemaValidator it causes a crash. for example. validator.setProperty("lax", "true");

Internal error reported when debug is switched on:

Exception in thread "main" java.lang.ClassCastException: java.lang.String
	at net.sf.saxon.option.cpp.SchemaValidatorForCpp.applySchemaProperties(Unknown Source)
	at net.sf.saxon.option.cpp.SchemaValidatorForCpp.validate(Unknown Source)

The cause is in the SchemaValidatorForCpp Java class does not first convert the string to boolean.


Files

SchemaValidator.h (5.98 KB) SchemaValidator.h Contains workaround fix O'Neil Delpratt, 2018-10-05 19:06
SchemaValidator.cpp (17.8 KB) SchemaValidator.cpp Contains workaround fix O'Neil Delpratt, 2018-10-05 19:06
Actions #1

Updated by O'Neil Delpratt about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Bug fixed. Made change in the Java class SchemaValidatorForCpp.

Workaround alternatives:

  1. Set lax option in a config file. But there seems to be an issue with using a config file and SchemaValidation. see bug issue: #3953
  2. Modify the SchemaValidator.cpp file to pass the expected value for the 'lax' option i.e. Boolean object.
Actions #2

Updated by O'Neil Delpratt about 6 years ago

hi,

I have modified the SchemaValidator class with the option 2 workaround from comment #1

Notice we now have a method called setLax(boolean) used to set the lax option.

Actions #3

Updated by O'Neil Delpratt over 5 years ago

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

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

Actions #4

Updated by O'Neil Delpratt over 5 years ago

  • Status changed from Closed to In Progress
  • Fixed in version deleted (1.1.2)

Reported by user:

The setLax() function added to the API Schema Validator as a workaround doesn't exist in the 1.1.2 API.

Actions #5

Updated by O'Neil Delpratt over 5 years ago

As a workaround the following will work the same way as setLax:

XdmAtomicValue value = processor.makeBooleanValue(true);
sv.setParameter(“lax", value);
Actions #6

Updated by O'Neil Delpratt over 5 years ago

  • Status changed from In Progress to Resolved

setLax method and related code reinserted in SchemaValidator class in svn for both the 1.1 and 1.2 branches.

Actions #7

Updated by O'Neil Delpratt about 5 years ago

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

Big fix applied in the Saxon/C 1.2.0 release.

Please register to edit this issue

Also available in: Atom PDF