{"action":"created","issue":{"url":"https://api.github.com/repos/52North/SOS/issues/176","labels_url":"https://api.github.com/repos/52North/SOS/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/52North/SOS/issues/176/comments","events_url":"https://api.github.com/repos/52North/SOS/issues/176/events","html_url":"https://github.com/52North/SOS/issues/176","id":59924240,"number":176,"title":"DeleteObservation throws NPE when deleting the latest observation for a series","user":{"login":"CarstenHollmann","id":4538033,"avatar_url":"https://avatars.githubusercontent.com/u/4538033?v=3","gravatar_id":"","url":"https://api.github.com/users/CarstenHollmann","html_url":"https://github.com/CarstenHollmann","followers_url":"https://api.github.com/users/CarstenHollmann/followers","following_url":"https://api.github.com/users/CarstenHollmann/following{/other_user}","gists_url":"https://api.github.com/users/CarstenHollmann/gists{/gist_id}","starred_url":"https://api.github.com/users/CarstenHollmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarstenHollmann/subscriptions","organizations_url":"https://api.github.com/users/CarstenHollmann/orgs","repos_url":"https://api.github.com/users/CarstenHollmann/repos","events_url":"https://api.github.com/users/CarstenHollmann/events{/privacy}","received_events_url":"https://api.github.com/users/CarstenHollmann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/52North/SOS/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"CarstenHollmann","id":4538033,"avatar_url":"https://avatars.githubusercontent.com/u/4538033?v=3","gravatar_id":"","url":"https://api.github.com/users/CarstenHollmann","html_url":"https://github.com/CarstenHollmann","followers_url":"https://api.github.com/users/CarstenHollmann/followers","following_url":"https://api.github.com/users/CarstenHollmann/following{/other_user}","gists_url":"https://api.github.com/users/CarstenHollmann/gists{/gist_id}","starred_url":"https://api.github.com/users/CarstenHollmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarstenHollmann/subscriptions","organizations_url":"https://api.github.com/users/CarstenHollmann/orgs","repos_url":"https://api.github.com/users/CarstenHollmann/repos","events_url":"https://api.github.com/users/CarstenHollmann/events{/privacy}","received_events_url":"https://api.github.com/users/CarstenHollmann/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/52North/SOS/milestones/2","html_url":"https://github.com/52North/SOS/milestones/4.2.0","labels_url":"https://api.github.com/repos/52North/SOS/milestones/2/labels","id":784702,"number":2,"title":"4.2.0","description":"","creator":{"login":"autermann","id":641308,"avatar_url":"https://avatars.githubusercontent.com/u/641308?v=3","gravatar_id":"","url":"https://api.github.com/users/autermann","html_url":"https://github.com/autermann","followers_url":"https://api.github.com/users/autermann/followers","following_url":"https://api.github.com/users/autermann/following{/other_user}","gists_url":"https://api.github.com/users/autermann/gists{/gist_id}","starred_url":"https://api.github.com/users/autermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autermann/subscriptions","organizations_url":"https://api.github.com/users/autermann/orgs","repos_url":"https://api.github.com/users/autermann/repos","events_url":"https://api.github.com/users/autermann/events{/privacy}","received_events_url":"https://api.github.com/users/autermann/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":10,"state":"open","created_at":"2014-09-10T10:32:16Z","updated_at":"2015-03-13T10:32:18Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-03-05T09:13:26Z","updated_at":"2015-03-13T10:32:43Z","closed_at":"2015-03-13T10:32:02Z","body":"If the series database concept is used, the DeleteObservation throws a NPE when deleting the latest observation of s series.\r\n\r\nHere is the stack trace of the NPE:\r\n```\r\njava.lang.NullPointerException\r\n\torg.n52.sos.ds.hibernate.dao.series.SeriesDAO.updateSeriesAfterObservationDeletion(SeriesDAO.java:430)\r\n\torg.n52.sos.ext.deleteobservation.DeleteObservationDAO.checkSeriesForFirstLatest(DeleteObservationDAO.java:130)\r\n\torg.n52.sos.ext.deleteobservation.DeleteObservationDAO.deleteObservation(DeleteObservationDAO.java:90)\r\n\torg.n52.sos.ext.deleteobservation.DeleteObservationRequestOperator.receive(DeleteObservationRequestOperator.java:62)\r\n\torg.n52.sos.ext.deleteobservation.DeleteObservationRequestOperator.receive(DeleteObservationRequestOperator.java:50)\r\n\torg.n52.sos.request.operator.AbstractRequestOperator.receiveRequest(AbstractRequestOperator.java:154)\r\n\torg.n52.sos.request.operator.AbstractTransactionalRequestOperator.receiveRequest(AbstractTransactionalRequestOperator.java:65)\r\n\torg.n52.sos.service.operator.AbstractServiceOperator.receiveRequest(AbstractServiceOperator.java:61)\r\n\torg.n52.sos.binding.KvpBinding.doGetOperation(KvpBinding.java:99)\r\n\torg.n52.sos.service.SosService.doGet(SosService.java:125)\r\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:618)\r\n\torg.n52.sos.service.ConfiguratedHttpServlet.service(ConfiguratedHttpServlet.java:53)\r\n\tjavax.servlet.http.HttpServlet.service(HttpServlet.java:725)\r\n\torg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\r\n\torg.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)\r\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)\r\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)\r\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)\r\n\torg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\r\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tcom.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:168)\r\n\tcom.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:233)\r\n```\r\nSolution:\r\nAdd check if requested observations (firstObservation, latestObservation) is not null in SeriesDAO.updateSeriesAfterObservationDeletion."},"comment":{"url":"https://api.github.com/repos/52North/SOS/issues/comments/78908069","html_url":"https://github.com/52North/SOS/issues/176#issuecomment-78908069","issue_url":"https://api.github.com/repos/52North/SOS/issues/176","id":78908069,"user":{"login":"autermann","id":641308,"avatar_url":"https://avatars.githubusercontent.com/u/641308?v=3","gravatar_id":"","url":"https://api.github.com/users/autermann","html_url":"https://github.com/autermann","followers_url":"https://api.github.com/users/autermann/followers","following_url":"https://api.github.com/users/autermann/following{/other_user}","gists_url":"https://api.github.com/users/autermann/gists{/gist_id}","starred_url":"https://api.github.com/users/autermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autermann/subscriptions","organizations_url":"https://api.github.com/users/autermann/orgs","repos_url":"https://api.github.com/users/autermann/repos","events_url":"https://api.github.com/users/autermann/events{/privacy}","received_events_url":"https://api.github.com/users/autermann/received_events","type":"User","site_admin":false},"created_at":"2015-03-13T10:32:43Z","updated_at":"2015-03-13T10:32:43Z","body":"Fixed in #184."}}