You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/03/11 11:17:12 UTC

svn commit: r635865 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java

Author: fmeschbe
Date: Tue Mar 11 03:17:01 2008
New Revision: 635865

URL: http://svn.apache.org/viewvc?rev=635865&view=rev
Log:
Only try to call Property.getNode() when adapting to Node.class if the
property is a REFERENCE property to prevent some nasty and unneeded
log entries. And don't fill the log with probably unneeded dumps of
ValueFormatExceptions (log them at debug instead but keep the info
message)

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java?rev=635865&r1=635864&r2=635865&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java Tue Mar 11 03:17:01 2008
@@ -25,6 +25,7 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.Property;
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
@@ -67,24 +68,35 @@
         try {
             if (type == String.class) {
                 return (AdapterType) getProperty().getString();
+                
             } else if (type == Boolean.class) {
                 return (AdapterType) new Boolean(getProperty().getBoolean());
+                
             } else if (type == Long.class) {
                 return (AdapterType) new Long(getProperty().getLong());
+                
             } else if (type == Double.class) {
                 return (AdapterType) new Double(getProperty().getDouble());
+                
             } else if (type == Calendar.class) {
                 return (AdapterType) getProperty().getDate();
+                
             } else if (type == Value.class) {
                 return (AdapterType) getProperty().getValue();
-            } else if (type == Node.class) {
+                
+            } else if (type == Node.class
+                && getProperty().getType() == PropertyType.REFERENCE) {
                 return (AdapterType) getProperty().getNode();
+                
             } else if (type == InputStream.class) {
                 return (AdapterType) getInputStream();
             }
+            
         } catch (ValueFormatException vfe) {
-            log.info("adaptTo: Problem accessing the property value of "
-                + getPath(), vfe);
+            log.info("adaptTo: Problem accessing the property value of {}: {}",
+                getPath(), vfe.getMessage());
+            log.debug("adaptTo: Cause", vfe);
+            
         } catch (RepositoryException re) {
             log.info("adaptTo: Problem accessing the property " + getPath(), re);
         }