Add content to whitespace message
This commit is contained in:
parent
159fbc1a4b
commit
2dfa821e12
|
@ -206,7 +206,7 @@ Type_Specific_Checks_DT_Primitive_Regex = Element value ''{0}'' does not meet re
|
||||||
Type_Specific_Checks_DT_Primitive_ValueExt = Primitive types must have a value or must have child extensions
|
Type_Specific_Checks_DT_Primitive_ValueExt = Primitive types must have a value or must have child extensions
|
||||||
Type_Specific_Checks_DT_Primitive_WS = Primitive types should not only be whitespace
|
Type_Specific_Checks_DT_Primitive_WS = Primitive types should not only be whitespace
|
||||||
Type_Specific_Checks_DT_String_Length = value is longer than permitted maximum length of 1 MB (1048576 bytes)
|
Type_Specific_Checks_DT_String_Length = value is longer than permitted maximum length of 1 MB (1048576 bytes)
|
||||||
Type_Specific_Checks_DT_String_WS = value should not start or finish with whitespace
|
Type_Specific_Checks_DT_String_WS = value should not start or finish with whitespace ''{0}''
|
||||||
Type_Specific_Checks_DT_Time_Valid = Not a valid time ({0})
|
Type_Specific_Checks_DT_Time_Valid = Not a valid time ({0})
|
||||||
Type_Specific_Checks_DT_URI_OID = URI values cannot start with oid:
|
Type_Specific_Checks_DT_URI_OID = URI values cannot start with oid:
|
||||||
Type_Specific_Checks_DT_URI_UUID = URI values cannot start with uuid:
|
Type_Specific_Checks_DT_URI_UUID = URI values cannot start with uuid:
|
||||||
|
|
|
@ -2143,7 +2143,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
if (type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) {
|
if (type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) {
|
||||||
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_NOTEMPTY)) {
|
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_NOTEMPTY)) {
|
||||||
warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_STRING_WS);
|
warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_STRING_WS, prepWSPresentation(e.primitiveValue()));
|
||||||
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().length() <= 1048576, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH)) {
|
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().length() <= 1048576, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH)) {
|
||||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength() == 0 || e.primitiveValue().length() <= context.getMaxLength(), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH, context.getMaxLength());
|
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength() == 0 || e.primitiveValue().length() <= context.getMaxLength(), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH, context.getMaxLength());
|
||||||
}
|
}
|
||||||
|
@ -2296,6 +2296,30 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
// for nothing to check
|
// for nothing to check
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object prepWSPresentation(String s) {
|
||||||
|
if (Utilities.noString(s)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (!StringUtils.containsWhitespace(s.trim())) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
int b = 0;
|
||||||
|
while (Character.isWhitespace(s.charAt(b))) {
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
while (!Character.isWhitespace(s.charAt(b))) {
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
int e = s.length() - 1;
|
||||||
|
while (Character.isWhitespace(s.charAt(e))) {
|
||||||
|
e--;
|
||||||
|
}
|
||||||
|
while (!Character.isWhitespace(s.charAt(e))) {
|
||||||
|
e--;
|
||||||
|
}
|
||||||
|
return s.substring(0, b)+"..."+s.substring(e+1);
|
||||||
|
}
|
||||||
|
|
||||||
public void validateReference(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, String type, ElementDefinition context, Element e, String url) {
|
public void validateReference(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, String type, ElementDefinition context, Element e, String url) {
|
||||||
// now, do we check the URI target?
|
// now, do we check the URI target?
|
||||||
if (fetcher != null && !type.equals("uuid")) {
|
if (fetcher != null && !type.equals("uuid")) {
|
||||||
|
|
Loading…
Reference in New Issue