From 89a8e533b27de4a90711f440e80c2d34c0f8a7e9 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Tue, 2 Mar 2021 00:15:46 +0100 Subject: [PATCH] Fixed issue with missing prev --- .../human_task_distributor/HumanTaskDistributor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/nl/andrewlalis/human_task_distributor/HumanTaskDistributor.java b/src/main/java/nl/andrewlalis/human_task_distributor/HumanTaskDistributor.java index 0e06ba0..63021e1 100644 --- a/src/main/java/nl/andrewlalis/human_task_distributor/HumanTaskDistributor.java +++ b/src/main/java/nl/andrewlalis/human_task_distributor/HumanTaskDistributor.java @@ -7,10 +7,7 @@ import org.apache.commons.csv.CSVPrinter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; public class HumanTaskDistributor { @@ -24,7 +21,9 @@ public class HumanTaskDistributor { FileParser fileParser = new FileParser(); Map nameWeightMap = fileParser.parseHumanList(cmd.getOptionValue("hl")); Set tasks = fileParser.parseTaskList(cmd.getOptionValue("tl")); - List>> previousDistributions = fileParser.parsePreviousTaskDistributions(cmd.getOptionValues("prev")); + String[] previousDistributionPaths = cmd.getOptionValues("prev"); + if (previousDistributionPaths == null) previousDistributionPaths = new String[0]; + List>> previousDistributions = fileParser.parsePreviousTaskDistributions(previousDistributionPaths); long start = System.currentTimeMillis(); Map> taskDistributions = new Distributor().generateDistribution(nameWeightMap, tasks, previousDistributions); @@ -53,6 +52,7 @@ public class HumanTaskDistributor { } catch (Exception e) { System.err.println("Error: " + e.getMessage()); + e.printStackTrace(); HelpFormatter hf = new HelpFormatter(); hf.printHelp("HumanTaskDistributor", options); System.exit(1);