diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalExporter.java b/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalExporter.java index ad5eab0..e3ac800 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalExporter.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalExporter.java @@ -126,16 +126,14 @@ public class GeoportalExporter { if (userAgentName != null) { LOG.info("Serving request as User-Agent {}", userAgentName); final String pollingCode = ucdID + "_" + projectID + "_" + System.currentTimeMillis(); + final FetchPDF fetchPDF = new FetchPDF(null, pollingCode, 0); + map.put(pollingCode, fetchPDF); try { Thread t = new Thread() { @Override public void run() { LOG.info("exportAsPDF called in thread..."); - FileReference pdfRef = null; - FetchPDF fetchPDF = new FetchPDF(pdfRef, pollingCode, 0); - map.put(pollingCode, fetchPDF); - - pdfRef = exportAsPDF(req, ucdID, projectID, null, context, user); + FileReference pdfRef = exportAsPDF(req, ucdID, projectID, null, context, user); LOG.info("exportAsPDF setFileRef in thread for code: " + pollingCode); fetchPDF.setFileRef(pdfRef); map.put(pollingCode, fetchPDF);