You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Stefan Guggisberg (JIRA)" <ji...@apache.org> on 2006/03/08 13:22:41 UTC

[jira] Resolved: (JCR-325) docview roundtripping does not work with multivalue non-string properties

     [ http://issues.apache.org/jira/browse/JCR-325?page=all ]
     
Stefan Guggisberg resolved JCR-325:
-----------------------------------

    Resolution: Fixed

document view xml serialization is *not* guaranteed to be roundtrippable
as some of the information, such as property type and multi-value flag, is lost.

the only failsafe way of handling multi-valued properties is to skip them 
on export (see "6.4.2.5 Multi-value Properties",  jsr-170 specification).
this is probably not desirable from a user perspective.

the following pragmatic approach has been chosen to workaround this issue:

document view export:
------------------------------

- multi-value properties are exported space-separated, with a leading line-feed (&#xa;) 
  as a 'multi-valued'-hint; spaces within a value are encoded as _x0020_;

  e.g. ["john doe","donald duck"] => "&#xa;john_x0020_doe donald_x0020_duck"

- single-value properties are exported without encoding contained spaces as _x0020_

  e.g. "Hello, World!" => "Hello, World!"


document view import:
------------------------------

- attribute values starting with &#xa; (line-feed) are assumed to represent multiple values,
  delimited by spaces; _x0020_ within values are decoded to spaces

  e.g. "&#xa;john_x0020_doe donald_x0020_duck" => ["john doe","donald duck"]

- all other attribute values are considered to be single values; no space decoding
  is performed.

  e.g. "Hello, World!" => "Hello, World!"


fixed in svn r384197

> 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: Bug
>   Components: core
>     Versions: 0.9
>  Environment: jackrabbit r379292
>     Reporter: Tobias Bocanegra
>     Assignee: Stefan Guggisberg

>
> 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