Fix error in Comparisons

This commit is contained in:
Grahame Grieve 2023-09-15 12:46:45 -07:00
parent 34a029d5df
commit 6b5ca97aa8
2 changed files with 20 additions and 10 deletions

View File

@ -109,9 +109,9 @@ public class ComparisonSession {
throw new FHIRException("Unable to compare resources of type "+left.fhirType()+" and "+right.fhirType()); throw new FHIRException("Unable to compare resources of type "+left.fhirType()+" and "+right.fhirType());
} }
} catch (Throwable e) { } catch (Throwable e) {
// if (debug) { if (debug) {
e.printStackTrace(); e.printStackTrace();
// } }
ResourceComparer.PlaceHolderComparison csc = new ResourceComparer.PlaceHolderComparison(left, right, e); ResourceComparer.PlaceHolderComparison csc = new ResourceComparer.PlaceHolderComparison(left, right, e);
compares.put(key, csc); compares.put(key, csc);
return csc; return csc;

View File

@ -906,10 +906,15 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple
} else if (derivesFrom(sdnw, sdex, ctxt)) { } else if (derivesFrom(sdnw, sdex, ctxt)) {
tfound = true; tfound = true;
} else if (sdnw.getSnapshot().getElement().get(0).getPath().equals(sdex.getSnapshot().getElement().get(0).getPath())) { } else if (sdnw.getSnapshot().getElement().get(0).getPath().equals(sdex.getSnapshot().getElement().get(0).getPath())) {
ProfileComparison compP = (ProfileComparison) session.compare(sdex, sdnw); ResourceComparison cmp = session.compare(sdex, sdnw);
if (compP.getUnion() != null) { if (cmp instanceof ProfileComparison) {
tfound = true; ProfileComparison compP = (ProfileComparison) cmp;
ex.addTargetProfile("#"+compP.getId()); if (compP.getUnion() != null) {
tfound = true;
ex.addTargetProfile("#"+compP.getId());
}
} else {
// ?
} }
} }
} }
@ -973,10 +978,15 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple
c.setProfile(r.getProfile()); c.setProfile(r.getProfile());
pfound = true; pfound = true;
} else if (sdl.getType().equals(sdr.getType())) { } else if (sdl.getType().equals(sdr.getType())) {
ProfileComparison compP = (ProfileComparison) session.compare(sdl, sdr); ResourceComparison cmp = session.compare(sdl, sdr);
if (compP != null && compP.getIntersection() != null) { if (cmp instanceof ProfileComparison) {
pfound = true; ProfileComparison compP = (ProfileComparison) cmp;
c.addProfile("#"+compP.getId()); if (compP != null && compP.getIntersection() != null) {
pfound = true;
c.addProfile("#"+compP.getId());
}
} else {
// not sure how to handle this error?
} }
} }
} }