better debugging of error strings

This commit is contained in:
Grahame Grieve 2020-04-21 13:57:41 +10:00
parent d6f267781f
commit 957a71dc41
9 changed files with 34 additions and 34 deletions

View File

@ -627,7 +627,7 @@ public class CapabilityStatementUtilities {
return cc.getText();
if (cc.hasCoding())
return gen(cc.getCoding().get(0));
return "??";
return "?gen-cc?";
}
private String gen(Coding coding) {
@ -635,7 +635,7 @@ public class CapabilityStatementUtilities {
return coding.getDisplay();
if (coding.hasCode())
return coding.getCode();
return "???";
return "?gen-c?";
}

View File

@ -3384,7 +3384,7 @@ public class ProfileUtilities extends TranslatingUtilities {
extDefn = locateExtension(StructureDefinition.class, eurl);
if (extDefn == null) {
genCardinality(gen, element, row, hasDef, used, null);
row.getCells().add(gen.new Cell(null, null, "?? "+element.getType().get(0).getProfile(), null, null));
row.getCells().add(gen.new Cell(null, null, "?gen-e1? "+element.getType().get(0).getProfile(), null, null));
generateDescription(gen, row, element, (ElementDefinition) element.getUserData(DERIVATION_POINTER), used.used, profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot);
} else {
String name = urltail(eurl);
@ -3574,7 +3574,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (first) first = false; else typeCell.addPiece(gen.new Piece(null, " | ", null));
StructureDefinition psd = context.fetchResource(StructureDefinition.class, pt.getValue());
if (psd == null)
typeCell.addPiece(gen.new Piece(null, "??", null));
typeCell.addPiece(gen.new Piece(null, "?gen-e2?", null));
else
typeCell.addPiece(gen.new Piece(psd.getUserString("path"), psd.getName(), psd.present()));
@ -3932,7 +3932,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (ref != null) {
ref = ref.substring(0, ref.indexOf(".html"))+"-definitions.html#";
} else {
ref = "??";
ref = "?gen-fv?";
}
StructureDefinition sd = context.fetchTypeDefinition(value.fhirType());
@ -4254,7 +4254,7 @@ public class ProfileUtilities extends TranslatingUtilities {
case OPEN : return translate("sd.table", "Open");
case OPENATEND : return translate("sd.table", "Open At End");
default:
return "??";
return "?gen-sr?";
}
}

View File

@ -678,12 +678,12 @@ public class XmlParser extends ParserBase {
return header.substring(i+9, i+12);
}
}
return "??";
return "?xml-p1?";
} catch (Exception e) {
// suppress this error
logError(0, 0, "XML", IssueType.INVALID, e.getMessage(), IssueSeverity.ERROR);
}
return "??";
return "?xml-p2?";
}
}

View File

