Project

Profile

Help

Bug #4021

closed

ClassCastException setting an integer-valued feature from the command line

Added by Michael Kay over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Command Line
Sprint/Milestone:
-
Start date:
2018-11-12
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.9
Fix Committed on Branch:
9.9
Fixed in Maintenance Release:
Platforms:

Description

When the new feature key --thresholdForHotspotByteCode:1 is used on the command line, we get an exception

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
	at com.saxonica.config.EnterpriseConfiguration.setConfigurationProperty(EnterpriseConfiguration.java:189)
	at com.saxonica.config.ProfessionalConfiguration.setConfigurationProperty(ProfessionalConfiguration.java:257)
	at net.sf.saxon.s9api.Processor.setConfigurationProperty(Processor.java:350)
	at net.sf.saxon.trans.CommandLineOptions.applyToConfiguration(CommandLineOptions.java:261)
	at net.sf.saxon.Query.parseOptions(Query.java:496)

The same applies to other integer-valued properties, unless Configuration.setConfigurationProperty() makes arrangements to accept a string.

It also applies to other interfaces that accept configuration properties as strings. These basically do an unsafe cast to the expected type T when calling setConfigurationProperty(Feature<T> feature, T value). The failure doesn't occur for booleans because Configuration.setConfigurationProperty has special logic to accept a string even though the type signature expects T=boolean.

Please register to edit this issue

Also available in: Atom PDF