Fix NPE when loading IntraLineDiff from disk cache
We failed to populate the list member, which resulted in the IntraLineDiff crashing with NPE when it was loaded from the disk cache after a graceful server restart. Change-Id: Iff5a49d8de26df6c89cb56e1086d35838e71e5b4 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -33,10 +33,10 @@ import java.util.List;
|
||||
public class IntraLineDiff implements Serializable {
|
||||
static final long serialVersionUID = IntraLineDiffKey.serialVersionUID;
|
||||
|
||||
private List<Edit> edits;
|
||||
private transient List<Edit> edits;
|
||||
|
||||
IntraLineDiff(List<Edit> edits) {
|
||||
this.edits = edits;
|
||||
this.edits = Collections.unmodifiableList(edits);
|
||||
}
|
||||
|
||||
public List<Edit> getEdits() {
|
||||
@@ -69,11 +69,13 @@ public class IntraLineDiff implements Serializable {
|
||||
int innerCount = readVarInt32(in);
|
||||
if (0 < innerCount) {
|
||||
Edit[] inner = new Edit[innerCount];
|
||||
for (int j = 0; j < innerCount; j++)
|
||||
for (int j = 0; j < innerCount; j++) {
|
||||
inner[j] = readEdit(in);
|
||||
}
|
||||
editArray[i] = new ReplaceEdit(editArray[i], toList(inner));
|
||||
}
|
||||
}
|
||||
edits = toList(editArray);
|
||||
}
|
||||
|
||||
private static void writeEdit(OutputStream out, Edit e) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user