From daf0ecfc9fe9cc66c5ca5f00a94f8803715bedb4 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 31 Jan 2018 10:21:45 +0100 Subject: [PATCH] BATCH-2491: use LinkedHashSet instead of HashSet for command line options Before this commit, options passed on the command line were collected in a HashSet. This does not keep options order as they are passed in the command line. This commit changes the "opts" variable type to LinkedHashSet. Note there is no test for this change as "opts" is a local variable to the main method. Resolves BATCH-2491 --- .../batch/core/launch/support/CommandLineJobRunner.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java index 17d65e251..3bcf735e9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2013 the original author or authors. + * Copyright 2006-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; @@ -158,6 +158,7 @@ import org.springframework.util.StringUtils; * * @author Dave Syer * @author Lucas Ward + * @author Mahmoud Ben Hassine * @since 1.0 */ public class CommandLineJobRunner { @@ -556,7 +557,7 @@ public class CommandLineJobRunner { } } - Set opts = new HashSet(); + Set opts = new LinkedHashSet(); List params = new ArrayList(); int count = 0;