jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1727227 - /jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
Date Thu, 28 Jan 2016 00:41:55 GMT
Author: tripod
Date: Thu Jan 28 00:41:55 2016
New Revision: 1727227

URL: http://svn.apache.org/viewvc?rev=1727227&view=rev
Log:
JCRVLT-108 Import of binaries fail because they cannot be converted to strings

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java?rev=1727227&r1=1727226&r2=1727227&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
Thu Jan 28 00:41:55 2016
@@ -375,6 +375,7 @@ public class DocViewProperty {
             }
         }
         if (isMulti) {
+            // todo: handle multivalue binaries and reference binaries
             Value[] vs = prop == null ? null : prop.getValues();
             if (vs != null && vs.length == values.length) {
                 // quick check all values
@@ -397,10 +398,19 @@ public class DocViewProperty {
             return true;
         } else {
             Value v = prop == null ? null : prop.getValue();
-            if (type == PropertyType.BINARY && isRef) {
-                ReferenceBinary ref = new SimpleReferenceBinary(values[0]);
-                Binary binary = node.getSession().getValueFactory().createValue(ref).getBinary();
-                node.setProperty(name, binary);
+            if (type == PropertyType.BINARY) {
+                if (isRef) {
+                    ReferenceBinary ref = new SimpleReferenceBinary(values[0]);
+                    Binary binary = node.getSession().getValueFactory().createValue(ref).getBinary();
+                    if (v != null) {
+                        Binary bin = v.getBinary();
+                        if (bin.equals(binary)) {
+                            return false;
+                        }
+                    }
+                    node.setProperty(name, binary);
+                }
+                // the binary property is always modified (TODO: check if still correct with
JCRVLT-110)
                 return true;
             }
             if (v == null || !v.getString().equals(values[0])) {
@@ -419,4 +429,5 @@ public class DocViewProperty {
         }
         return false;
     }
+
 }
\ No newline at end of file



Mime
View raw message