From e73ec208033a6ade5266a5a87930c5d2a4b9fc98 Mon Sep 17 00:00:00 2001 From: Zied <26070035+zguesmi@users.noreply.github.com> Date: Mon, 17 May 2021 16:28:26 +0200 Subject: [PATCH] Add requested changes --- .../com/iexec/common/task/TaskDescription.java | 3 ++- .../java/com/iexec/common/utils/IexecEnvUtils.java | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/iexec/common/task/TaskDescription.java b/src/main/java/com/iexec/common/task/TaskDescription.java index 1cdaef6f..38a73cbd 100644 --- a/src/main/java/com/iexec/common/task/TaskDescription.java +++ b/src/main/java/com/iexec/common/task/TaskDescription.java @@ -73,6 +73,7 @@ public class TaskDescription { */ public boolean containsDataset() { return !StringUtils.isEmpty(datasetAddress) && + !datasetAddress.equals(BytesUtils.EMPTY_ADDRESS) && !StringUtils.isEmpty(datasetUri) && !StringUtils.isEmpty(datasetChecksum) && !StringUtils.isEmpty(datasetName); @@ -84,7 +85,7 @@ public boolean containsDataset() { * @return true if a callback address is found in the deal, false otherwise. */ public boolean containsCallback() { - return getCallback() != null && + return StringUtils.isEmpty(getCallback()) && !getCallback().equals(BytesUtils.EMPTY_ADDRESS); } diff --git a/src/main/java/com/iexec/common/utils/IexecEnvUtils.java b/src/main/java/com/iexec/common/utils/IexecEnvUtils.java index 45ac9e56..6f58ab50 100644 --- a/src/main/java/com/iexec/common/utils/IexecEnvUtils.java +++ b/src/main/java/com/iexec/common/utils/IexecEnvUtils.java @@ -64,19 +64,19 @@ private IexecEnvUtils() { * @return */ public static Map getAllIexecEnv(TaskDescription taskDescription) { - Map map = new HashMap<>(); - map.putAll(getComputeStageEnvMap(taskDescription)); - map.put(IEXEC_DATASET_URL, taskDescription.getDatasetUri()); - map.put(IEXEC_DATASET_CHECKSUM, taskDescription.getDatasetChecksum()); + Map envMap = new HashMap<>(); + envMap.putAll(getComputeStageEnvMap(taskDescription)); + envMap.put(IEXEC_DATASET_URL, taskDescription.getDatasetUri()); + envMap.put(IEXEC_DATASET_CHECKSUM, taskDescription.getDatasetChecksum()); if (taskDescription.getInputFiles() == null) { - return map; + return envMap; } int index = 1; for (String inputFileUrl : taskDescription.getInputFiles()) { - map.put(IEXEC_INPUT_FILE_URL_PREFIX + index, inputFileUrl); + envMap.put(IEXEC_INPUT_FILE_URL_PREFIX + index, inputFileUrl); index++; } - return map; + return envMap; } /**