Fixed BOM case in check of properties files.
This commit is contained in:
parent
8af034256d
commit
1ec26ffec8
1 changed files with 10 additions and 1 deletions
|
@ -36,6 +36,8 @@ import fr.devinsy.strings.StringsUtils;
|
||||||
public class PropertyChecker
|
public class PropertyChecker
|
||||||
{
|
{
|
||||||
public static final String ALL = "^.*$";
|
public static final String ALL = "^.*$";
|
||||||
|
public static final String BOM = "\ufeff";
|
||||||
|
public static final String COMMENT = "^#.*$";
|
||||||
public static final String STRING = "^.+$";
|
public static final String STRING = "^.+$";
|
||||||
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
|
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
|
||||||
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
|
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
|
||||||
|
@ -227,6 +229,13 @@ public class PropertyChecker
|
||||||
|
|
||||||
result = new PropertyChecks();
|
result = new PropertyChecks();
|
||||||
|
|
||||||
|
//
|
||||||
|
if ((lines != null) && (!lines.isEmpty()) && (lines.get(0).startsWith(BOM)))
|
||||||
|
{
|
||||||
|
String line = lines.get(0).substring(1);
|
||||||
|
lines.set(0, line);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
PropertyRules requiredRules = rules.getMandatories();
|
PropertyRules requiredRules = rules.getMandatories();
|
||||||
requiredRules.addAll(rules.getWished());
|
requiredRules.addAll(rules.getWished());
|
||||||
|
@ -281,7 +290,7 @@ public class PropertyChecker
|
||||||
check = new PropertyCheck(lineIndex, "", Status.OK);
|
check = new PropertyCheck(lineIndex, "", Status.OK);
|
||||||
check.setComment("OK");
|
check.setComment("OK");
|
||||||
}
|
}
|
||||||
else if ((StringUtils.isEmpty(line)) || (line.matches("^#.*$")))
|
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
|
||||||
{
|
{
|
||||||
check = new PropertyCheck(lineIndex, line, Status.OK);
|
check = new PropertyCheck(lineIndex, line, Status.OK);
|
||||||
check.setComment("OK");
|
check.setComment("OK");
|
||||||
|
|
Loading…
Reference in a new issue