diff --git a/build.sh b/build.sh index 04c308a..69a8dab 100755 --- a/build.sh +++ b/build.sh @@ -41,7 +41,7 @@ function build_snapshot # Java version check. javaVersionCheck=`javac -version 2>&1` - if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then + if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then echo "Java 11 version requirement..... OK" let "okCount+=1" else @@ -83,7 +83,7 @@ function build_local # Java version check. javaVersionCheck=`javac -version 2>&1` - if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then + if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then echo "Java 11 version requirement..... OK" let "okCount+=1" else @@ -125,7 +125,7 @@ function build_tagandpush # Java version check. javaVersionCheck=`javac -version 2>&1` - if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then + if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then echo "Java 11 version requirement..... OK" let "okCount+=1" else diff --git a/src/fr/devinsy/statoolinfos/core/PathPropertyUtils.java b/src/fr/devinsy/statoolinfos/core/PathPropertyUtils.java index 969548d..aef6380 100644 --- a/src/fr/devinsy/statoolinfos/core/PathPropertyUtils.java +++ b/src/fr/devinsy/statoolinfos/core/PathPropertyUtils.java @@ -41,297 +41,297 @@ import fr.devinsy.strings.StringsUtils; */ 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. - * - * @param line - * the line - * @return true, if is property line - */ - public static boolean isPropertyLine(final String line) - { - boolean result; + /** + * Checks if is property line. + * + * @param line + * the line + * @return true, if is property line + */ + public static boolean isPropertyLine(final String line) + { + boolean result; - if (StringUtils.isAllBlank(line)) - { - result = false; - } - else - { - result = line.matches("^[^#].*[^\s].*=.*$"); - } + if (StringUtils.isAllBlank(line)) + { + result = false; + } + else + { + result = line.matches("^[^#].*[^\s].*=.*$"); + } - // - return result; - } + // + return result; + } - /** - * Load. - * - * @param source - * the source - * @return the path properties - * @throws IOException - */ - public static PathPropertyList load(final File file) throws IOException - { - PathPropertyList result; + /** + * Load. + * + * @param source + * the source + * @return the path properties + * @throws IOException + */ + public static PathPropertyList load(final File file) throws IOException + { + PathPropertyList result; - result = load(file, DEFAULT_CHARSET_NAME); + result = load(file, DEFAULT_CHARSET_NAME); - // - return result; - } + // + return result; + } - /** - * Load. - * - * @param file - * the file - * @param charsetName - * the charset name - * @return the path properties - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static PathPropertyList load(final File file, final String charsetName) throws IOException - { - PathPropertyList result; + /** + * Load. + * + * @param file + * the file + * @param charsetName + * the charset name + * @return the path properties + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static PathPropertyList load(final File file, final String charsetName) throws IOException + { + PathPropertyList result; - result = new PathPropertyList(); + result = new PathPropertyList(); - BufferedReader in = null; - try - { - in = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName)); - result = read(in); - } - finally - { - IOUtils.closeQuietly(in); - } + BufferedReader in = null; + try + { + in = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName)); + result = read(in); + } + finally + { + IOUtils.closeQuietly(in); + } - // - return result; - } + // + return result; + } - /** - * Load. - * - * @param url - * the url - * @return the path property list - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static PathPropertyList load(final URL url) throws IOException - { - PathPropertyList result; + /** + * Load. + * + * @param url + * the url + * @return the path property list + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static PathPropertyList load(final URL url) throws IOException + { + PathPropertyList result; - StringList lines = StringsUtils.load(url); + StringList lines = StringsUtils.load(url); - result = read(lines); + result = read(lines); - // - return result; - } + // + return result; + } - /** - * @param in - * @return - * @throws IOException - */ - public static PathPropertyList read(final BufferedReader in) throws IOException - { - PathPropertyList result; + /** + * @param in + * @return + * @throws IOException + */ + public static PathPropertyList read(final BufferedReader in) throws IOException + { + PathPropertyList result; - result = new PathPropertyList(); + result = new PathPropertyList(); - boolean ended = false; - while (!ended) - { - PathProperty property = readPathProperty(in); + boolean ended = false; + while (!ended) + { + PathProperty property = readPathProperty(in); - if (property == null) - { - ended = true; - } - else - { - result.add(property); - } - } + if (property == null) + { + ended = true; + } + else + { + result.add(property); + } + } - // - return result; - } + // + return result; + } - /** - * Load. - * - * @param url - * the url - * @return the path property list - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static PathPropertyList read(final StringList source) throws IOException - { - PathPropertyList result; + /** + * Load. + * + * @param url + * the url + * @return the path property list + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static PathPropertyList read(final StringList source) throws IOException + { + PathPropertyList result; - result = new PathPropertyList(); + result = new PathPropertyList(); - for (String line : source) - { - if (isPropertyLine(line)) - { - PathProperty property = valueOf(line); + for (String line : source) + { + if (isPropertyLine(line)) + { + PathProperty property = valueOf(line); - result.add(property); - } - } + result.add(property); + } + } - // - return result; - } + // + return result; + } - /** - * Read not empty line. - * - * @param in - * the in - * @return the string - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static String readActiveLine(final BufferedReader in) throws IOException - { - String result; + /** + * Read not empty line. + * + * @param in + * the in + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static String readActiveLine(final BufferedReader in) throws IOException + { + String result; - boolean ended = false; - result = null; - while (!ended) - { - String line = in.readLine(); + boolean ended = false; + result = null; + while (!ended) + { + String line = in.readLine(); - if (line == null) - { - ended = true; - result = null; - } - else if ((StringUtils.isNotBlank(line)) && (!line.startsWith("#"))) - { - ended = true; - result = line; - } - } + if (line == null) + { + ended = true; + result = null; + } + else if ((StringUtils.isNotBlank(line)) && (!line.startsWith("#"))) + { + ended = true; + result = line; + } + } - // - return result; - } + // + return result; + } - /** - * Read path property. - * - * @param in - * the in - * @return the path property - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static PathProperty readPathProperty(final BufferedReader in) throws IOException - { - PathProperty result; + /** + * Read path property. + * + * @param in + * the in + * @return the path property + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static PathProperty readPathProperty(final BufferedReader in) throws IOException + { + PathProperty result; - String line = readActiveLine(in); + String line = readActiveLine(in); - if (line == null) - { - result = null; - } - else - { - result = valueOf(line); - } + if (line == null) + { + result = null; + } + else + { + result = valueOf(line); + } - // - return result; - } + // + return result; + } - /** - * Save. - * - * @param file - * the file - * @param source - * the source - * @throws IOException - * Signals that an I/O exception has occurred. - */ - public static void save(final File file, final PathPropertyList source) throws IOException - { - PrintWriter out = null; - try - { - out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); - write(out, source); - } - finally - { - // - IOUtils.closeQuietly(out); - } - } + /** + * Save. + * + * @param file + * the file + * @param source + * the source + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static void save(final File file, final PathPropertyList source) throws IOException + { + PrintWriter out = null; + try + { + out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); + write(out, source); + } + finally + { + // + IOUtils.closeQuietly(out); + } + } - /** - * Value of. - * - * @param line - * the line - * @return the path property - */ - public static PathProperty valueOf(final String line) - { - PathProperty result; + /** + * Value of. + * + * @param line + * the line + * @return the path property + */ + public static PathProperty valueOf(final String line) + { + PathProperty result; - if (line == null) - { - result = null; - } - else - { - String[] tokens = line.split("=", 2); - result = new PathProperty(tokens[0].trim(), tokens[1].trim()); - } + if (line == null) + { + result = null; + } + else + { + String[] tokens = line.split("=", 2); + result = new PathProperty(tokens[0].trim(), tokens[1].trim()); + } - // - return result; - } + // + return result; + } - /** - * Write. - * - * @param out - * the out - * @param source - * the source - * @throws IOException - */ - public static void write(final PrintWriter out, final PathPropertyList source) throws IOException - { - if (source != null) - { - StringList lines = source.toStringListFormatted(); + /** + * Write. + * + * @param out + * the out + * @param source + * the source + * @throws IOException + */ + public static void write(final PrintWriter out, final PathPropertyList source) throws IOException + { + if (source != null) + { + StringList lines = source.toStringListFormatted(); - for (String string : lines) - { - out.write(string); - out.write("\n"); - } - } - } + for (String string : lines) + { + out.write(string); + out.write("\n"); + } + } + } }