@ -217,7 +217,7 @@ public class ExpressionNode {
case ConvertsToDateTime : return "convertsToDateTime";
case ConvertsToTime : return "isTime";
case ConformsTo : return "conformsTo";
default: return "??";
default: return "?custom?";
}
}
}
@ -309,7 +309,7 @@ public class ExpressionNode {
case In : return "in";
case Contains : return "contains";
case MemberOf : return "memberOf";
default: return "??";
default: return "?custom?";
}
}
}
@ -534,7 +534,7 @@ public class ExpressionNode {
case Constant: return uniqueId+": "+constant;
case Group: return uniqueId+": (Group)";
}
return "??";
return "?exp-kind?";
}
private void write(StringBuilder b) {

View File

@ -536,17 +536,17 @@ public class FHIRPathEngine {
* evaluate a path and return the matching elements
*
* @param base - the object against which the path is being evaluated
* @param ExpressionNode - the parsed ExpressionNode statement to use
* @param expressionNode - the parsed ExpressionNode statement to use
* @return
* @throws FHIRException
* @
*/
public List<Base> evaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode ExpressionNode) throws FHIRException {
public List<Base> evaluate(Object appContext, Base focusResource, Base rootResource, Base base, ExpressionNode expressionNode) throws FHIRException {
List<Base> list = new ArrayList<Base>();
if (base != null)
list.add(base);
log = new StringBuilder();
return execute(new ExecutionContext(appContext, focusResource, rootResource, base, null, base), list, ExpressionNode, true);
return execute(new ExecutionContext(appContext, focusResource, rootResource, base, null, base), list, expressionNode, true);
}
/**

View File

@ -777,7 +777,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
} else if (wrapped.hasChild("name") && wrapped.getChildValue("name") != null) {
x.tx(wrapped.getChildValue("name"));
} else {
x.tx("??");
x.tx("?ngen-1?");
}
}
}
@ -1734,7 +1734,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(name+": ");
x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
x.addText(!p.hasStart() ? "?ngen-2?" : p.getStartElement().toHumanDisplay());
x.tx(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
return true;
@ -1744,9 +1744,9 @@ public class NarrativeGenerator implements INarrativeGenerator {
x.addText(r.getDisplay());
else if (r.hasReferenceElement()) {
ResourceWithReference tr = resolveReference(res, r.getReference(), rc);
x.addText(tr == null ? r.getReference() : "????"); // getDisplayForReference(tr.getReference()));
x.addText(tr == null ? r.getReference() : "?ngen-3"); // getDisplayForReference(tr.getReference()));
} else
x.tx("??");
x.tx("?ngen-4?");
return true;
} else if (e instanceof Narrative) {
return false;
@ -1794,7 +1794,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
}
public static String displayPeriod(Period p) {
String s = !p.hasStart() ? "??" : p.getStartElement().toHumanDisplay();
String s = !p.hasStart() ? "?ngen-5?" : p.getStartElement().toHumanDisplay();
s = s + " --> ";
return s + (!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
}
@ -2296,13 +2296,13 @@ public class NarrativeGenerator implements INarrativeGenerator {
case PCM: return "after breakfast";
case PCV: return "after dinner";
case WAKE: return "after waking";
default: return "??";
default: return "?ngen-6?";
}
}
private String displayTimeUnits(UnitsOfTime units) {
if (units == null)
return "??";
return "?ngen-7?";
switch (units) {
case A: return "years";
case D: return "days";
@ -2311,7 +2311,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
case MO: return "months";
case S: return "seconds";
case WK: return "weeks";
default: return "??";
default: return "?ngen-8?";
}
}
@ -2391,7 +2391,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
}
private String displayIdentifier(Identifier ii) {
String s = Utilities.noString(ii.getValue()) ? "??" : ii.getValue();
String s = Utilities.noString(ii.getValue()) ? "?ngen-9?" : ii.getValue();
if (ii.hasType()) {
if (ii.getType().hasText())
@ -2455,7 +2455,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
p.addText(Utilities.capitalize(cm.getStatus().toString())+" (not intended for production usage). ");
else
p.addText(Utilities.capitalize(cm.getStatus().toString())+". ");
p.tx("Published on "+(cm.hasDate() ? cm.getDateElement().toHumanDisplay() : "??")+" by "+cm.getPublisher());
p.tx("Published on "+(cm.hasDate() ? cm.getDateElement().toHumanDisplay() : "?ngen-10?")+" by "+cm.getPublisher());
if (!cm.getContact().isEmpty()) {
p.tx(" (");
boolean firsti = true;
@ -3893,7 +3893,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
return vc.getDisplay();
}
}
return "??Lang";
return "?ngen-lang?";
}
private boolean addDefineRowToTable(XhtmlNode t, ConceptDefinitionComponent c, int level, boolean hasHierarchy, boolean hasDisplay, boolean comment, boolean version, boolean deprecated, List<UsedConceptMap> maps, String system, CodeSystem cs, String lang, List<PropertyComponent> properties, CodeSystemNavigator csNav) throws FHIRFormatError, DefinitionException, IOException {
@ -4236,14 +4236,14 @@ public class NarrativeGenerator implements INarrativeGenerator {
String ref = (String) vs.getUserData("path");
ref = adjustForPath(ref);
XhtmlNode a = li.ah(ref == null ? "??" : ref.replace("\\", "/"));
XhtmlNode a = li.ah(ref == null ? "?ngen-11?" : ref.replace("\\", "/"));
a.addText(value);
} else {
CodeSystem cs = context.fetchCodeSystem(value);
if (cs != null) {
String ref = (String) cs.getUserData("path");
ref = adjustForPath(ref);
XhtmlNode a = li.ah(ref == null ? "??" : ref.replace("\\", "/"));
XhtmlNode a = li.ah(ref == null ? "?ngen-12?" : ref.replace("\\", "/"));
a.addText(value);
} else if (value.equals("http://snomed.info/sct") || value.equals("http://snomed.info/id")) {
XhtmlNode a = li.ah(value);
@ -4397,7 +4397,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
case ISA: return " is-a ";
case ISNOTA: return " is-not-a ";
case REGEX: return " matches (by regex) ";
case NULL: return " ?? ";
case NULL: return " ?ngen-13? ";
case IN: return " in ";
case NOTIN: return " not in ";
case DESCENDENTOF: return " descends from ";
@ -4534,7 +4534,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (ref == null)
ref = (String) cs.getUserData("path");
if (ref == null)
return "??.html";
return "?ngen-14?.html";
if (!ref.contains(".html"))
ref = ref + ".html";
return ref.replace("\\", "/");
@ -4646,7 +4646,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (ref.hasIdentifier()) {
return displayIdentifier(ref.getIdentifier());
}
return "??";
return "?ngen-15?";
}
public String gen(CodeableConcept code) {
@ -4861,7 +4861,7 @@ public class NarrativeGenerator implements INarrativeGenerator {
} else if (disp != null) {
x.tx(disp);
} else {
x.tx("??");
x.tx("?ngen-16?");
}
}
return x;

View File

@ -39,7 +39,7 @@ public class TypesUtilities {
case PRIMITIVE: return "Primitive Type";
case SPECIAL: return "Special Type";
}
return "??";
return "?tu-class?";
}
}

View File

@ -1578,7 +1578,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} else if (ctxt.getType() == ExtensionContextType.FHIRPATH) {
contexts.append("p:" + ctxt.getExpression());
// The context is all elements that match the FHIRPath query found in the expression.
List<Base> res = fpe.evaluate(hostContext, resource, hostContext.getRootResource(), container, fpe.parse(ctxt.getExpression()));
List<Base> res = fpe.evaluate(hostContext, resource, hostContext.getRootResource(), resource, fpe.parse(ctxt.getExpression()));
if (res.contains(container)) {
ok = true;
}

View File

@ -17,7 +17,7 @@
<properties>
<hapi_fhir_version>4.2.0</hapi_fhir_version>
<validator_test_case_version>1.1.6-SNAPSHOT</validator_test_case_version>
<validator_test_case_version>1.1.7-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.6.2</junit_jupiter_version>
</properties>