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

Carsten Ziegeler closed SLING-1761.
-----------------------------------


> JcrPropertyResource sets incorrect content length for strings containing 
> non-ascii character
> --------------------------------------------------------------------------------------------
>
>                 Key: SLING-1761
>                 URL: https://issues.apache.org/jira/browse/SLING-1761
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Julian Sedding
>            Assignee: Carsten Ziegeler
>             Fix For: JCR Resource 2.0.8
>
>         Attachments: SLING-1761-tests.patch, SLING-1761.patch
>
>
> JcrPropertyResource sets the content length of the property in its metadata. 
> To do so, it uses javax.jcr.Property#getLength() to determine the content 
> length.
> The documentation for javax.jcr.Property#getLength() states "[...] Returns 
> the length in bytes if the value is a PropertyType.BINARY, otherwise it 
> returns the number of characters needed to display the value in its string 
> form.  [...]".
> The documentation in ResourceMetadata is not explicit, but from its usage in 
> StreamRendererServlet I conclude that ResourceMetadata.getContentLength() is 
> intended for use in the Content-Length HTTP header. If my assumptions are 
> correct, the content length indicates the number of bytes in the string, 
> while javax.jcr.Property#getLength() returns the number of characters.
> The effect of this can be observed by the following steps:
> * create a string property "/utf8string" with value "Bär"
> * access this property using a browser (e.g. 
> http://localhost:8888/utf8string), so that the property gets rendered by the 
> StreamRendererServlet
> => the string is rendered incorrectly (due to a missing Content-Type header)
> => the string is cut off (due to the incorrectly set Content-Length header)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to