Project

Profile

Help

Should BaseUri of StaticContext be of type Nullable<Uri>?

Added by Martin Honnen over 2 years ago

Looking for a workaround of the problems raised in https://saxonica.plan.io/boards/3/topics/8947?r=8954#message-8954 I have read through https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/revisions/he_mirror_saxon_11_4/entry/src/main/saxon-cs/engine/Saxon/Api/StaticContext.cs#L33 which does

        public Uri BaseUri => new(Implementation.getStaticBaseURI());

but on the Java side or Saxon.Hej.expr.StaticContext the method getStaticBaseURI can return null.

That way I wonder, shouldn't the code better use a nullable Uri?:

        public Uri? BaseUri => Implementation.getStaticBaseURI() != null ? new(Implementation.getStaticBaseURI()) : null;

With the existing code new(Implementation.getStaticBaseURI()), I see an ArgumentNullException if Implementation.getStaticBaseURI() returns null.


Please register to reply