PatchSetInfoNotAvailableException, NoSuchChangeException {
if (control == null || patchSet == null) {
control = changeControlFactory.validateFor(psIdNew.getParentKey());
patchSet = db.patchSets().get(psIdNew);
if (patchSet == null) {
throw new NoSuchEntityException();
}
}
final PatchList list;
try {
if (psIdBase != null) {
oldId = toObjectId(psIdBase);
newId = toObjectId(psIdNew);
projectKey = control.getProject().getNameKey();
list = listFor(keyFor(diffPrefs.getIgnoreWhitespace()));
} else { // OK, means use base to compare
list = patchListCache.get(control.getChange(), patchSet);
}
} catch (PatchListNotAvailableException e) {
throw new NoSuchEntityException();
}
final List<Patch> patches = list.toPatchList(patchSet.getId());
final Map<Patch.Key, Patch> byKey = new HashMap<Patch.Key, Patch>();
for (final Patch p : patches) {