You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Ingomar Otter (Created) (JIRA)" <ji...@apache.org> on 2011/12/20 17:56:36 UTC

[jira] [Created] (JCR-3187) .DefaultHandler.exportProperties for unexpected values of jcr:created / jcr:lastmodified

.DefaultHandler.exportProperties for unexpected values of jcr:created /  jcr:lastmodified
-----------------------------------------------------------------------------------------

                 Key: JCR-3187
                 URL: https://issues.apache.org/jira/browse/JCR-3187
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-jcr-server
    Affects Versions: 2.2.10
            Reporter: Ingomar Otter


Having written nodes into a Repo using Session.importXML I get the following exception when

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' only
            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 "3.6.4.3 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
   thrown."

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (JCR-3187) DefaultHandler.exportProperties acts ungraceful for unexpected values of jcr:created / jcr:lastmodified

Posted by "Ingomar Otter (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-3187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ingomar Otter updated JCR-3187:
-------------------------------

    Summary: DefaultHandler.exportProperties acts ungraceful for unexpected values of jcr:created /  jcr:lastmodified  (was: .DefaultHandler.exportProperties for unexpected values of jcr:created /  jcr:lastmodified)

Another aspect is why the value is illegal in the first place.
The node was created by an XML import of an XML export, I would expect the data to be identical. 
                
> DefaultHandler.exportProperties acts ungraceful for unexpected values of jcr:created /  jcr:lastmodified
> --------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-3187
>                 URL: https://issues.apache.org/jira/browse/JCR-3187
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-jcr-server
>    Affects Versions: 2.2.10
>            Reporter: Ingomar Otter
>
> Having written nodes into a Repo using Session.importXML I get the following exception when
> 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' only
>             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 "3.6.4.3 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
>    thrown."
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira