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

Natanael Arndt commented on JENA-662:
-------------------------------------

[~jeremycarroll] yes exactly this is what I'm saying the code is missing some 
decoding and its not an issue of “… the user expectation of simplicity-of-use 
needs adjustment”.

Here is my example code now. You just have to {{touch /tmp/folder\ with\ 
space/file\ with\ space.ttl}} before.
{{
                String graphs = "";
                graphs += "@prefix ja: 
<http://jena.hpl.hp.com/2005/11/Assembler#> . ";
                graphs += "<http://example.org/file> a ja:FileModel ; ";
                graphs += "ja:directory <file:///tmp/folder%20with%20space/> ; 
";
                graphs += "ja:modelName \"file with space.ttl\" . ";
                
                InputStream is = new ByteArrayInputStream(graphs.getBytes());
                
                Model model = ModelFactory.createDefaultModel();
                model.read(is, "http://example.org/";, "TURTLE");
                Resource r = model.createResource("http://example.org/file";);
                Model assemblerModel = (Model) Assembler.general.open(r);
}}

This causes an Exception with the following cause:

{{Caused by: com.hp.hpl.jena.shared.DoesNotExistException: 
/tmp/folder%20with%20space/file with space.ttl}}

If you also {{touch /tmp/folder%20with%20space/file\ with\ space.ttl}} it will 
work. But this is not the behavior we want.

> Wrong space handling in FileModelAssembler
> ------------------------------------------
>
>                 Key: JENA-662
>                 URL: https://issues.apache.org/jira/browse/JENA-662
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 2.11.1
>            Reporter: Natanael Arndt
>            Priority: Minor
>
> The method {{getDirectoryName}} in 
> {{com.hp.hpl.jena.assembler.assemblers.FileModelAssembler}} should also make 
> sure that at some chars, like space should be urldecoded again. E.g. If the 
> URI is {{file:///tmp/file%20name%20with%20space}} the corresponding file can 
> not be found under {{/tmp/file%20name%20with%20space}} but under  {{/tmp/file 
> name with space}}.
> There might be some other chars which have to be taken into account, e.g. 
> "%25" -> "%", but I don't think a urldecode over the whole string is correct.
> Sorry I can't provide an example yet, because I couldn't isolate this part of 
> the code so far and I didn't try to write a test for this.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to