From 367203f4120b02456d9f43a36f1d80790552d5e1 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 13 Aug 2020 12:04:33 +0200 Subject: [PATCH] apply changes in https://code-repo.d4science.org/D-Net/dnet-hadoop/pulls/40#issuecomment-1822 --- .../oa/graph/dump/QueryInformationSystem.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java index 4c2182db5..d118accba 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java @@ -29,7 +29,7 @@ public class QueryInformationSystem { ""; public CommunityMap getCommunityMap() - throws ISLookUpException { + throws ISLookUpException, DocumentException { return getMap(isLookUp.quickSearchProfile(XQUERY)); } @@ -42,20 +42,15 @@ public class QueryInformationSystem { this.isLookUp = isLookUpService; } - private CommunityMap getMap(List communityMap) { + private CommunityMap getMap(List communityMap) throws DocumentException { final CommunityMap map = new CommunityMap(); - communityMap.stream().forEach(xml -> { + for (String xml : communityMap) { final Document doc; - try { - doc = new SAXReader().read(new StringReader(xml)); - Element root = doc.getRootElement(); - map.put(root.attribute("id").getValue(), root.attribute("label").getValue()); - } catch (DocumentException e) { - e.printStackTrace(); - } - - }); + doc = new SAXReader().read(new StringReader(xml)); + Element root = doc.getRootElement(); + map.put(root.attribute("id").getValue(), root.attribute("label").getValue()); + } return map; }