Adds cityOrNull & countryOrNull methods for cases when the IP is unkn…#147
Adds cityOrNull & countryOrNull methods for cases when the IP is unkn…#147LukeButters wants to merge 7 commits intomaxmind:masterfrom
Conversation
…own. maxmind#28 Throwing exceptions is expensive and should generally be reserved for exceptional circumstances. This change adds to the DatabaseReader support for returning null instead of an exception when the IP address is not found.
| } | ||
|
|
||
| /** | ||
| * Same as {@link #city(InetAddress)} but returns null when the IP is no in our database. |
There was a problem hiding this comment.
| * Same as {@link #city(InetAddress)} but returns null when the IP is no in our database. | |
| * Same as {@link #city(InetAddress)} but returns null when the IP is not in our database. |
|
We are at a point where I think we can drop Java 7 support. As such, I'd prefer using |
|
@oschwald |
|
Yes, we would like maintain backwards compatibility. I am not about the method names. In C#, these sort of alternate methods are common and they use the |
also switch to using try as we will start to use optional
|
OK added some changes, now all of those methods provided by |
|
jkd7 and jdk-ea seem to fail, The first one is expected I don't know what the second one is @oschwald |
|
Lines 15 to 16 in 6477ec2 |
|
OK I removed those lines. |
|
This was merged manually. Thanks! |
…own. #28
Throwing exceptions is expensive and should generally be reserved for
exceptional circumstances. This change adds to the DatabaseReader support
for returning null instead of an exception when the IP address is not found.
This shows an example of the
xOrNullsolution to avoid the expensive exception. I wasn't sure if you wanted this on an interface, perhaps it should be in the theDatabaseProviderinterface.I did not return
Optionalas I assume that support for java7 is wanted.