[ 
https://issues.apache.org/jira/browse/JENA-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne updated JENA-335:
-------------------------------

    Description: 
To reproduce in Jena core:

        Node n = Node.createLiteral("AB CD", XSDDatatype.XSDhexBinary) ;
        n.hashCode() ;

Effect

A bad lexical form for hexBinary causes problems for TDB: 

Example data:
---- D.ttl
{{
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <http://example/> .

:s :p "AB CD"^^xsd:hexBinary .
## :s :p "AB CD"^^xsd:float .
}}

tdbloader --loc DB D.ttl ==>

WARN  [line: 4, col: 7 ] Lexical form 'AB CD' not valid for datatype 
http://www.w3.org/2001/XMLSchema#hexBinary
http://example/s http://example/p "AB 
CD"^^http://www.w3.org/2001/XMLSchema#hexBinary
com.hp.hpl.jena.datatypes.DatatypeFormatException: Lexical form 'AB CD' is not 
a legal instance of Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] 
Lexical form 'AB CD' is not a legal instance of 
Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] during parse 
-org.apache.xerces.impl.dv.InvalidDatatypeValueException: 
cvc-datatype-valid.1.2.1: 'AB CD' is not a valid value for 'hexBinary'.
        at 
com.hp.hpl.jena.graph.impl.LiteralLabelImpl.getValue(LiteralLabelImpl.java:326)
        at 
com.hp.hpl.jena.datatypes.xsd.XSDhexBinary.getHashCode(XSDhexBinary.java:81)
        at 
com.hp.hpl.jena.graph.impl.LiteralLabelImpl.hashCode(LiteralLabelImpl.java:448)
        at com.hp.hpl.jena.graph.Node.hashCode(Node.java:331)
        at java.util.HashMap.hash(HashMap.java:351)

The WARN is right - the exception should not happen.  Looks like Xerces is 
behaving differently because 
a bad float only causes a wanring (which is correct) and TDB continues.





  was:
To reproduce in Jena core:

        Node n = Node.createLiteral("AB CD", XSDDatatype.XSDhexBinary) ;
        n.hashCode() ;

Effect

A bad lexical form for hexBinary causes problems for TDB: 

Example data:
---- D.ttl
{{
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <http://example/> .

:s :p "AB CD"^^xsd:hexBinary .
## :s :p "AB CD"^^xsd:float .
}}

tdbloader --loc DB D.ttl ==>

WARN  [line: 4, col: 7 ] Lexical form 'AB CD' not valid for datatype 
http://www.w3.org/2001/XMLSchema#hexBinary
http://example/s http://example/p "AB 
CD"^^http://www.w3.org/2001/XMLSchema#hexBinary
com.hp.hpl.jena.datatypes.DatatypeFormatException: Lexical form 'AB CD' is not 
a legal instance of Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] 
Lexical form 'AB CD' is not a legal instance of 
Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] during parse 
-org.apache.xerces.impl.dv.InvalidDatatypeValueException: 
cvc-datatype-valid.1.2.1: 'AB CD' is not a valid value for 'hexBinary'.
        at 
com.hp.hpl.jena.graph.impl.LiteralLabelImpl.getValue(LiteralLabelImpl.java:326)
        at 
com.hp.hpl.jena.datatypes.xsd.XSDhexBinary.getHashCode(XSDhexBinary.java:81)
        at 
com.hp.hpl.jena.graph.impl.LiteralLabelImpl.hashCode(LiteralLabelImpl.java:448)
        at com.hp.hpl.jena.graph.Node.hashCode(Node.java:331)
        at java.util.HashMap.hash(HashMap.java:351)

The WARN is right - the exception shoudl not happen.  Looks like Xerces is 
behaving differently because 
a bad float only causes a wanring (which is correct) and TDB continues.

The warning is right - the 




    
> Node.hashCode of an illegal hexBinary causes a Xerces-originated exception.
> ---------------------------------------------------------------------------
>
>                 Key: JENA-335
>                 URL: https://issues.apache.org/jira/browse/JENA-335
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 2.7.3
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>            Priority: Minor
>
> To reproduce in Jena core:
>         Node n = Node.createLiteral("AB CD", XSDDatatype.XSDhexBinary) ;
>         n.hashCode() ;
> Effect
> A bad lexical form for hexBinary causes problems for TDB: 
> Example data:
> ---- D.ttl
> {{
> @prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
> @prefix :        <http://example/> .
> :s :p "AB CD"^^xsd:hexBinary .
> ## :s :p "AB CD"^^xsd:float .
> }}
> tdbloader --loc DB D.ttl ==>
> WARN  [line: 4, col: 7 ] Lexical form 'AB CD' not valid for datatype 
> http://www.w3.org/2001/XMLSchema#hexBinary
> http://example/s http://example/p "AB 
> CD"^^http://www.w3.org/2001/XMLSchema#hexBinary
> com.hp.hpl.jena.datatypes.DatatypeFormatException: Lexical form 'AB CD' is 
> not a legal instance of Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] 
> Lexical form 'AB CD' is not a legal instance of 
> Datatype[http://www.w3.org/2001/XMLSchema#hexBinary] during parse 
> -org.apache.xerces.impl.dv.InvalidDatatypeValueException: 
> cvc-datatype-valid.1.2.1: 'AB CD' is not a valid value for 'hexBinary'.
>       at 
> com.hp.hpl.jena.graph.impl.LiteralLabelImpl.getValue(LiteralLabelImpl.java:326)
>       at 
> com.hp.hpl.jena.datatypes.xsd.XSDhexBinary.getHashCode(XSDhexBinary.java:81)
>       at 
> com.hp.hpl.jena.graph.impl.LiteralLabelImpl.hashCode(LiteralLabelImpl.java:448)
>       at com.hp.hpl.jena.graph.Node.hashCode(Node.java:331)
>       at java.util.HashMap.hash(HashMap.java:351)
> The WARN is right - the exception should not happen.  Looks like Xerces is 
> behaving differently because 
> a bad float only causes a wanring (which is correct) and TDB continues.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to