diff --git a/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java b/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java index b24a530..f7f6e88 100644 --- a/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java +++ b/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java @@ -16,8 +16,12 @@ import org.openmrs.ui.framework.annotation.SpringBean; import org.openmrs.ui.framework.page.PageModel; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.WebRequest; public class ViewEncounterWithHtmlFormPageController { @@ -65,13 +69,10 @@ public void get(@RequestParam("encounter") Encounter encounter, model.addAttribute("showPatientHeader", showPatientHeader); HtmlForm htmlForm = htmlFormEntryService.getHtmlFormByForm(encounter.getForm()); -// HttpSession session = request.getSession(); + if (htmlForm == null) { -// HttpSession session = request.getSession(); message = messageSourceService.getMessage("encounter.form is not an HTML Form" +encounter.getForm()); - log.warn("Active drugs are not supported yet"); -// session.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, message); -// throw new IllegalArgumentException("encounter.form is not an HTML Form: " + encounter.getForm()); + log.warn("Active drugs are cannot be editted"); model.addAttribute("htmlForm", htmlForm); @@ -87,10 +88,11 @@ private String fixCase(String word) { return Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase(); } - @ExceptionHandler(value= NullPointerException.class) - public String HandleNullPointerException(Exception e) { - log.warn(message); + @ExceptionHandler(value= NullPointerException.class) + public String HandleNullPointerException(Exception e) { + log.warn("encounter.form is not an HTML Form"); return "NullPointerException"; - } + } + } diff --git a/omod/src/main/webapp/pages/htmlform/NullPointerException.gsp b/omod/src/main/webapp/pages/htmlform/NullPointerException.gsp index e69de29..647be80 100644 --- a/omod/src/main/webapp/pages/htmlform/NullPointerException.gsp +++ b/omod/src/main/webapp/pages/htmlform/NullPointerException.gsp @@ -0,0 +1,5 @@ + + + <% out << " ooppsss!!!! Active drugs cannot be edittted!" %> + + \ No newline at end of file