[dna-issues] [JBoss JIRA] Commented: (DNA-297) JcrSession.exportDocumentView Does Not Export Carriage Returns, Line Feeds, and Tabs Correctly
Randall Hauch (JIRA)
jira-events at lists.jboss.org
Thu Mar 12 12:43:22 EDT 2009
[ https://jira.jboss.org/jira/browse/DNA-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12456967#action_12456967 ]
Randall Hauch commented on DNA-297:
-----------------------------------
I tried this patch, and there is one failure in JcrSessionTest.shouldExportMultiLinePropertiesInSystemView(JcrSessionTest.java:419). The error contains some unformatted output, but here's the more readable result:
Expected:
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" sv:name="c">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
</sv:property>
<sv:property sv:name="multiLineProperty" sv:type="String">
<sv:value>Line 1\nLine 2\rLine\t3</sv:value>
</sv:property>
<sv:property sv:name="stringProperty" sv:type="String">
<sv:value>value</sv:value>
</sv:property>
</sv:node>
But got:
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dna="http://www.jboss.org/dna/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" sv:name="c">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
</sv:property>
<sv:property sv:name="stringProperty" sv:type="String">
<sv:value>value</sv:value>
</sv:property>
<sv:property sv:name="multiLineProperty" sv:type="String">
<sv:value>Line 1\nLine 2\rLine\t3</sv:value>
</sv:property>
</sv:node>
If you look at these closely, there two major differences: 1) the namespace declarations are in a different order, and 2) the order of the last two properties are switched.
I've seen evidence of problems like this in situations where different JDKs/JREs are ordering the contents of a HashSet (or HashMap) differently. I suspect that this is the problem here. I'm on OS-X running Apple's JDK 1.5.0_16 (version build 1.5.0_16-b06-284 of the JRE), and from another recent issue I know that Brian is running JDK 1.6.0_012 on Windows XP.
So, technically the only problem is in the JcrSessionTest, since it's comparing string values. We can either
1) find some other way to validate the output that is independent of ordering of properties and namespaces; or
2) we can have the export take a little more time and guarantee ordering so the export output is consistent and repeatable on different platforms. Note, however, that the latter is really not a requirement of JCR.
I have not committed the patch.
> JcrSession.exportDocumentView Does Not Export Carriage Returns, Line Feeds, and Tabs Correctly
> ----------------------------------------------------------------------------------------------
>
> Key: DNA-297
> URL: https://jira.jboss.org/jira/browse/DNA-297
> Project: DNA
> Issue Type: Bug
> Affects Versions: 0.4
> Reporter: Brian Carothers
> Priority: Minor
> Attachments: DNA-297.patch
>
>
> JcrSession.exportDocumentView did not properly encode carriage returns, line feeds, or tabs during export as described in section 6.4.4 of the 1.0.1 specification.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the dna-issues
mailing list