[jira] Updated: (SLING-1761) JcrPropertyResource sets incorrect content length for strings containing non-ascii character

2010-09-13 Thread Carsten Ziegeler (JIRA)

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

Carsten Ziegeler updated SLING-1761:


Fix Version/s: JCR Resource 2.0.8

Sounds to me like an easy fix, we might want to include into the 2.0.8 release

> 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
> 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:/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.



[jira] Updated: (SLING-1761) JcrPropertyResource sets incorrect content length for strings containing non-ascii character

2010-09-11 Thread Julian Sedding (JIRA)

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

Julian Sedding updated SLING-1761:
--

Attachment: SLING-1761-tests.patch

Irony has it that the encoding of the attached tests was incorrect. Trying 
again ...

> 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
> 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:/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.



[jira] Updated: (SLING-1761) JcrPropertyResource sets incorrect content length for strings containing non-ascii character

2010-09-11 Thread Julian Sedding (JIRA)

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

Julian Sedding updated SLING-1761:
--

Attachment: (was: SLING-1761-tests.patch)

> 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
> 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:/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.



[jira] Updated: (SLING-1761) JcrPropertyResource sets incorrect content length for strings containing non-ascii character

2010-09-11 Thread Julian Sedding (JIRA)

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

Julian Sedding updated SLING-1761:
--

Attachment: SLING-1761.patch

A patch for the content-length issue, which also sets content type to 
"text/plain" and character encoding to "UTF-8" for non-binary properties.

I am not 100% certain that it is correct to set all of these in the 
ResourceMetadata, as the issue I observed was with the StreamRendererServlet. 
So I would be grateful if you could carefully review the patch before applying.

> 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
> 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:/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.



[jira] Updated: (SLING-1761) JcrPropertyResource sets incorrect content length for strings containing non-ascii character

2010-09-11 Thread Julian Sedding (JIRA)

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

Julian Sedding updated SLING-1761:
--

Attachment: SLING-1761-tests.patch

Some test cases and a minor fix to JcrItemResourceTestBase.

> 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
> Attachments: SLING-1761-tests.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:/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.