Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRM-28: Map Location Page Crashes when DHIS2 Instance has no ORG Units #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ public void showConfigForm(ModelMap model, WebRequest webRequest) {

@RequestMapping(value = "/module/dhisreport/mapLocations", method = RequestMethod.POST)
public String mapLocations(ModelMap model,
@RequestParam(value = "DHIS2OrgUnits", required = true) String dhis2OrgUnitCode,
@RequestParam(value = "DHIS2OrgUnits", required = false) String dhis2OrgUnitCode,
@RequestParam(value = "openmrsLocations", required = true) String openmrsLocationName,
WebRequest webRequest) {
System.out.println("org unit does not exits and it is : " + dhis2OrgUnitCode);
String referer = webRequest.getHeader("Referer");

if (dhis2OrgUnitCode.equals("")) {
if (dhis2OrgUnitCode == null || dhis2OrgUnitCode.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gitcliff , can you take a look at the java convestions here https://wiki.openmrs.org/display/docs/Java+Conventions.

dhis2OrgUnitCode == null || dhis2OrgUnitCode.isEmpty() , this is discouraged. instead take use of the apache commons string utils library

System.out.println("org unit does not exits");
webRequest.setAttribute(WebConstants.OPENMRS_MSG_ATTR,
Context.getMessageSourceService().getMessage("dhisreport.orgUnitCodeDoesNotExist"),
Expand Down
2 changes: 1 addition & 1 deletion omod/src/main/webapp/mapLocations.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</table>
</form>

<tr>


<h3>
<spring:message code="dhisreport.mappedLocations" />
Expand Down