Fix exceptions when constraints are not or incorrectly provided
This commit is contained in:
parent
6c6151ca43
commit
2687741263
@ -187,7 +187,11 @@ public class ConstraintFetcher {
|
||||
protected List<Statement> getConstraintStatements(PropertyIdValue pid) {
|
||||
PropertyDocument doc = (PropertyDocument) EntityCache.getEntityDocument(pid);
|
||||
StatementGroup group = doc.findStatementGroup(WIKIDATA_CONSTRAINT_PID);
|
||||
return group.getStatements();
|
||||
if (group != null) {
|
||||
return group.getStatements();
|
||||
} else {
|
||||
return new ArrayList<Statement>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,9 @@ public class FormatConstraintScrutinizer extends SnakScrutinizer {
|
||||
String value = ((StringValue) snak.getValue()).getString();
|
||||
PropertyIdValue pid = snak.getPropertyId();
|
||||
Pattern pattern = getPattern(pid);
|
||||
if (pattern == null) {
|
||||
return;
|
||||
}
|
||||
if (!pattern.matcher(value).matches()) {
|
||||
if (added) {
|
||||
QAWarning issue = new QAWarning(
|
||||
|
Loading…
Reference in New Issue
Block a user