summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-10-26 15:09:13 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-10-26 15:09:13 +0200
commitad7099d4eb77eecbe41f59600652006105b5d4af (patch)
tree36241f4dc9c87f64abc72bc5a1028724dcd25f4b
parent9d465cf7fc27963717bc1006b1178839f822124d (diff)
Follow up code comments from @vekterli
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentUpdate.java14
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java1
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java1
3 files changed, 6 insertions, 10 deletions
diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
index 54ced1321a0..535a3bc9a9a 100644
--- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java
+++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
@@ -279,9 +279,8 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
/**
* Assigns the field updates of this document update.
- * This document update receives ownership of the list - it can not be subsequently used
- * by the caller. Also note that there no assumptions can be made on the order of items
- * after this call. They might have been joined if for the same field or reordered.
+ * Also note that no assumptions can be made on the order of item after this call.
+ * They might have been joined if for the same field or reordered.
*
* @param fieldUpdates the new list of updates of this
* @throws NullPointerException if the argument passed is null
@@ -378,9 +377,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
*/
@Deprecated
public FieldUpdate removeFieldUpdate(int index) {
- FieldUpdate prev = getFieldUpdate(index);
- fieldUpdates.remove(index);
- return removeFieldUpdate(prev.getField());
+ return fieldUpdates.remove(index);
}
public FieldUpdate removeFieldUpdate(Field field) {
@@ -391,7 +388,8 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
return fieldUpdate;
}
}
- return null; }
+ return null;
+ }
public FieldUpdate removeFieldUpdate(String fieldName) {
Field field = documentType.getField(fieldName);
@@ -448,7 +446,7 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
string.append(docId);
string.append("': ");
string.append("create-if-non-existent=");
- string.append(createIfNonExistent);
+ string.append(getCreateIfNonExistent());
string.append(": ");
string.append("[");
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
index 3f885844987..f4c40980608 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
@@ -471,7 +471,6 @@ public class VespaDocumentDeserializer42 extends VespaDocumentSerializer42 imple
int size = getInt(null);
for (int i = 0; i < size; i++) {
- // TODO: Should use checked method, but doesn't work according to test now.
update.addFieldUpdate(new FieldUpdate(this, update.getDocumentType(), serializationVersion));
}
}
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java
index 4f8a26d3777..44a1ca6e749 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializerHead.java
@@ -28,7 +28,6 @@ public class VespaDocumentDeserializerHead extends VespaDocumentDeserializer42 {
int size = getInt(null);
for (int i = 0; i < size; i++) {
- // TODO: Should use checked method, but doesn't work according to test now.
update.addFieldUpdate(new FieldUpdate(this, update.getDocumentType(), 8));
}