From 12884ff0628395ce817c17224ccae9e5ff43ffb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Thu, 12 Oct 2023 08:52:54 +0200 Subject: [PATCH] Improved handling of CSW GetCapabilities errors in POST request to try GET request --- .../main/java/geocat/csw/csw/CSWEngine.java | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/services/csw-harvester/src/main/java/geocat/csw/csw/CSWEngine.java b/services/csw-harvester/src/main/java/geocat/csw/csw/CSWEngine.java index 59ebe2a..27b2e09 100644 --- a/services/csw-harvester/src/main/java/geocat/csw/csw/CSWEngine.java +++ b/services/csw-harvester/src/main/java/geocat/csw/csw/CSWEngine.java @@ -65,26 +65,50 @@ public static boolean isXML(String doc) { //---- public String GetCapabilities(String url) throws Exception { + String result; + try { - String result = GetCapabilitiesPOST(url); - if (!isXML(result)) { - throw new Exception("URL did not return XML!"); - } + result = tryGetCapabilities(url, true); + } catch (Exception ex) { + result = tryGetCapabilities(url, false); + } - if (result.contains("