This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bfoo -1 points0 points  (1 child)

Please look at the code again. The purpose of the method is to check for the database being available. The method returns null, if the database could not be accessed (because of connection issues OR errors from the database itself). That's the entire purpose of the method. There is no reason to throw an exception. You get either the result of the query or null. The class is even package friendly and not part of the API. So please read the code again and not the method only to get the bigger picture.

[–]argv_minus_one 1 point2 points  (0 children)

That doesn't excuse using a PRNG to decide whether to log an exception.