Upgraded library jar files.

This commit is contained in:
Christian P. MOMON 2018-05-30 15:52:18 +02:00
parent 3aa35f9d7a
commit 561964cfbe
27 changed files with 35 additions and 100 deletions

View file

@ -3,18 +3,17 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/> <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar" sourcepath="lib/commons-lang3-3.1-sources.jar"/>
<classpathentry kind="lib" path="lib/joda-time-2.3.jar" sourcepath="lib/joda-time-2.3-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.0.jar" sourcepath="lib/devinsy-strings-0.4.0-sources.zip"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar" sourcepath="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar" sourcepath="lib/UnitTesting/junit-4.11-sources.jar"/> <classpathentry kind="lib" path="lib/commons-lang3-3.7.jar" sourcepath="lib/commons-lang3-3.7-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/devinsy-strings-0.8.1.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,8 +1,13 @@
Description of used libraries: Description of used libraries:
- commons-lang: useful tools (StringUtils...)
- hamcrest-core: required by junit Standards:
- joda-time: useful DateTime library - commons-lang: useful tools (StringUtils…)
Testing:
- hamcrest-core: required by JUnit
- junit: unit tests API - junit: unit tests API
Logging:
- log4j: log API - log4j: log API
- slf4j-api: facade log API - slf4j-api: facade log API
- slf4j-log4j12: adaptation layer between slf4j and log4j - slf4j-log4j12: adaptation layer between slf4j and log4j

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-lang3-3.7.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -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. * This file is part of Devinsy-cmdexec.
* *
@ -21,9 +21,9 @@ package fr.devinsy.util.cmdexec;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringsUtils;
import fr.devinsy.util.cmdexec.StreamGobbler.StreamWay; import fr.devinsy.util.cmdexec.StreamGobbler.StreamWay;
import fr.devinsy.util.cmdexec.util.CommandSplitter; import fr.devinsy.util.cmdexec.util.CommandSplitter;
import fr.devinsy.util.strings.StringListUtils;
/** /**
* The Class CmdExec. * The Class CmdExec.
@ -251,8 +251,8 @@ public class CmdExec
{ {
int result; int result;
logger.info("CmdExec(command[]) = [" + StringListUtils.toStringSeparatedBy(command, " ") + "]"); logger.info("CmdExec(command[]) = [" + StringsUtils.toStringSeparatedBy(command, " ") + "]");
logger.info("CmdExec(command[]) = [" + StringListUtils.toStringWithBrackets(command) + "]"); logger.info("CmdExec(command[]) = [" + StringsUtils.toStringWithBrackets(command) + "]");
try try
{ {

View file

@ -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. * This file is part of Devinsy-cmdexec.
* *
@ -20,11 +20,12 @@ package fr.devinsy.util.cmdexec;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringsUtils;
import fr.devinsy.util.cmdexec.util.CommandSplitter; import fr.devinsy.util.cmdexec.util.CommandSplitter;
import fr.devinsy.util.strings.StringListUtils;
/** /**
* The Class CmdExecUtils * The Class CmdExecUtils
@ -149,8 +150,8 @@ public class CmdExecUtils
} }
else else
{ {
logger.error("Command=\"{}\"", StringListUtils.toStringWithBrackets(command)); logger.error("Command=\"{}\"", StringsUtils.toStringWithBrackets(command));
logger.error("\tout => [{}]", StringListUtils.toString(command), cmd.getOutStream()); logger.error("\tout => [{}]", StringsUtils.toString(command), cmd.getOutStream());
logger.error("\terr => ({})[{}]", cmd.getErrStream().length(), cmd.getErrStream()); logger.error("\terr => ({})[{}]", cmd.getErrStream().length(), cmd.getErrStream());
throw new CmdExecException(cmd.getErrStream()); throw new CmdExecException(cmd.getErrStream());
} }
@ -173,44 +174,14 @@ public class CmdExecUtils
* the program 2 * the program 2
* @param args * @param args
* the args * the args
* @param min
* the min
* @param max
* the max
* @return the string * @return the string
* @throws CmdExecException * @throws CmdExecException
* the cmd exec exception * 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; 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) if (program1 == null)
{ {
throw new IllegalArgumentException("Null program parameter 1 detected: [" + program1 + "]."); 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 + "]."); 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) + "."); throw new IllegalArgumentException("Null parameter detected in " + StringsUtils.toStringWithBrackets(args) + ".");
}
else if ((args.length < min) || (args.length > max))
{
throw new IllegalArgumentException("Bad number of parameters: " + args.length + " for " + StringListUtils.toStringWithBrackets(args) + ".");
} }
else else
{ {
//
String[] command = new String[args.length + 2]; String[] command = new String[args.length + 2];
command[0] = program1; command[0] = program1;
command[1] = program2; command[1] = program2;
for (argumentIndex = 0; argumentIndex < args.length; argumentIndex++) for (int argumentIndex = 0; argumentIndex < args.length; argumentIndex++)
{ {
command[argumentIndex + 2] = args[argumentIndex]; command[argumentIndex + 2] = args[argumentIndex];
} }
@ -256,62 +222,27 @@ public class CmdExecUtils
* the program * the program
* @param args * @param args
* the args * the args
* @param min
* the min
* @param max
* the max
* @return the string * @return the string
* @throws CmdExecException * @throws CmdExecException
* the cmd exec exception * 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; 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) if (program == null)
{ {
throw new IllegalArgumentException("Null program parameter detected: [" + program + "]."); 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) + "."); throw new IllegalArgumentException("Null parameter detected in " + StringsUtils.toStringWithBrackets(args) + ".");
}
else if ((args.length < min) || (args.length > max))
{
throw new IllegalArgumentException("Bad number of parameters: " + args.length + " for " + StringListUtils.toStringWithBrackets(args) + ".");
} }
else else
{ {
//
String[] command = new String[args.length + 1]; String[] command = new String[args.length + 1];
command[0] = program; command[0] = program;
for (argumentCounter = 0; argumentCounter < args.length; argumentCounter++) for (int argumentCounter = 0; argumentCounter < args.length; argumentCounter++)
{ {
command[argumentCounter + 1] = args[argumentCounter]; command[argumentCounter + 1] = args[argumentCounter];
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 Christian Pierre MOMON * Copyright (C) 2017-2018 Christian Pierre MOMON
* *
* This file is part of Devinsy-cmdexec. * This file is part of Devinsy-cmdexec.
* *

View file

@ -22,7 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class SplitWorker. * The Class SplitWorker.

View file

@ -26,7 +26,7 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class SplitWorkerTest. * The Class SplitWorkerTest.