diff --git a/.classpath b/.classpath
index 437fba6..c249073 100644
--- a/.classpath
+++ b/.classpath
@@ -3,18 +3,17 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/lib/Logs/slf4j-api-1.7.25-sources.jar b/lib/Logs/slf4j-api-1.7.25-sources.jar
new file mode 100644
index 0000000..b2a3d83
Binary files /dev/null and b/lib/Logs/slf4j-api-1.7.25-sources.jar differ
diff --git a/lib/Logs/slf4j-api-1.7.25.jar b/lib/Logs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000..7e62f13
Binary files /dev/null and b/lib/Logs/slf4j-api-1.7.25.jar differ
diff --git a/lib/Logs/slf4j-api-1.7.5-sources.jar b/lib/Logs/slf4j-api-1.7.5-sources.jar
deleted file mode 100644
index 51abe2b..0000000
Binary files a/lib/Logs/slf4j-api-1.7.5-sources.jar and /dev/null differ
diff --git a/lib/Logs/slf4j-api-1.7.5.jar b/lib/Logs/slf4j-api-1.7.5.jar
deleted file mode 100644
index 8766455..0000000
Binary files a/lib/Logs/slf4j-api-1.7.5.jar and /dev/null differ
diff --git a/lib/Logs/slf4j-log4j12-1.7.25-sources.jar b/lib/Logs/slf4j-log4j12-1.7.25-sources.jar
new file mode 100644
index 0000000..0cd5be7
Binary files /dev/null and b/lib/Logs/slf4j-log4j12-1.7.25-sources.jar differ
diff --git a/lib/Logs/slf4j-log4j12-1.7.25.jar b/lib/Logs/slf4j-log4j12-1.7.25.jar
new file mode 100644
index 0000000..4a44e06
Binary files /dev/null and b/lib/Logs/slf4j-log4j12-1.7.25.jar differ
diff --git a/lib/Logs/slf4j-log4j12-1.7.5-sources.jar b/lib/Logs/slf4j-log4j12-1.7.5-sources.jar
deleted file mode 100644
index ea1b93b..0000000
Binary files a/lib/Logs/slf4j-log4j12-1.7.5-sources.jar and /dev/null differ
diff --git a/lib/Logs/slf4j-log4j12-1.7.5.jar b/lib/Logs/slf4j-log4j12-1.7.5.jar
deleted file mode 100644
index afce5c2..0000000
Binary files a/lib/Logs/slf4j-log4j12-1.7.5.jar and /dev/null differ
diff --git a/lib/README b/lib/README
index 26ec953..4e42a27 100644
--- a/lib/README
+++ b/lib/README
@@ -1,8 +1,13 @@
Description of used libraries:
-- commons-lang: useful tools (StringUtils...)
-- hamcrest-core: required by junit
-- joda-time: useful DateTime library
+
+Standards:
+- commons-lang: useful tools (StringUtils…)
+
+Testing:
+- hamcrest-core: required by JUnit
- junit: unit tests API
+
+Logging:
- log4j: log API
- slf4j-api: facade log API
- slf4j-log4j12: adaptation layer between slf4j and log4j
diff --git a/lib/UnitTesting/junit-4.11-sources.jar b/lib/UnitTesting/junit-4.11-sources.jar
deleted file mode 100644
index bab4cdd..0000000
Binary files a/lib/UnitTesting/junit-4.11-sources.jar and /dev/null differ
diff --git a/lib/UnitTesting/junit-4.11.jar b/lib/UnitTesting/junit-4.11.jar
deleted file mode 100644
index aaf7444..0000000
Binary files a/lib/UnitTesting/junit-4.11.jar and /dev/null differ
diff --git a/lib/UnitTesting/junit-4.12-sources.jar b/lib/UnitTesting/junit-4.12-sources.jar
new file mode 100644
index 0000000..884f92f
Binary files /dev/null and b/lib/UnitTesting/junit-4.12-sources.jar differ
diff --git a/lib/UnitTesting/junit-4.12.jar b/lib/UnitTesting/junit-4.12.jar
new file mode 100644
index 0000000..3a7fc26
Binary files /dev/null and b/lib/UnitTesting/junit-4.12.jar differ
diff --git a/lib/commons-lang3-3.1-sources.jar b/lib/commons-lang3-3.1-sources.jar
deleted file mode 100644
index 02cd2f2..0000000
Binary files a/lib/commons-lang3-3.1-sources.jar and /dev/null differ
diff --git a/lib/commons-lang3-3.1.jar b/lib/commons-lang3-3.1.jar
deleted file mode 100644
index a85e539..0000000
Binary files a/lib/commons-lang3-3.1.jar and /dev/null differ
diff --git a/lib/commons-lang3-3.7-sources.jar b/lib/commons-lang3-3.7-sources.jar
new file mode 100644
index 0000000..a83c661
Binary files /dev/null and b/lib/commons-lang3-3.7-sources.jar differ
diff --git a/lib/commons-lang3-3.7.jar b/lib/commons-lang3-3.7.jar
new file mode 100644
index 0000000..f37ded6
Binary files /dev/null and b/lib/commons-lang3-3.7.jar differ
diff --git a/lib/devinsy-strings-0.4.0-sources.zip b/lib/devinsy-strings-0.4.0-sources.zip
deleted file mode 100644
index 0ec9078..0000000
Binary files a/lib/devinsy-strings-0.4.0-sources.zip and /dev/null differ
diff --git a/lib/devinsy-strings-0.4.0.jar b/lib/devinsy-strings-0.4.0.jar
deleted file mode 100644
index 96018e1..0000000
Binary files a/lib/devinsy-strings-0.4.0.jar and /dev/null differ
diff --git a/lib/devinsy-strings-0.8.1-sources.zip b/lib/devinsy-strings-0.8.1-sources.zip
new file mode 100644
index 0000000..556da2c
Binary files /dev/null and b/lib/devinsy-strings-0.8.1-sources.zip differ
diff --git a/lib/devinsy-strings-0.8.1.jar b/lib/devinsy-strings-0.8.1.jar
new file mode 100644
index 0000000..b2983f8
Binary files /dev/null and b/lib/devinsy-strings-0.8.1.jar differ
diff --git a/src/fr/devinsy/util/cmdexec/CmdExec.java b/src/fr/devinsy/util/cmdexec/CmdExec.java
index 669c0ea..b412003 100644
--- a/src/fr/devinsy/util/cmdexec/CmdExec.java
+++ b/src/fr/devinsy/util/cmdexec/CmdExec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2010,2013,2015-2017 Christian Pierre MOMON
+ * Copyright (C) 2005-2010,2013,2015-2018 Christian Pierre MOMON
*
* This file is part of Devinsy-cmdexec.
*
@@ -21,9 +21,9 @@ package fr.devinsy.util.cmdexec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import fr.devinsy.strings.StringsUtils;
import fr.devinsy.util.cmdexec.StreamGobbler.StreamWay;
import fr.devinsy.util.cmdexec.util.CommandSplitter;
-import fr.devinsy.util.strings.StringListUtils;
/**
* The Class CmdExec.
@@ -251,8 +251,8 @@ public class CmdExec
{
int result;
- logger.info("CmdExec(command[]) = [" + StringListUtils.toStringSeparatedBy(command, " ") + "]");
- logger.info("CmdExec(command[]) = [" + StringListUtils.toStringWithBrackets(command) + "]");
+ logger.info("CmdExec(command[]) = [" + StringsUtils.toStringSeparatedBy(command, " ") + "]");
+ logger.info("CmdExec(command[]) = [" + StringsUtils.toStringWithBrackets(command) + "]");
try
{
diff --git a/src/fr/devinsy/util/cmdexec/CmdExecUtils.java b/src/fr/devinsy/util/cmdexec/CmdExecUtils.java
index b09a53e..5168a5c 100644
--- a/src/fr/devinsy/util/cmdexec/CmdExecUtils.java
+++ b/src/fr/devinsy/util/cmdexec/CmdExecUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2010,2013,2015-2017 Christian Pierre MOMON
+ * Copyright (C) 2005-2010,2013,2015-2018 Christian Pierre MOMON
*
* This file is part of Devinsy-cmdexec.
*
@@ -20,11 +20,12 @@ package fr.devinsy.util.cmdexec;
import java.util.ArrayList;
+import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import fr.devinsy.strings.StringsUtils;
import fr.devinsy.util.cmdexec.util.CommandSplitter;
-import fr.devinsy.util.strings.StringListUtils;
/**
* The Class CmdExecUtils
@@ -149,8 +150,8 @@ public class CmdExecUtils
}
else
{
- logger.error("Command=\"{}\"", StringListUtils.toStringWithBrackets(command));
- logger.error("\tout => [{}]", StringListUtils.toString(command), cmd.getOutStream());
+ logger.error("Command=\"{}\"", StringsUtils.toStringWithBrackets(command));
+ logger.error("\tout => [{}]", StringsUtils.toString(command), cmd.getOutStream());
logger.error("\terr => ({})[{}]", cmd.getErrStream().length(), cmd.getErrStream());
throw new CmdExecException(cmd.getErrStream());
}
@@ -173,44 +174,14 @@ public class CmdExecUtils
* the program 2
* @param args
* the args
- * @param min
- * the min
- * @param max
- * the max
* @return the string
* @throws CmdExecException
* the cmd exec exception
*/
- public static String run(final String program1, final String program2, final String[] args, final int min, final int max) throws CmdExecException
+ public static String run(final String program1, final String program2, final String[] args) throws CmdExecException
{
String result;
- //
- boolean nullArg = false;
- boolean ended = false;
- int argumentIndex = 0;
- while (!ended)
- {
- if (argumentIndex >= args.length)
- {
- ended = true;
- nullArg = false;
- }
- else
- {
- if (args[argumentIndex] == null)
- {
- ended = true;
- nullArg = true;
- }
- else
- {
- argumentIndex += 1;
- }
- }
- }
-
- //
if (program1 == null)
{
throw new IllegalArgumentException("Null program parameter 1 detected: [" + program1 + "].");
@@ -219,21 +190,16 @@ public class CmdExecUtils
{
throw new IllegalArgumentException("Null program parameter 2 detected: [" + program2 + "].");
}
- else if (nullArg)
+ else if (ArrayUtils.contains(args, null))
{
- throw new IllegalArgumentException("Null parameter detected in position " + argumentIndex + " for " + StringListUtils.toStringWithBrackets(args) + ".");
- }
- else if ((args.length < min) || (args.length > max))
- {
- throw new IllegalArgumentException("Bad number of parameters: " + args.length + " for " + StringListUtils.toStringWithBrackets(args) + ".");
+ throw new IllegalArgumentException("Null parameter detected in " + StringsUtils.toStringWithBrackets(args) + ".");
}
else
{
- //
String[] command = new String[args.length + 2];
command[0] = program1;
command[1] = program2;
- for (argumentIndex = 0; argumentIndex < args.length; argumentIndex++)
+ for (int argumentIndex = 0; argumentIndex < args.length; argumentIndex++)
{
command[argumentIndex + 2] = args[argumentIndex];
}
@@ -256,62 +222,27 @@ public class CmdExecUtils
* the program
* @param args
* the args
- * @param min
- * the min
- * @param max
- * the max
* @return the string
* @throws CmdExecException
* the cmd exec exception
*/
- public static String run(final String program, final String[] args, final int min, final int max) throws CmdExecException
+ public static String run(final String program, final String[] args) throws CmdExecException
{
String result;
- //
- boolean nullArg = false;
- boolean ended = false;
- int argumentCounter = 0;
- while (!ended)
- {
- if (argumentCounter >= args.length)
- {
- ended = true;
- nullArg = false;
- }
- else
- {
- if (args[argumentCounter] == null)
- {
- ended = true;
- nullArg = true;
- }
- else
- {
- argumentCounter += 1;
- }
- }
- }
-
- //
if (program == null)
{
throw new IllegalArgumentException("Null program parameter detected: [" + program + "].");
}
- else if (nullArg)
+ else if (ArrayUtils.contains(args, null))
{
- throw new IllegalArgumentException("Null parameter detected in position " + argumentCounter + " for " + StringListUtils.toStringWithBrackets(args) + ".");
- }
- else if ((args.length < min) || (args.length > max))
- {
- throw new IllegalArgumentException("Bad number of parameters: " + args.length + " for " + StringListUtils.toStringWithBrackets(args) + ".");
+ throw new IllegalArgumentException("Null parameter detected in " + StringsUtils.toStringWithBrackets(args) + ".");
}
else
{
- //
String[] command = new String[args.length + 1];
command[0] = program;
- for (argumentCounter = 0; argumentCounter < args.length; argumentCounter++)
+ for (int argumentCounter = 0; argumentCounter < args.length; argumentCounter++)
{
command[argumentCounter + 1] = args[argumentCounter];
}
diff --git a/src/fr/devinsy/util/cmdexec/demo/CmdExecDemo.java b/src/fr/devinsy/util/cmdexec/demo/CmdExecDemo.java
index 0ee6b70..b536faa 100644
--- a/src/fr/devinsy/util/cmdexec/demo/CmdExecDemo.java
+++ b/src/fr/devinsy/util/cmdexec/demo/CmdExecDemo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Christian Pierre MOMON
+ * Copyright (C) 2017-2018 Christian Pierre MOMON
*
* This file is part of Devinsy-cmdexec.
*
diff --git a/src/fr/devinsy/util/cmdexec/util/CommandSplitter.java b/src/fr/devinsy/util/cmdexec/util/CommandSplitter.java
index bac5b58..acc16aa 100644
--- a/src/fr/devinsy/util/cmdexec/util/CommandSplitter.java
+++ b/src/fr/devinsy/util/cmdexec/util/CommandSplitter.java
@@ -22,7 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import fr.devinsy.util.strings.StringList;
+import fr.devinsy.strings.StringList;
/**
* The Class SplitWorker.
diff --git a/test/fr/devinsy/util/cmdexec/util/CommandSplitterTest.java b/test/fr/devinsy/util/cmdexec/util/CommandSplitterTest.java
index 6128d1f..89be0d1 100644
--- a/test/fr/devinsy/util/cmdexec/util/CommandSplitterTest.java
+++ b/test/fr/devinsy/util/cmdexec/util/CommandSplitterTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import fr.devinsy.util.strings.StringList;
+import fr.devinsy.strings.StringList;
/**
* The Class SplitWorkerTest.