Return null in Get Methods

Hi, I am confused about returning Null in some of the get methods. Let’s say we have URI “1234”,
without “://” for the scheme or “/” for the path or anything else, then once I am splitting this string to get something a part, let’s say scheme. I will have null as a split return value, right? then what do I return in getScheme.

You can take a look at the grammar:

URI  = scheme ":" hierarchical [ "?" query ]

Your example “URI” does not match the grammar.
Therefore, it is not a valid URI.

To cite the comment in UriParser.java:

	/**
	 * @return the parsed {@link Uri} instance or null when the string is not a
	 *         valid {@link Uri} with regards to the grammar given in
	 *         {@link Uri}
	 */
1 Like

i got it thanks.