diff --git a/SAS/OTB/MoM-OTDB-adapter/src/nl/astron/lofar/odtb/mom2otdbadapter/mom2listener/Mom2HttpRequestHandler.java b/SAS/OTB/MoM-OTDB-adapter/src/nl/astron/lofar/odtb/mom2otdbadapter/mom2listener/Mom2HttpRequestHandler.java index 850c2695623745539917ef837294607163074879..cf04f45d35d57b1c156705fa306fdf84c844515c 100644 --- a/SAS/OTB/MoM-OTDB-adapter/src/nl/astron/lofar/odtb/mom2otdbadapter/mom2listener/Mom2HttpRequestHandler.java +++ b/SAS/OTB/MoM-OTDB-adapter/src/nl/astron/lofar/odtb/mom2otdbadapter/mom2listener/Mom2HttpRequestHandler.java @@ -66,23 +66,24 @@ public class Mom2HttpRequestHandler implements HttpRequestHandler { schemas.add(this.getClass().getClassLoader().getResource("schemas/MoM2.xsd")); schemas.add(this.getClass().getClassLoader().getResource("schemas/LofarMoM2.xsd")); document = XMLConverter.convertXMLToDocument(inputSource,schemas); + LofarObservation lofarObservation = XMLParser.getLofarObservation(document); + try { + repository.store(lofarObservation); + response.setStatusCode(HttpStatus.SC_OK); + requestHandledSuccessfull = true; + } catch (RepositoryException e) { + response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); + log.fatal("Problem occurred with OTDB: " + e.getMessage(), e); + } catch (Exception e) { + response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); + log.fatal("Problem occurred : " + e.getMessage(), e); + } + response.setStatusCode(HttpStatus.SC_OK); } catch (Exception e) { response.setStatusCode(HttpStatus.SC_BAD_REQUEST); log.error("Problem with parsing xml content: " + e.getMessage(), e); } - LofarObservation lofarObservation = XMLParser.getLofarObservation(document); - try { - repository.store(lofarObservation); - response.setStatusCode(HttpStatus.SC_OK); - requestHandledSuccessfull = true; - } catch (RepositoryException e) { - response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); - log.fatal("Problem occurred with OTDB: " + e.getMessage(), e); - } catch (Exception e) { - response.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); - log.fatal("Problem occurred : " + e.getMessage(), e); - } - response.setStatusCode(HttpStatus.SC_OK); + } } else {