Bug #4698
closedConstructor XdmAtomicValue(decimal d) should use d.ToString(CultureInfo.InvariantCulture) instead of d.ToString()
100%
Description
I have run into a problem with the construction of an xs:decimal
from a .NET decimal
, as I have a German version of Windows 10 usually .NET code runs with that CultureInfo for that language meaning in
public XdmAtomicValue(decimal d)
{
this.value = new JBigDecimalValue(new JBigDecimal(d.ToString()));
}
the call of d.ToString()
where var d = 2.5m;
gives 2,5
and not 2.5
. Subsequently the Java parsing of the 2,5
fails with
Unbehandelte Ausnahme: java.lang.NumberFormatException
bei java.math.BigDecimal..ctor(Char[] in, Int32 offset, Int32 len, MathContext mc)
bei java.math.BigDecimal..ctor(Char[] in, Int32 offset, Int32 len)
bei java.math.BigDecimal..ctor(String val)
bei Saxon.Api.XdmAtomicValue..ctor(Decimal d)
So I think the constructor needs to be fixed to use d.ToString(CultureInfo.InvariantCulture)
.
Updated by Community Admin over 3 years ago
- Status changed from New to In Progress
hi Martin,
Thank you for raising this issue and for the suggestion. Currently investigating and testing the patch.
Updated by O'Neil Delpratt over 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
- Fix Committed on Branch 10, 9.9 added
Bug fixed applied as suggested in the comment 0. Adding test case to nunit.
Updated by O'Neil Delpratt over 3 years ago
- Applies to branch trunk added
- Fix Committed on Branch trunk added
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to In Progress
Updated by O'Neil Delpratt over 3 years ago
- Status changed from In Progress to Resolved
Added nunit test case. Bug fix available in the next maintenance release.
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to In Progress
Updated by O'Neil Delpratt over 3 years ago
- Status changed from In Progress to Resolved
Bug fixed, but the only way to test it was to change the regional settings in Windows, which was not ideal.
Updated by Martin Honnen over 3 years ago
It should suffice to set e.g. CultureInfo.CurrentCulture = new CultureInfo("de-de")
in your C# code to hit the problem, without needing to change the Windows settings.
Updated by O'Neil Delpratt over 3 years ago
- Fixed in Maintenance Release 9.9.1.8 added
Bug fix applied on the Saxon 9.9.1.8 maintenance release. Leaving open until applied on the Saxon 10 maintenance release.
Updated by O'Neil Delpratt over 3 years ago
Bug fix applied in the Saxon 10.3 maintenance release
Updated by O'Neil Delpratt over 3 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 10.3 added
Please register to edit this issue