mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
fixed NPE when string has no format
This commit is contained in:
@@ -133,6 +133,15 @@ public class Validator {
|
||||
validationMap.put(validation.getType(), validation);
|
||||
}
|
||||
|
||||
private void remove(String column, Validation.Type type) {
|
||||
Map<Validation.Type, Validation> validationMap = columnValidationMap.get(column);
|
||||
if (validationMap == null) {
|
||||
validationMap = new HashMap<>();
|
||||
columnValidationMap.put(column, validationMap);
|
||||
}
|
||||
validationMap.remove(type);
|
||||
}
|
||||
|
||||
private void clear(String column) {
|
||||
Map<Validation.Type, Validation> validationMap = columnValidationMap.get(column);
|
||||
if (validationMap != null) {
|
||||
@@ -186,6 +195,10 @@ public class Validator {
|
||||
add(column.getName(), new DateValidation(format));
|
||||
}
|
||||
|
||||
if (column.getType() == STRING && column.getFormat() == null) {
|
||||
remove(column.getName(), Validation.Type.STRING);
|
||||
} else {
|
||||
|
||||
if (column.getType() == STRING && column.getFormat().equalsIgnoreCase(EMAIL.getExternalValue())) {
|
||||
add(column.getName(), new EmailValidation());
|
||||
}
|
||||
@@ -202,8 +215,6 @@ public class Validator {
|
||||
add(column.getName(), new BinaryValidation());
|
||||
}
|
||||
|
||||
if (column.getType() == STRING && column.getFormat() == null) {
|
||||
columnValidationMap.get(column).remove(Validation.Type.STRING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user