Skip to content

Commit

Permalink
Merge pull request #2000 from mavrk/TRUNK-5039
Browse files Browse the repository at this point in the history
TRUNK-5039 Remove redundant null checks
  • Loading branch information
teleivo committed Feb 16, 2017
2 parents 163bb19 + b52c988 commit 69e4a4e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion api/src/main/java/org/openmrs/Cohort.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public void purgeMemberships(List<CohortMembership> cohortMembershipList) {


public int size() {
return getMembers() == null ? 0 : getMembers().size();
return getMembers().size();
}

public int getSize() {
Expand Down
18 changes: 4 additions & 14 deletions api/src/main/java/org/openmrs/Concept.java
Original file line number Diff line number Diff line change
Expand Up @@ -1241,15 +1241,9 @@ public void setDescriptions(Collection<ConceptDescription> descriptions) {
* @param description the description to add
*/
public void addDescription(ConceptDescription description) {
if (description != null && StringUtils.isNotBlank(description.getDescription())) {
if (getDescriptions() == null) {
descriptions = new HashSet<ConceptDescription>();
description.setConcept(this);
descriptions.add(description);
} else if (!descriptions.contains(description)) {
description.setConcept(this);
descriptions.add(description);
}
if (description != null && StringUtils.isNotBlank(description.getDescription()) && !descriptions.contains(description)) {
description.setConcept(this);
descriptions.add(description);
}
}

Expand All @@ -1261,11 +1255,7 @@ public void addDescription(ConceptDescription description) {
* @Should should remove description passed from list of descriptions
*/
public boolean removeDescription(ConceptDescription description) {
if (getDescriptions() != null) {
return descriptions.remove(description);
} else {
return false;
}
return descriptions.remove(description);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions api/src/main/java/org/openmrs/module/ModuleFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -1204,10 +1204,6 @@ public static List<Module> stopModule(Module mod, boolean skipOverStartedPropert
String extId = ext.getExtensionId();
try {
List<Extension> tmpExtensions = getExtensions(extId);
if (tmpExtensions == null) {
tmpExtensions = new Vector<Extension>();
}

tmpExtensions.remove(ext);
getExtensionMap().put(extId, tmpExtensions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1582,10 +1582,6 @@ public void executing(ChangeSet changeSet, int numChangeSetsToRun) {
InputStream inData = TestInstallUtil.getResourceInputStream(wizardModel.remoteUrl
+ RELEASE_TESTING_MODULE_PATH + "generateTestDataSet.form",
wizardModel.remoteUsername, wizardModel.remotePassword);
if (inData == null) {
reportError(ErrorMessageConstants.ERROR_DB_IMPORT_TEST_DATA, DEFAULT_PAGE, "");
return;
}

setCompletedPercentage(40);
setMessage("Loading imported test data...");
Expand All @@ -1602,10 +1598,6 @@ public void executing(ChangeSet changeSet, int numChangeSetsToRun) {
InputStream inModules = TestInstallUtil.getResourceInputStream(wizardModel.remoteUrl
+ RELEASE_TESTING_MODULE_PATH + "getModules.htm", wizardModel.remoteUsername,
wizardModel.remotePassword);
if (inModules == null) {
reportError(ErrorMessageConstants.ERROR_DB_UNABLE_TO_FETCH_MODULES, DEFAULT_PAGE, "");
return;
}

setCompletedPercentage(90);
setMessage("Adding imported modules...");
Expand Down

0 comments on commit 69e4a4e

Please sign in to comment.