From b46b080ddcb41cb2a2d05d8a74f7ef87ff018a6b Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 17 Apr 2020 16:50:54 +0200 Subject: [PATCH] use mergeFrom method call to add the country(ies) instead of modify the result directly. --- .../countrypropagation/SparkCountryPropagationJob2.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-propagation/src/main/java/eu/dnetlib/dhp/countrypropagation/SparkCountryPropagationJob2.java b/dhp-workflows/dhp-propagation/src/main/java/eu/dnetlib/dhp/countrypropagation/SparkCountryPropagationJob2.java index 745a99db81..643373a1c0 100644 --- a/dhp-workflows/dhp-propagation/src/main/java/eu/dnetlib/dhp/countrypropagation/SparkCountryPropagationJob2.java +++ b/dhp-workflows/dhp-propagation/src/main/java/eu/dnetlib/dhp/countrypropagation/SparkCountryPropagationJob2.java @@ -135,12 +135,16 @@ public class SparkCountryPropagationJob2 { for (Qualifier country : r.getCountry()) { countries.add(country.getClassid()); } - + Result res = new Result(); + res.setId(r.getId()); + List countryList = new ArrayList<>(); for (CountrySbs country : potentialNewCountries.get().getCountrySet()) { if (!countries.contains(country.getClassid())) { - r.getCountry().add(getCountry(country.getClassid(), country.getClassname())); + countryList.add(getCountry(country.getClassid(), country.getClassname())); } } + res.setCountry(countryList); + r.mergeFrom(res); } return r; }, Encoders.bean(resultClazz));