[ 
http://issues.apache.org/jira/browse/JCR-325?page=comments#action_12371104 ] 

Jukka Zitting commented on JCR-325:
-----------------------------------

> in your patch you just pass a reference to the ns context in the constructor.
> the ns context however is mutable and could, theoretically at least, change
> after a *StringValue has been created and before getValue has been called. 

Yes, I tought of this issue as well. The use of the ns context in the patch is 
temporally identical to the current code in svn, as the *StringValue instances 
are no longer used after the Importer.startNode() call. This temporal binding 
is however much less obvious in the patch, so you are right in that there is a 
threat of further changes breaking the inherent assumption of the ns context 
not changing during the lifetime of a *StringValue instance.

This issue could be quite cleanly solved by explicitly managing the ns context 
as a stack of immutable prefix mappings instead of using the mutable SAX 
NamespaceSupport class. A namespace context would be an object with a reference 
to the parent namespace context and a collection of prefix mappings declared 
for a given XML element. Namespace resolution would then follow the parent 
references until a match is found. (This is actually what the NamespaceSupport 
class does internally, although it only presents a mutable facade that hides 
this data structure behind the push/pop methods.)

I'll make a new version of the patch with modified namespace context handling.

> docview roundtripping does not work with multivalue non-string properties
> -------------------------------------------------------------------------
>
>          Key: JCR-325
>          URL: http://issues.apache.org/jira/browse/JCR-325
>      Project: Jackrabbit
>         Type: Improvement
>   Components: xml
>     Versions: 0.9
>  Environment: jackrabbit r379292
>     Reporter: Tobias Bocanegra
>     Assignee: Jukka Zitting
>  Attachments: xml-refactoring.patch
>
> when exporting a multivalue property with docview, the property values are 
> serialized to a space delimited list in the xml attributes:
> for example:
> <?xml version="1.0" encoding="UTF-8"?>
> .
> .
> <testNode 
>     jcr:primaryType="refTest" 
>     refs="b5c12524-5446-4c1a-b024-77f623680271 
> 7b4d4e6f-9515-47d8-a77c-b4beeaf469bc"
> />
> the refTest nodetype was:
> [refTest] 
> - refs (reference) multiple 
> importing this docview fails with: javax.jcr.ValueFormatException: not a 
> valid UUID format
> this is due to the fact, that the space delimited list is not exploded 
> anymore. actually this code is commented:
> org.apache.jackrabbit.core.xml.DocViewImportHandler, lines 191 - 200:
> /*
>                 // @todo should attribute value be interpreted as LIST type 
> (i.e. multi-valued property)?
>                 String[] strings = Text.explode(attrValue, ' ', true);
>                 propValues = new Value[strings.length];
>                 for (int j = 0; j < strings.length; j++) {
>                     // decode encoded blanks in value
>                     strings[j] = Text.replace(strings[j], "_x0020_", " ");
>                     propValues[j] = InternalValue.create(strings[j]);
>                 }
> */
> i haven't tested, but i assume this also fails for all other non-string 
> property types.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to