Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Changing Exception Types Being Thrown

Open syoon2 opened this issue 2 years ago • 0 comments
trafficstars

This PR changes the types of exceptions being thrown by the methods. More specifically, this PR:

  • Replaces uses of java.lang.Exception (way too broad) with more appropriate subclasses of it
  • Replaces uses of java.lang.RuntimeException with more appropriate subclasses of it
  • Replaces uses of java.lang.IllegalArgumentException for invalid null arguments with java.lang.NullPointerException (mostly via java.util.Objects.requireNonNull(Object))

    Applications should throw instances of this class to indicate other illegal uses of the null object. Java 11 API: java.lang.NullPointerException

  • Replaces uses of java.lang.IllegalArgumentException for invalid index with java.lang.IndexOutOfBoundsException
  • Etc.

syoon2 avatar Aug 14 '23 07:08 syoon2