From 8613f6f0647eb5171486052c7c723595bcf4c80d Mon Sep 17 00:00:00 2001 From: dotasek Date: Fri, 14 Jan 2022 20:53:30 -0500 Subject: [PATCH 1/2] Use version utilities to resolve version for handleOutputToStream This stems from executing a -compile option without an explicit version. "current" is selected by default, resulting in an exception. In this case, current should resolve correctly. --- .../java/org/hl7/fhir/validation/ValidationEngine.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java index aeb9e42e0..95ca38aec 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java @@ -580,7 +580,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP private void handleOutputToStream(Resource r, String fn, OutputStream s, String version) throws FHIRException, IOException { if (fn.endsWith(".html") || fn.endsWith(".htm") && r instanceof DomainResource) new XhtmlComposer(XhtmlComposer.HTML, true).compose(s, ((DomainResource) r).getText().getDiv()); - else if (version.startsWith("3.0")) { + else if (VersionUtilities.isR3Ver(version)) { org.hl7.fhir.dstu3.model.Resource res = VersionConvertorFactory_30_50.convertResource(r); if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new org.hl7.fhir.dstu3.formats.XmlParser().setOutputStyle(org.hl7.fhir.dstu3.formats.IParser.OutputStyle.PRETTY).compose(s, res); @@ -590,7 +590,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP TextFile.stringToStream(org.hl7.fhir.dstu3.utils.StructureMapUtilities.render((org.hl7.fhir.dstu3.model.StructureMap) res), s, false); else throw new FHIRException("Unsupported format for " + fn); - } else if (version.startsWith("4.0")) { + } else if (VersionUtilities.isR4Ver(version)) { org.hl7.fhir.r4.model.Resource res = VersionConvertorFactory_40_50.convertResource(r); if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new org.hl7.fhir.r4.formats.XmlParser().setOutputStyle(org.hl7.fhir.r4.formats.IParser.OutputStyle.PRETTY).compose(s, res); @@ -600,7 +600,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP TextFile.stringToStream(org.hl7.fhir.r4.utils.StructureMapUtilities.render((org.hl7.fhir.r4.model.StructureMap) res), s, false); else throw new FHIRException("Unsupported format for " + fn); - } else if (version.startsWith("1.4")) { + } else if (VersionUtilities.isR2BVer(version)) { org.hl7.fhir.dstu2016may.model.Resource res = VersionConvertorFactory_14_50.convertResource(r); if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new org.hl7.fhir.dstu2016may.formats.XmlParser().setOutputStyle(org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle.PRETTY).compose(s, res); @@ -608,7 +608,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP new org.hl7.fhir.dstu2016may.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle.PRETTY).compose(s, res); else throw new FHIRException("Unsupported format for " + fn); - } else if (version.startsWith("1.0")) { + } else if (VersionUtilities.isR2Ver(version)) { org.hl7.fhir.dstu2.model.Resource res = VersionConvertorFactory_10_50.convertResource(r, new org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor5()); if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res); @@ -616,7 +616,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res); else throw new FHIRException("Unsupported format for " + fn); - } else if (version.equals(Constants.VERSION)) { + } else if (VersionUtilities.isR5Ver(version)) { if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) new XmlParser().setOutputStyle(org.hl7.fhir.r5.formats.IParser.OutputStyle.PRETTY).compose(s, r); else if (fn.endsWith(".json") && !fn.endsWith("template.json")) From c4853fd5720f444c507364d51d54a3db77e540f4 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 17 Jan 2022 12:10:33 -0500 Subject: [PATCH 2/2] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..b45b0ddd2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -0,0 +1,8 @@ +## Validator Changes + +* fix inclusion of Java constants in CLI help text. +* fix bug on `-compile` output when using 'current' version. + +## Other code changes + +n/a