From 7e9b1488379193804677c76a2ee43b2ecaf66448 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 7 Apr 2022 00:20:43 +1000 Subject: [PATCH] Don't validate Bundle.entry.fullUrl as a reference --- .../xhtml/HierarchicalTableGenerator.java | 15 ++++++++++++++- .../validation/instance/InstanceValidator.java | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index 9552a95fa..3fca24f3f 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -599,6 +599,14 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { this.dest = dest; this.inLineGraphics = inlineGraphics; this.makeTargets = true; + checkSetup(); + } + + private void checkSetup() { + if (dest == null) { + throw new Error("what"); + } + } public HierarchicalTableGenerator(String dest, boolean inlineGraphics, boolean makeTargets) { @@ -606,6 +614,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { this.dest = dest; this.inLineGraphics = inlineGraphics; this.makeTargets = makeTargets; + checkSetup(); } public TableModel initNormalTable(String prefix, boolean isLogical, boolean alternating, String id, boolean isActive) { @@ -947,7 +956,11 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { String file = Utilities.path(dest, b.toString()); if (!new File(file).exists()) { File newFile = new File(file); - newFile.getParentFile().mkdirs(); + if (newFile.getParentFile() == null) { + throw new Error("No source directory provided. ("+file+")"); + } else { + newFile.getParentFile().mkdirs(); + } newFile.createNewFile(); FileOutputStream stream = new FileOutputStream(file); genImage(indents, hasChildren, lineColor, stream); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index bbe9951b9..6db8f04e0 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -2143,7 +2143,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat // the URL must be an IRI if present rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isAbsoluteUrl(url), node.isContained() ? I18nConstants.TYPE_SPECIFIC_CHECKS_CANONICAL_CONTAINED : I18nConstants.TYPE_SPECIFIC_CHECKS_CANONICAL_ABSOLUTE, url); - } else { + } else if (!e.getProperty().getDefinition().getPath().equals("Bundle.entry.fullUrl")) { // we don't check fullUrl here; it's not a reference, it's a definition. It'll get checked as part of checking the bundle validateReference(hostContext, errors, path, type, context, e, url); } }