Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-621

GETting Non Existence Clobdata Resource Throws An Exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: 2.14
    • Fix Version/s: 2.17
    • Labels:
    • Complexity:
      Low

      Description

      Attempting to retrieve a non existence Clobdata throws an exception shown below

      <html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
      	org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9.ClobDatatypeStorageController.retrieve(ClobDatatypeStorageController.java:48)
      	sun.reflect.GeneratedMethodAccessor357.invoke(Unknown Source)
      	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	java.lang.reflect.Method.invoke(Method.java:597)
      	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)
      	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)
      	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)
      	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:61)
      	org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)
      	org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64)
      	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      	org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
      	org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:108)
      	org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
      	org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:73)
      	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      	org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)
      	org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)
      	org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:109)
      	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230)
      	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
      	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
      	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
      	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
      

      To reproduce
      Send the following REST request to openmrs server.

      GET ws/rest/v1/clobdata/non-existence-uuid
      

      Openmrs version: 1.11.5
      REST module: 2.14.dc38aa

      Acceptance Criteria

      1. When a client tries to GET a non-existent piece of clobdata, the HTTP response should be a 404 (and no exception should be thrown or logged)

      Dev Notes

      The fix is likely to be in this method:
      https://github.com/openmrs/openmrs-module-webservices.rest/blob/2.16/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/ClobDatatypeStorageController.java#L41

        Attachments

          Activity

            People

            Assignee:
            willa Willa Mhawila
            Reporter:
            willa Willa Mhawila
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: