Skip to content

Fixing AppException to get informative stack traces

Krishna Nikhil Vedurumudi requested to merge krveduru/appexception into master

Issue link - #37 (closed)

Fixes AppException stacktrace such that cause exception's stacktrace is captured in the logs

Stacktrace after applying the fix.

021-04-07 20:29:23.858 ERROR LAPTOP-TS9M1QFT --- [nio-8082-exec-2] o.o.o.a.l.Slf4JLogger                    correlation-id=56bbc5c2-19e8-4aef-a449-3c684d733326 data-partition-id=opendes: storage.app null {correlation-id=56bbc5c2-19e8-4aef-a449-3c684d733326, data-partition-id=opendes}
AppException(error=AppError(code=500, reason=Server error., message=An unknown error has occurred., errors=null, debuggingInfo=null, originalException=java.lang.NullPointerException), originalException=java.lang.NullPointerException)
	at org.opengroup.osdu.storage.util.GlobalOtherExceptionMapper.handleGeneralException(GlobalOtherExceptionMapper.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
Caused by: java.lang.NullPointerException
	at org.opengroup.osdu.storage.service.QueryServiceImpl.getRecordInfo(QueryServiceImpl.java:72)
	at org.opengroup.osdu.storage.api.RecordApi.getLatestRecordVersion(RecordApi.java:113)
	at org.opengroup.osdu.storage.api.RecordApi$$FastClassBySpringCGLIB$$495e8f0c.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
	... 100 more

Merge request reports