diff --git a/dnet-ariadneplus/src/main/java/eu/dnetlib/ariadneplus/workflows/nodes/IndexOnESJobNode.java b/dnet-ariadneplus/src/main/java/eu/dnetlib/ariadneplus/workflows/nodes/IndexOnESJobNode.java index 5396ac3..74a0a3a 100644 --- a/dnet-ariadneplus/src/main/java/eu/dnetlib/ariadneplus/workflows/nodes/IndexOnESJobNode.java +++ b/dnet-ariadneplus/src/main/java/eu/dnetlib/ariadneplus/workflows/nodes/IndexOnESJobNode.java @@ -1,6 +1,8 @@ package eu.dnetlib.ariadneplus.workflows.nodes; import com.google.common.collect.Lists; +import com.google.gson.Gson; +import eu.dnetlib.enabling.resultset.ResultSetInfo; import eu.dnetlib.enabling.resultset.client.ResultSetClient; import eu.dnetlib.msro.workflows.graph.Arc; import eu.dnetlib.msro.workflows.nodes.AsyncJobNode; @@ -10,6 +12,7 @@ import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider; import eu.dnetlib.msro.workflows.util.WorkflowsConstants; import eu.dnetlib.rmi.common.ResultSet; import eu.dnetlib.rmi.manager.MSROException; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.NameValuePair; @@ -24,6 +27,7 @@ import org.apache.http.message.BasicNameValuePair; import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; +import java.io.InputStream; import java.net.ConnectException; import java.util.List; @@ -69,9 +73,8 @@ public class IndexOnESJobNode extends AsyncJobNode { log.info("Calling IndexOnES endpoint with params: "+getDatasource()+" "+getDatasourceInterface()); responsePOST = client.execute(post); statusCode = responsePOST.getStatusLine().getStatusCode(); - try { - log.info(responsePOST.toString()); - indexOnESResult = responsePOST.getEntity().getContent().toString(); + try(InputStream responseBody = responsePOST.getEntity().getContent()) { + indexOnESResult = IOUtils.toString(responseBody, "UTF-8"); } catch (Exception e) {} switch (statusCode) { case 200: @@ -98,7 +101,6 @@ public class IndexOnESJobNode extends AsyncJobNode { env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "statusCode", Integer.toString(statusCode)); env.setAttribute(WorkflowsConstants.MAIN_LOG_PREFIX + "indexResult", indexOnESResult); - log.info(indexOnESResult); if (statusCode!=200) { throw new MSROException("Error from Publisher endpoint [ status code: " + statusCode + " ]"); }