Fixed Java 11 check.

This commit is contained in:
Christian P. MOMON 2020-09-13 02:09:15 +02:00
parent 91e0262c40
commit a33a9215df
2 changed files with 257 additions and 257 deletions

View file

@ -41,7 +41,7 @@ function build_snapshot
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
@ -83,7 +83,7 @@ function build_local
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else
@ -125,7 +125,7 @@ function build_tagandpush
# Java version check. # Java version check.
javaVersionCheck=`javac -version 2>&1` javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK" echo "Java 11 version requirement..... OK"
let "okCount+=1" let "okCount+=1"
else else

View file

@ -41,297 +41,297 @@ import fr.devinsy.strings.StringsUtils;
*/ */
public class PathPropertyUtils public class PathPropertyUtils
{ {
private static final Logger logger = LoggerFactory.getLogger(PathPropertyUtils.class); private static final Logger logger = LoggerFactory.getLogger(PathPropertyUtils.class);
public static final String DEFAULT_CHARSET_NAME = "UTF-8"; public static final String DEFAULT_CHARSET_NAME = "UTF-8";
/** /**
* Checks if is property line. * Checks if is property line.
* *
* @param line * @param line
* the line * the line
* @return true, if is property line * @return true, if is property line
*/ */
public static boolean isPropertyLine(final String line) public static boolean isPropertyLine(final String line)
{ {
boolean result; boolean result;
if (StringUtils.isAllBlank(line)) if (StringUtils.isAllBlank(line))
{ {
result = false; result = false;
} }
else else
{ {
result = line.matches("^[^#].*[^\s].*=.*$"); result = line.matches("^[^#].*[^\s].*=.*$");
} }
// //
return result; return result;
} }
/** /**
* Load. * Load.
* *
* @param source * @param source
* the source * the source
* @return the path properties * @return the path properties
* @throws IOException * @throws IOException
*/ */
public static PathPropertyList load(final File file) throws IOException public static PathPropertyList load(final File file) throws IOException
{ {
PathPropertyList result; PathPropertyList result;
result = load(file, DEFAULT_CHARSET_NAME); result = load(file, DEFAULT_CHARSET_NAME);
// //
return result; return result;
} }
/** /**
* Load. * Load.
* *
* @param file * @param file
* the file * the file
* @param charsetName * @param charsetName
* the charset name * the charset name
* @return the path properties * @return the path properties
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static PathPropertyList load(final File file, final String charsetName) throws IOException public static PathPropertyList load(final File file, final String charsetName) throws IOException
{ {
PathPropertyList result; PathPropertyList result;
result = new PathPropertyList(); result = new PathPropertyList();
BufferedReader in = null; BufferedReader in = null;
try try
{ {
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName)); in = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName));
result = read(in); result = read(in);
} }
finally finally
{ {
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
} }
// //
return result; return result;
} }
/** /**
* Load. * Load.
* *
* @param url * @param url
* the url * the url
* @return the path property list * @return the path property list
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static PathPropertyList load(final URL url) throws IOException public static PathPropertyList load(final URL url) throws IOException
{ {
PathPropertyList result; PathPropertyList result;
StringList lines = StringsUtils.load(url); StringList lines = StringsUtils.load(url);
result = read(lines); result = read(lines);
// //
return result; return result;
} }
/** /**
* @param in * @param in
* @return * @return
* @throws IOException * @throws IOException
*/ */
public static PathPropertyList read(final BufferedReader in) throws IOException public static PathPropertyList read(final BufferedReader in) throws IOException
{ {
PathPropertyList result; PathPropertyList result;
result = new PathPropertyList(); result = new PathPropertyList();
boolean ended = false; boolean ended = false;
while (!ended) while (!ended)
{ {
PathProperty property = readPathProperty(in); PathProperty property = readPathProperty(in);
if (property == null) if (property == null)
{ {
ended = true; ended = true;
} }
else else
{ {
result.add(property); result.add(property);
} }
} }
// //
return result; return result;
} }
/** /**
* Load. * Load.
* *
* @param url * @param url
* the url * the url
* @return the path property list * @return the path property list
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static PathPropertyList read(final StringList source) throws IOException public static PathPropertyList read(final StringList source) throws IOException
{ {
PathPropertyList result; PathPropertyList result;
result = new PathPropertyList(); result = new PathPropertyList();
for (String line : source) for (String line : source)
{ {
if (isPropertyLine(line)) if (isPropertyLine(line))
{ {
PathProperty property = valueOf(line); PathProperty property = valueOf(line);
result.add(property); result.add(property);
} }
} }
// //
return result; return result;
} }
/** /**
* Read not empty line. * Read not empty line.
* *
* @param in * @param in
* the in * the in
* @return the string * @return the string
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static String readActiveLine(final BufferedReader in) throws IOException public static String readActiveLine(final BufferedReader in) throws IOException
{ {
String result; String result;
boolean ended = false; boolean ended = false;
result = null; result = null;
while (!ended) while (!ended)
{ {
String line = in.readLine(); String line = in.readLine();
if (line == null) if (line == null)
{ {
ended = true; ended = true;
result = null; result = null;
} }
else if ((StringUtils.isNotBlank(line)) && (!line.startsWith("#"))) else if ((StringUtils.isNotBlank(line)) && (!line.startsWith("#")))
{ {
ended = true; ended = true;
result = line; result = line;
} }
} }
// //
return result; return result;
} }
/** /**
* Read path property. * Read path property.
* *
* @param in * @param in
* the in * the in
* @return the path property * @return the path property
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static PathProperty readPathProperty(final BufferedReader in) throws IOException public static PathProperty readPathProperty(final BufferedReader in) throws IOException
{ {
PathProperty result; PathProperty result;
String line = readActiveLine(in); String line = readActiveLine(in);
if (line == null) if (line == null)
{ {
result = null; result = null;
} }
else else
{ {
result = valueOf(line); result = valueOf(line);
} }
// //
return result; return result;
} }
/** /**
* Save. * Save.
* *
* @param file * @param file
* the file * the file
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static void save(final File file, final PathPropertyList source) throws IOException public static void save(final File file, final PathPropertyList source) throws IOException
{ {
PrintWriter out = null; PrintWriter out = null;
try try
{ {
out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
write(out, source); write(out, source);
} }
finally finally
{ {
// //
IOUtils.closeQuietly(out); IOUtils.closeQuietly(out);
} }
} }
/** /**
* Value of. * Value of.
* *
* @param line * @param line
* the line * the line
* @return the path property * @return the path property
*/ */
public static PathProperty valueOf(final String line) public static PathProperty valueOf(final String line)
{ {
PathProperty result; PathProperty result;
if (line == null) if (line == null)
{ {
result = null; result = null;
} }
else else
{ {
String[] tokens = line.split("=", 2); String[] tokens = line.split("=", 2);
result = new PathProperty(tokens[0].trim(), tokens[1].trim()); result = new PathProperty(tokens[0].trim(), tokens[1].trim());
} }
// //
return result; return result;
} }
/** /**
* Write. * Write.
* *
* @param out * @param out
* the out * the out
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
*/ */
public static void write(final PrintWriter out, final PathPropertyList source) throws IOException public static void write(final PrintWriter out, final PathPropertyList source) throws IOException
{ {
if (source != null) if (source != null)
{ {
StringList lines = source.toStringListFormatted(); StringList lines = source.toStringListFormatted();
for (String string : lines) for (String string : lines)
{ {
out.write(string); out.write(string);
out.write("\n"); out.write("\n");
} }
} }
} }
} }