jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1537049 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/
Date Wed, 30 Oct 2013 11:29:21 GMT
Author: mduerig
Date: Wed Oct 30 11:29:20 2013
New Revision: 1537049

URL: http://svn.apache.org/r1537049
Log:
OAK-1111: Node#setProperty(String, Calendar) doesn't take time zone in account
Proper date conversion to ISO8601 format instead of to generic string representation

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/Conversions.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java?rev=1537049&r1=1537048&r2=1537049&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MultiPropertyState.java
Wed Oct 30 11:29:20 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import java.math.BigDecimal;
 import java.util.List;
 
@@ -31,8 +33,6 @@ import org.apache.jackrabbit.oak.api.Blo
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.value.Conversions.Converter;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 /**
  * Abstract base class for multi valued {@code PropertyState} implementations.
  */
@@ -92,7 +92,7 @@ abstract class MultiPropertyState<T> ext
                 return (S) Iterables.transform(values, new Function<T, String>() {
                     @Override
                     public String apply(T value) {
-                        return getConverter(value).toString();
+                        return getConverter(value).toDate();
                     }
                 });
             case PropertyType.BOOLEAN:

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java?rev=1537049&r1=1537048&r2=1537049&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/SinglePropertyState.java
Wed Oct 30 11:29:20 2013
@@ -18,15 +18,15 @@
  */
 package org.apache.jackrabbit.oak.plugins.memory;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Collections.singleton;
+
 import javax.annotation.Nonnull;
 import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.value.Conversions.Converter;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.util.Collections.singleton;
-
 /**
  * Abstract base class for single valued {@code PropertyState} implementations.
  */
@@ -61,7 +61,7 @@ abstract class SinglePropertyState<T> ex
             case PropertyType.BINARY: return (S) getConverter().toBinary();
             case PropertyType.LONG: return (S) (Long) getConverter().toLong();
             case PropertyType.DOUBLE: return (S) (Double) getConverter().toDouble();
-            case PropertyType.DATE: return (S) getConverter().toString();
+            case PropertyType.DATE: return (S) getConverter().toDate();
             case PropertyType.BOOLEAN: return (S) (Boolean) getConverter().toBoolean();
             case PropertyType.NAME: return (S) getConverter().toString();
             case PropertyType.PATH: return (S) getConverter().toString();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/Conversions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/Conversions.java?rev=1537049&r1=1537048&r2=1537049&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/Conversions.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/Conversions.java
Wed Oct 30 11:29:20 2013
@@ -103,6 +103,16 @@ public final class Conversions {
         }
 
         /**
+         * Convert to date. This default implementation delegates to {@link #toCalendar()}
+         * and returns the {@code ISO8601.format(Calendar)} value of the calendar.
+         * @return  date representation of the converted value
+         * @throws IllegalArgumentException  if the string cannot be parsed into a date
+         */
+        public String toDate() {
+            return ISO8601.format(toCalendar());
+        }
+
+        /**
          * Convert to boolean. This default implementation is based on {@code Boolean.parseBoolean(String)}.
          * @return  boolean representation of the converted value
          */

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1537049&r1=1537048&r2=1537049&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Wed Oct 30 11:29:20 2013
@@ -1154,7 +1154,6 @@ public class RepositoryTest extends Abst
     }
 
     @Test
-    @Ignore("OAK-1111")  // FIXME OAK-1111
     public void setPropertyWithConversion() throws RepositoryException {
         Node n = getNode(TEST_PATH);
         Node file = n.addNode("file", "nt:file");



Mime
View raw message