Stream: hapi
Topic: issue in generated core
Grahame Grieve (Jul 20 2016 at 21:51):
@James Agnew, a question about our generated code:
Grahame Grieve (Jul 20 2016 at 21:52):
public Reference getSourceReference() throws FHIRException { if (!(this.source instanceof Reference)) throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.source.getClass().getName()+" was encountered"); return (Reference) this.source; }
Grahame Grieve (Jul 20 2016 at 21:52):
this will result in an NPE if this.source == null, which is obviously no good.
Grahame Grieve (Jul 20 2016 at 21:52):
but what should it do in that case?
Grahame Grieve (Jul 24 2016 at 22:59):
@James Agnew - ping on this subject...
James Agnew (Jul 24 2016 at 23:09):
Sorry! Hopelessly behind on messages right now... Agreed that seems like a bug. We should probably have something like
if (this.source != null && !(this.source instanceof Reference)) {
James Agnew (Jul 24 2016 at 23:10):
I think returning null
is sensible behaviour in that case.
Grahame Grieve (Jul 24 2016 at 23:10):
ok will do.
Grahame Grieve (Jul 24 2016 at 23:11):
thanks
Last updated: Apr 12 2022 at 19:14 UTC