Details
-
New Feature
-
Status: Closed
-
Should
-
Resolution: Fixed
-
None
-
None
-
Low
Description
LocationServiceImpl.getDefaultLocation() contains duplicate logic to set a local Location variable to a location defined as a global properties. If the location is not found attempt is made to set it to "Unknown Location", and if that Location cant be found to "Unkown".
See the code sections:
https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/LocationServiceImpl.java#L118-L126
https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/impl/LocationServiceImpl.java#L128-L131
They might be extracted into a private methods so that it becomes
setLocationToGivenLocationOrDefault(result, location, "Unknown Location"); setLocationToGivenLocationOrDefault(result, location, "Unknown");
private void setLocationToGivenLocationOrDefault(Location result, String location, String defaultLocation)
also it might be more readable to
- rename the local variable that is returned to result