aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2018-12-12 11:34:13 +0100
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2018-12-12 11:34:13 +0100
commit4cabd51669c020c0ab20b79e9f5ebd1cade1983e (patch)
tree36ab37cec281e0480ed6b3a854b8c1d69587c8ed /node-repository
parent515a8af2497b94d6eaeb0eb7b2758786c3871c75 (diff)
Defensively copy what you expose, but trust your source
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java
index b82dae06007..a9cd14371d3 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/persistence/CuratorDatabase.java
@@ -163,11 +163,11 @@ public class CuratorDatabase {
}
/**
- * Returns the content of this child - which may be empty.
+ * Returns the a copy of the content of this child - which may be empty.
* Returns null only if it is not present in this state mirror
*/
public Optional<byte[]> getData(Path path) {
- return data.computeIfAbsent(path, key -> curator.getData(path).map(data -> Arrays.copyOf(data, data.length)));
+ return data.computeIfAbsent(path, key -> curator.getData(path)).map(data -> Arrays.copyOf(data, data.length));
}
}