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

Andy Seaborne updated JENA-1013:
--------------------------------
    Description: 
In fixing JENA-1011, specifically, correctly calling the JSON-LD parser with 
nested start/finish calls to the RDFStream, test 
{{AbstractNodeTupleInputFormatTests.fail_on_bad_input_02}} now fails on JSON-LD.

The bad data in the test is from 
AbstractCompressedWholeFileQuadInputFormatTests.generateMixedTuples is legal 
data follwed by lines of "junk data".

The reason is that the test data has junk after the closing {{\}}} but the 
JSON-LD parser (for better or worse) actually ignores trailing content and 
stops parsing when the matching JSON object close-} is seen.  The input stream 
is in an unclear state (caching read-ahead) but the parser does not advance any 
further so it does not report an error.

In order to get an IOException, the test would need to continue parsing after 
the end of the legal top level JSON object - effectively, it needs to restart 
the parser.  jsonld-java has already finished at this point - the call of 
{{JsonUtils.fromInputStream}} does not look beyond the end of top level object.

This shows up in the piped iterator because the call to RDFStream.finish() 
closes the iterator neatly. The test was getting an IOException for a different 
reason.

  was:
In fixing JENA-1011, specifically, correctly calling the JSON-LD parser with 
nested start/finish calls to the RDFStream, test 
{{AbstractNodeTupleInputFormatTests.fail_on_bad_input_02}} now fails on JSON-LD.

The reason is that the test data has junk after the closing {{\}}} but the 
JSON-LD parser (for better or worse) actually ignores trailing content and 
stops parsing when the matching object close-} is seen.  The input stream is in 
an unclear state (caching read-ahead) but the parser does not advance any 
further so it does not report an error.

In order to get an IOException, the test would need to continue parsing after 
the end of the legal top level JSON object - effectively, it needs to restart 
the parser.  jsonld-java has already finished at this point - the call of 
{{JsonUtils.fromInputStream}} does not look beyond the end of top level object.

This shows up in the piped iterator because the call to RDFStream.finish() 
closes the iterator neatly.


> Compressed JSON-LD test 
> AbstractNodeTupleInputFormatTests.fail_on_bad_input_02 no longer catches 
> IOException.
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: JENA-1013
>                 URL: https://issues.apache.org/jira/browse/JENA-1013
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Elephas
>    Affects Versions: Jena 3.0.1
>            Reporter: Andy Seaborne
>
> In fixing JENA-1011, specifically, correctly calling the JSON-LD parser with 
> nested start/finish calls to the RDFStream, test 
> {{AbstractNodeTupleInputFormatTests.fail_on_bad_input_02}} now fails on 
> JSON-LD.
> The bad data in the test is from 
> AbstractCompressedWholeFileQuadInputFormatTests.generateMixedTuples is legal 
> data follwed by lines of "junk data".
> The reason is that the test data has junk after the closing {{\}}} but the 
> JSON-LD parser (for better or worse) actually ignores trailing content and 
> stops parsing when the matching JSON object close-} is seen.  The input 
> stream is in an unclear state (caching read-ahead) but the parser does not 
> advance any further so it does not report an error.
> In order to get an IOException, the test would need to continue parsing after 
> the end of the legal top level JSON object - effectively, it needs to restart 
> the parser.  jsonld-java has already finished at this point - the call of 
> {{JsonUtils.fromInputStream}} does not look beyond the end of top level 
> object.
> This shows up in the piped iterator because the call to RDFStream.finish() 
> closes the iterator neatly. The test was getting an IOException for a 
> different reason.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to