JCRVLT-108 Import of binaries fail because they cannot be converted to strings
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/commons/filevault/trunk@1727227 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
index 7cd1881..61d12e2 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/util/DocViewProperty.java
@@ -375,6 +375,7 @@
}
}
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 @@
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 @@
}
return false;
}
+
}
\ No newline at end of file