ref #10205: fixing parseOriginalDataSetUri
authorKatja Luther <k.luther@bgbm.org>
Thu, 19 Jan 2023 12:34:00 +0000 (13:34 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 19 Jan 2023 13:00:33 +0000 (14:00 +0100)
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifJsonOccurrenceParser.java

index 3aeaf280611bc346f0abc5d867b5ecd87b1171cc..618ab0eaa27ecd7345a5608826d083ed1fe21f1b 100644 (file)
@@ -514,12 +514,18 @@ public class GbifJsonOccurrenceParser {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-        if (neoJsonNode != null) {
-            if(neoJsonNode.has(URL)){
-                response.setEndpoint(URI.create(neoJsonNode.get(URL).textValue()));
-            }
-            if(neoJsonNode.has(TYPE)){
-                response.setProtocol(GbifDataSetProtocol.parseProtocol(neoJsonNode.get(TYPE).textValue()));
+
+        if (neoJsonNode != null && neoJsonNode.isArray()) {
+            for(Object o:neoJsonNode){
+                if (o instanceof ObjectNode) {
+                    ObjectNode node = (ObjectNode)o;
+                    if(node.has(URL)){
+                        response.setEndpoint(URI.create(node.get(URL).textValue()));
+                    }
+                    if(node.has(TYPE)){
+                        response.setProtocol(GbifDataSetProtocol.parseProtocol(node.get(TYPE).textValue()));
+                    }
+                }
             }
         }
         return response;