incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r682984 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Date Tue, 05 Aug 2008 21:57:18 GMT
Author: fmeschbe
Date: Tue Aug  5 14:57:18 2008
New Revision: 682984

URL: http://svn.apache.org/viewvc?rev=682984&view=rev
Log:
SLING-600 Fix value conversion in case of default values of
an implementation of Calendar and Value

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java?rev=682984&r1=682983&r2=682984&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
(original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Tue Aug  5 14:57:18 2008
@@ -72,7 +72,16 @@
             return (T) get(name);
         }
 
-        T value = get(name, (Class<T>) defaultValue.getClass());
+        // special handling in case the default value implements one
+        // of the interface types supported by the convertToType method
+        Class<T> type = (Class<T>) defaultValue.getClass();
+        if (Calendar.class.isAssignableFrom(type)) {
+            type = (Class<T>) Calendar.class;
+        } else if (Value.class.isAssignableFrom(type)) {
+            type = (Class<T>) Value.class;
+        }
+
+        T value = get(name, type);
         if (value == null) {
             value = defaultValue;
         }
@@ -137,6 +146,7 @@
             return "";
         }
     }
+
     // ---------- Helpers to access the node's property ------------------------
 
     private Object read(String key) {



Mime
View raw message