improved validation of UUIDs

This commit is contained in:
Grahame Grieve 2021-10-29 09:20:23 +11:00
parent 307246ce91
commit e4b503751c
5 changed files with 22 additions and 18 deletions

View File

@ -121,6 +121,9 @@ public class ZipGenerator {
File f = new CSFile(actualDir); File f = new CSFile(actualDir);
String files[] = f.list(); String files[] = f.list();
if (files == null) {
System.out.println("no files found in "+f.getName());
} else {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
if ( new CSFile(actualDir + files[i]).isFile() && ((ext == null || files[i].endsWith(ext)) && (noExt == null || !files[i].endsWith(noExt)))) { if ( new CSFile(actualDir + files[i]).isFile() && ((ext == null || files[i].endsWith(ext)) && (noExt == null || !files[i].endsWith(noExt)))) {
FileInputStream fi = new FileInputStream(actualDir + files[i]); FileInputStream fi = new FileInputStream(actualDir + files[i]);
@ -136,6 +139,7 @@ public class ZipGenerator {
} }
} }
} }
}
public void addFilesFiltered(String actualDir, String statedDir, String ext, String[] noExt) throws FileNotFoundException, IOException { public void addFilesFiltered(String actualDir, String statedDir, String ext, String[] noExt) throws FileNotFoundException, IOException {
byte data[] = new byte[BUFFER]; byte data[] = new byte[BUFFER];

View File

@ -510,7 +510,7 @@ public class I18nConstants {
public static final String TYPE_SPECIFIC_CHECKS_DT_CANONICAL_TYPE = "TYPE_SPECIFIC_CHECKS_DT_CANONICAL_TYPE"; public static final String TYPE_SPECIFIC_CHECKS_DT_CANONICAL_TYPE = "TYPE_SPECIFIC_CHECKS_DT_CANONICAL_TYPE";
public static final String TYPE_SPECIFIC_CHECKS_DT_CANONICAL_RESOLVE = "TYPE_SPECIFIC_CHECKS_DT_CANONICAL_RESOLVE"; public static final String TYPE_SPECIFIC_CHECKS_DT_CANONICAL_RESOLVE = "TYPE_SPECIFIC_CHECKS_DT_CANONICAL_RESOLVE";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_STRAT = "Type_Specific_Checks_DT_UUID_Strat"; public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_STRAT = "Type_Specific_Checks_DT_UUID_Strat";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_VAID = "Type_Specific_Checks_DT_UUID_Vaid"; public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_VALID = "Type_Specific_Checks_DT_UUID_Valid";
public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER = "Unable_to_connect_to_terminology_server"; public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER = "Unable_to_connect_to_terminology_server";
public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__"; public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__";
public static final String UNABLE_TO_FIND_BASE_DEFINITION_FOR_LOGICAL_MODEL__FROM_ = "Unable_to_find_base_definition_for_logical_model__from_"; public static final String UNABLE_TO_FIND_BASE_DEFINITION_FOR_LOGICAL_MODEL__FROM_ = "Unable_to_find_base_definition_for_logical_model__from_";

View File

@ -598,7 +598,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
TableModel model = new TableModel(id, isActive); TableModel model = new TableModel(id, isActive);
model.setAlternating(alternating); model.setAlternating(alternating);
model.setDocoImg(prefix+"help16.png"); model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table")); model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table"));
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0));
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0));
@ -615,7 +615,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
TableModel model = new TableModel(id, true); TableModel model = new TableModel(id, true);
model.setAlternating(true); model.setAlternating(true);
model.setDocoImg(prefix+"help16.png"); model.setDocoImg(Utilities.pathURL(prefix, "help16.png"));
model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table")); model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table"));
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0));
model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Flags"), translate("sd.hint", "Information about the use of the element - Left Structure"), null, 0).setStyle("border-left: 1px grey solid")); model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Flags"), translate("sd.hint", "Information about the use of the element - Left Structure"), null, 0).setStyle("border-left: 1px grey solid"));

View File

@ -208,7 +208,7 @@ Type_Specific_Checks_DT_URI_UUID = URI values cannot start with uuid:
Type_Specific_Checks_DT_URI_WS = URI values cannot have whitespace(''{0}'') Type_Specific_Checks_DT_URI_WS = URI values cannot have whitespace(''{0}'')
Type_Specific_Checks_DT_URL_Resolve = URL value ''{0}'' does not resolve Type_Specific_Checks_DT_URL_Resolve = URL value ''{0}'' does not resolve
Type_Specific_Checks_DT_UUID_Strat = UUIDs must start with urn:uuid: Type_Specific_Checks_DT_UUID_Strat = UUIDs must start with urn:uuid:
Type_Specific_Checks_DT_UUID_Vaid = UUIDs must be valid Type_Specific_Checks_DT_UUID_Valid = UUIDs must be valid (and lowercase)
Validation_BUNDLE_Message = The first entry in a message must be a MessageHeader Validation_BUNDLE_Message = The first entry in a message must be a MessageHeader
Validation_VAL_Content_Unknown = Unrecognised Content {0} Validation_VAL_Content_Unknown = Unrecognised Content {0}
Validation_VAL_NoType = Unknown type {0} Validation_VAL_NoType = Unknown type {0}

View File

@ -2035,7 +2035,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
if (url != null && url.startsWith("urn:uuid:")) { if (url != null && url.startsWith("urn:uuid:")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isValidUUID(url.substring(9)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_UUID_VAID); rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isValidUUID(url.substring(9)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_UUID_VALID);
} }
if (url != null && url.startsWith("urn:oid:")) { if (url != null && url.startsWith("urn:oid:")) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isOid(url.substring(8)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_OID_VALID); rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isOid(url.substring(8)), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_OID_VALID);