[
https://issues.apache.org/jira/browse/JENA-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15001041#comment-15001041
]
ASF subversion and git services commented on JENA-1066:
-------------------------------------------------------
Commit 2aaa1b67bd363b0d0d96e570f4f73b1fc6424e22 in jena's branch
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=2aaa1b6 ]
JENA-1066 : Use BigDecimal.toPlainString.
Also, Float->string and Double->string to use "INF" not Java "Infinity".
> Node_Factory.createLiteralByValue creates malformed literals from BigDecimal
> values
> -----------------------------------------------------------------------------------
>
> Key: JENA-1066
> URL: https://issues.apache.org/jira/browse/JENA-1066
> Project: Apache Jena
> Issue Type: Bug
> Components: Core, Datatypes
> Affects Versions: Jena 2.13.0, Jena 3.0.0
> Reporter: Stuart Williams
> Attachments: BigDecimalTestCase.java, git-diff.txt
>
>
> I've been working with some numeric data and have run into some problems when
> using:
> {code}
> Node_Factory.createLiteralByValue(Object value, RDFDatatype dtype)
> {code}
> when value is a {{BigDecimal}}.
> Jena ultimately uses {{BigDecimal.toString()}} to generate lexical forms for
> well-formed-ness checking and to provide results for {{.getLexicalForm()}} on
> the resulting {{Node_Literal}}. Unfortunately Java 1.5 changed the behaviour
> of {{BigDecimal.toString()}} and added {{BigDecimal.toPlainString()}} which
> it describes as an analog of the java 1.4 {{BigDecimal.toString()}} and which
> specifically does not use exponential notation in its output. {{xsd:decimal}}
> lexicalforms do not allow exponential notation
> I'll attached small java program that illustrates the problem. The cases
> where a dud literal form (i.e. as a literal in exponent from) are fair enough.
> I've also locally created a fix that special cases instances of
> {{BigDecimal}} in a couple of places. Patch file to be attached.
> With the fix applied the literals arising from
> {{Node_Factory.createLiteralByValue}} calls with a {{BigDecimal}} value are
> wellformed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)