jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Gough <bagel10002...@googlemail.com>
Subject Re: Error creating file with square brackets in filename
Date Mon, 17 May 2010 06:49:27 GMT
Hi Kevin,

I would have a look at the encoding WIKI page.

http://wiki.apache.org/jackrabbit/EncodingAndEscaping

Some characters are illegal in node names and need escaping when persisting
and using in paths and XPath queries.

There are handy utility classes provided for this which I unfortunately
discovered too late in my project :(

regards

Dave

On Mon, May 17, 2010 at 2:51 AM, Kevin Jansz <kevin.jansz@exari.com> wrote:

> On trying to PUT a file over webdav that has square brackets (ie '[' &
> ']') in its name I get a "500 Internal Server Error".
>
> Trying to create the file using the JCR API:
> file = folder.addNode("[Content_Types].xml", JcrConstants.NT_FILE);
>
> Gives a bit more information:
>        ...
> Caused by:
> org.apache.jackrabbit.spi.commons.conversion.MalformedPathException:
> '[Content_Types].xml' is not a valid path: Unterminated identifier
> segment.
>        at
> org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:295)
>        at
> org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:120)
>        at
> org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver.getQPath(ParsingPathResolver.java:90)
>        at
> org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:98)
>        at
> org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:77)
>        at
> org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(DefaultNamePathResolver.java:82)
>        at
> org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:729)
>        at
> org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:2038)
>        ... 15 more
>
> So it seems that square brackets may need special handling/escaping?
> In this case we don't have the ability to choose a different/better
> name - '[Content_Types].xml' is a resource in all Open Office XML
> (docx) files ...
>
> Any comments/suggestions/work-arounds would be much appreciated.
>
> Kevin
>
> --
> Kevin Jansz
> kevin.jansz@exari.com
> Level 7, 10-16 Queen Street, Melbourne 3000 Australia
> Tel +61 3 9621 2773 | Fax +61 3 9621 2776
> Exari Systems
> Boston | London | Melbourne | Munich
> www.exari.com
>
> Test drive our software online - www.exari.com/demo-trial.html
> Read our blog on document assembly - blog.exari.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message