mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-05 19:09:11 +00:00
Fix NPEs in Liquid renderer
This commit is contained in:
parent
fae2d1336c
commit
d9c1c74924
@ -285,7 +285,8 @@ public class LanguageUtils {
|
||||
if (element.isPrimitive() && isTranslatable(element)) {
|
||||
String base = element.primitiveValue();
|
||||
if (base != null) {
|
||||
Set<TranslationUnit> tlist = findTranslations(pathForElement(element), base, translations);
|
||||
String path = pathForElement(element);
|
||||
Set<TranslationUnit> tlist = findTranslations(path, base, translations);
|
||||
for (TranslationUnit translation : tlist) {
|
||||
t++;
|
||||
if (!handleAsSpecial(parent, element, translation)) {
|
||||
|
@ -144,8 +144,13 @@ public class LiquidRenderer extends ResourceRenderer implements ILiquidRendering
|
||||
} else {
|
||||
x.tx(base.toString());
|
||||
}
|
||||
String res = new XhtmlComposer(true).compose(x).substring(5);
|
||||
return res.substring(0, res.length()-6);
|
||||
String res = new XhtmlComposer(true).compose(x);
|
||||
res = res.substring(5);
|
||||
if (res.length() < 6) {
|
||||
return "";
|
||||
} else {
|
||||
return res.substring(0, res.length()-6);
|
||||
}
|
||||
} catch (FHIRFormatError e) {
|
||||
throw new FHIRException(e);
|
||||
} catch (IOException e) {
|
||||
|
@ -231,9 +231,11 @@ public class LiquidEngine implements IEvaluationContext {
|
||||
StringBuilder b = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Base i : items) {
|
||||
if (first) first = false; else b.append(", ");
|
||||
String s = renderingSupport != null ? renderingSupport.renderForLiquid(ctxt.externalContext, i) : null;
|
||||
b.append(s != null ? s : engine.convertToString(i));
|
||||
if (i != null) {
|
||||
if (first) first = false; else b.append(", ");
|
||||
String s = renderingSupport != null ? renderingSupport.renderForLiquid(ctxt.externalContext, i) : null;
|
||||
b.append(s != null ? s : engine.convertToString(i));
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user