fix crash in IG publisher rendering illegal content
This commit is contained in:
parent
2df1283a54
commit
108bfe715b
|
@ -2,6 +2,7 @@ package org.hl7.fhir.r5.renderers.utils;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,6 +17,7 @@ import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
|||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||
import org.hl7.fhir.r5.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.renderers.ResourceRenderer;
|
||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
|
||||
|
@ -65,7 +67,11 @@ public class ElementWrappers {
|
|||
if (context.getParser() == null) {
|
||||
throw new Error("No type parser provided to renderer context");
|
||||
} else {
|
||||
return context.getParser().parseType(xml.toString(), type);
|
||||
try {
|
||||
return context.getParser().parseType(xml.toString(StandardCharsets.UTF_8), type);
|
||||
} catch (Exception e) {
|
||||
return new StringType("Illegal syntax: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue