You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2018/05/04 09:02:00 UTC
[jira] [Closed] (JENA-1514) Class cast exception with BigInteger
literals.
[ https://issues.apache.org/jira/browse/JENA-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andy Seaborne closed JENA-1514.
-------------------------------
Resolution: Not A Bug
This is major change.
The datatype handling code from Xerces is now incorporated into Jena (see JENA-1537).
Longer term, it may be better to replace with a more focused approach specific to the needs of Jena. https://github.com/afs/xsd4ld is an example of this.
Large scale changes could also combine the needs of ARQ, specifically {{NodeValue}}.
See also Jena-1402 (JDK provided {{Duration}} does not get the right answers in subtraction).
> Class cast exception with BigInteger literals.
> ----------------------------------------------
>
> Key: JENA-1514
> URL: https://issues.apache.org/jira/browse/JENA-1514
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 3.6.0, Jena 3.7.0
> Reporter: Claude Warren
> Priority: Minor
> Attachments: BigIntIssue.java
>
>
> When saving a BigInteger as a literal it is converted into an XSDBaseNumericType.
> When that type is read back it is converted into the smallest numeric data type that can hold the value; a narrowing if you will.
> While this works fine for primitive and primitive wrapping types (e.g. int and Integer) there is no automatic boxing available for BigInteger so attempting to retrieve the value of a BigInteger that is smaller than the Long.MAX_VALUE will result in a class cast exception when the primitive type is cast to the BigInteger.
> I suspect the similar issues arise when BigDecimal is also used but I have not tested.
> Should we address this issue by creating a BigInteger and BigDecimal type that perhaps extends XSDBaseNumericType? Should we address this issue at all and just post a warning?
> Test code is included to show the issue.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)