gerrit/gerrit-reviewdb
Dave Borowitz a0f4942c5d ChangeNotes: Make defensive copies of mutable value types
ChangeNotesState stores immutable collections, but the actual
underlying ReviewDb types are frustratingly mutable. This means that
if a caller accidentally mutates an instance returned from the cache,
the cache can be polluted. In many cases this is mostly harmless,
since shortly after polluting the cache, the entry is rendered
obsolete by a NoteDb update. However, there are still cases where the
pollution can show up, for example if an exception is thrown from
PostReview after mutating an approval score.

Fix this by making more defensive copies in ChangeNotes. As a
compromise to avoid lots and lots of copies, only do this for types
that we expect to be mutable, namely PatchSet and PatchSetApproval.
Also don't worry about deep copying of ID types, which are technically
mutable but the Gerrit code never calls the setters for.

Change-Id: Iea647804b618422e1aade230fea5ebf6845198aa
2016-10-11 17:10:33 -04:00
..
src ChangeNotes: Make defensive copies of mutable value types 2016-10-11 17:10:33 -04:00
BUCK Update Buck to latest version 2016-09-20 13:19:15 +02:00
BUILD Implement Bazel build 2016-06-14 21:12:02 +02:00