You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2009/09/23 16:14:56 UTC

svn commit: r818114 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java

Author: bdelacretaz
Date: Wed Sep 23 14:14:56 2009
New Revision: 818114

URL: http://svn.apache.org/viewvc?rev=818114&view=rev
Log:
SLING-1122 - improved log message if jcr:lastModified is not a long

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java?rev=818114&r1=818113&r2=818114&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java Wed Sep 23 14:14:56 2009
@@ -36,6 +36,7 @@
 import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
+import javax.jcr.ValueFormatException;
 
 import org.apache.jackrabbit.net.URLFactory;
 import org.apache.sling.api.resource.PersistableValueMap;
@@ -253,7 +254,14 @@
             }
 
             if (node.hasProperty(JCR_LASTMODIFIED)) {
-                metadata.setModificationTime(node.getProperty(JCR_LASTMODIFIED).getLong());
+                // We don't check node type, so JCR_LASTMODIFIED might not be a long
+                final Property prop = node.getProperty(JCR_LASTMODIFIED); 
+                try {
+                    metadata.setModificationTime(prop.getLong());
+                } catch(ValueFormatException vfe) {
+                    log.info("Property {} cannot be converted to a long, ignored ({})", 
+                            prop.getPath(), vfe);
+                }
             }
         } catch (RepositoryException re) {
             log.info(