Remove unneeded null checks

These null checks are not needed since the variables were previously
dereferenced and if they were null a NullPointerException would have
occurred then.

Change-Id: Ied6a3b32b2580a0d95f74053a1867130780e208b
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-08-22 15:27:33 +02:00
parent 1d947bf77c
commit ad3e8bd921
4 changed files with 6 additions and 8 deletions

View File

@@ -280,7 +280,7 @@ public class PermissionEditor extends Composite implements Editor<Permission>,
validRange = null; validRange = null;
} }
if (value != null && Permission.OWNER.equals(value.getName())) { if (Permission.OWNER.equals(value.getName())) {
exclusiveGroup.setEnabled(false); exclusiveGroup.setEnabled(false);
} else { } else {
exclusiveGroup.setEnabled(!readOnly); exclusiveGroup.setEnabled(!readOnly);

View File

@@ -120,7 +120,7 @@ public class ProjectAccessEditor extends Composite implements
history.getStyle().setDisplay(Display.NONE); history.getStyle().setDisplay(Display.NONE);
} }
addSection.setVisible(value != null && editing && (!value.getOwnerOf().isEmpty() || value.canUpload())); addSection.setVisible(editing && (!value.getOwnerOf().isEmpty() || value.canUpload()));
} }
@Override @Override

View File

@@ -339,13 +339,11 @@ public class ChangeScreen extends Screen
patchesList.addItem(Util.C.baseDiffItem()); patchesList.addItem(Util.C.baseDiffItem());
} }
for (PatchSet pId : detail.getPatchSets()) { for (PatchSet pId : detail.getPatchSets()) {
if (patchesList != null) { patchesList.addItem(Util.M.patchSetHeader(pId.getPatchSetId()), pId
patchesList.addItem(Util.M.patchSetHeader(pId.getPatchSetId()), pId .getId().toString());
.getId().toString());
}
} }
if (diffBaseId != null && patchesList != null) { if (diffBaseId != null) {
patchesList.setSelectedIndex(diffBaseId.get()); patchesList.setSelectedIndex(diffBaseId.get());
} }

View File

@@ -418,7 +418,7 @@ public class ChangeUtil {
final GitReferenceUpdated gitRefUpdated, final ReviewDb db) final GitReferenceUpdated gitRefUpdated, final ReviewDb db)
throws NoSuchChangeException, OrmException, IOException { throws NoSuchChangeException, OrmException, IOException {
final PatchSet.Id patchSetId = patch.getId(); final PatchSet.Id patchSetId = patch.getId();
if (patch == null || !patch.isDraft()) { if (!patch.isDraft()) {
throw new NoSuchChangeException(patchSetId.getParentKey()); throw new NoSuchChangeException(patchSetId.getParentKey());
} }