[jira] [Commented] (JENA-1514) Class cast exception with BigInteger literals.

2018-04-01 Thread Andy Seaborne (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16421823#comment-16421823
 ] 

Andy Seaborne commented on JENA-1514:
-

See the javadoc in XSDBaseNumericType.cannonicalise about narrowing and 
indexing.

You can't cast it to fixed choice of {{Integer}} or {{Long}} reliably either 
for the same reason. 

You can cast to {{Number}}.

Do try with BigDecimal. It's different.

 

> 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)


[jira] [Commented] (JENA-1514) Class cast exception with BigInteger literals.

2018-04-13 Thread Andy Seaborne (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16437352#comment-16437352
 ] 

Andy Seaborne commented on JENA-1514:
-

I can't see a way of doing anything here that is not a change that will impact 
applications.

The contracts around XSDBaseNumericType.cannonicalise which impact memory graph 
indexing, also look to be such that a change will affect behaviour there as 
well.

Can we close this until a concrete proposal is available when we can explore 
the impact on a concrete case?

> 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)


[jira] [Commented] (JENA-1514) Class cast exception with BigInteger literals.

2018-04-13 Thread Claude Warren (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16437361#comment-16437361
 ] 

Claude Warren commented on JENA-1514:
-

We may have to put this on the queue for Jena 4.  But I am ok with putting
it back until we can figure out how to solve the problem.

On Fri, Apr 13, 2018 at 3:19 PM, Andy Seaborne (JIRA) 




-- 
I like: Like Like - The likeliest place on the web

LinkedIn: http://www.linkedin.com/in/claudewarren


> 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)