jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angela Schreiber <anch...@adobe.com>
Subject Re: Faulty XML import / property export?
Date Tue, 20 Dec 2011 16:33:26 GMT
hi ingomar

> I am implementing a primitive replication based on XMLImport/Export on 2.2.10.
> Having written nodes into a Repo using Session.importXML I get the following exception
> accessing any document through WebDav:
> java.io.IOException: not a long: 2011-12-20T09:24:30.608+01:00
>          org.apache.jackrabbit.server.io.DefaultHandler.exportProperties(DefaultHandler.java:497)
>          org.apache.jackrabbit.server.io.DefaultHandler.exportContent(DefaultHandler.java:399)
>          org.apache.jackrabbit.server.io.DefaultHandler.exportContent(DefaultHandler.java:421)
>          org.apache.jackrabbit.server.io.IOManagerImpl.exportContent(IOManagerImpl.java:177)
>          org.apache.jackrabbit.webdav.simple.DavResourceImpl.spool(DavResourceImpl.java:282)
>          org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.spoolResource(AbstractWebdavServlet.java:507)
>          org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.doGet(AbstractWebdavServlet.java:473)
>          org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.execute(AbstractWebdavServlet.java:314)
>          org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.service(AbstractWebdavServlet.java:263)
>          javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> I looked at DefaultHandler, this seems to try to interpret "jcr:created" as Long:
> protected void exportProperties(ExportContext context, boolean isCollection, Node contentNode)
throws IOException {
>          try {
>              // only non-collections: 'jcr:created' is present on the parent 'fileNode'
>              if (!isCollection&&  contentNode.getDepth()>  0&&  contentNode.getParent().hasProperty(JcrConstants.JCR_CREATED))
>                  long cTime = contentNode.getParent().getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
> jcr:created is defined as date.

properties of type DATE should be converted to long. but the conversion
might fail. JCR specification section " From DATE To" states for
conversion to LONG:

   "LONG: The date is converted to the number of milliseconds since
    00:00 (UTC) 1 January 1970 (1970-01-01T00:00:00.000Z). If this
    number is out-of-range for a long, a ValueFormatException is

> Where is the problem? Parsing the value? The value itself?

so, either the property is of some other type that cannot be
converted to LONG here (that might happen if it gets set to an
unstructured node without specifying the desired type) or
the value is out-of-range as stated above.

however, i would argue that defaulthandler should be prepared
for that and either omit the jcr:created property or add some
default value instead of throwing an exception... the same
is btw true for the jcr:lastmodified.

can you please create a issue in JIRA for that? thanks.

> Cheers,
>   Ingomar

View raw message