Skip to content

Commit

Permalink
IllegalArgumentException -> NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Mar 4, 2023
1 parent 85b6a16 commit 192f802
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/libj/io/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static void deleteAll0(final Path path, final Filter<? super Path> filte
* @param path The path to delete recursively.
* @param filter The filter of paths to delete, or {@code null} to match all paths.
* @throws IOException If an I/O error has occurred during {@link Filter#accept(Object)}.
* @throws IllegalArgumentException If {@code path} is null.
* @throws NullPointerException If {@code path} is null.
*/
public static void deleteAllOnExit(final Path path, final Filter<? super Path> filter) throws IOException {
deleteOnExit(path, filter, null);
Expand Down Expand Up @@ -175,7 +175,7 @@ else if (filter != null && filter.accept(path))
* @param file The file to delete recursively.
* @param filter The filter of paths to delete, or {@code null} to match all paths.
* @throws IOException If an I/O error has occurred during {@link Filter#accept(Object)}.
* @throws IllegalArgumentException If {@code file} is null.
* @throws NullPointerException If {@code file} is null.
*/
public static void deleteAllOnExit(final File file, final Filter<? super Path> filter) throws IOException {
deleteAllOnExit(file, filter, null);
Expand Down Expand Up @@ -205,7 +205,7 @@ else if (filter != null && filter.accept(path))
* Register a path to be recursively deleted when the JVM exits.
*
* @param path The path to delete recursively.
* @throws IllegalArgumentException If the {@code path} is null.
* @throws NullPointerException If the {@code path} is null.
*/
public static void deleteAllOnExit(final Path path) {
try {
Expand All @@ -220,7 +220,7 @@ public static void deleteAllOnExit(final Path path) {
* Register a path to be recursively deleted when the JVM exits.
*
* @param file The file to delete recursively.
* @throws IllegalArgumentException If the {@code file} is null.
* @throws NullPointerException If the {@code file} is null.
*/
public static void deleteAllOnExit(final File file) {
try {
Expand All @@ -238,7 +238,7 @@ public static void deleteAllOnExit(final File file) {
* @param filter The filter of paths to delete, or {@code null} to match all paths.
* @return {@code true} if and only if the file or directory was successfully deleted; {@code false} otherwise.
* @throws IOException If an I/O error has occurred during {@link Filter#accept(Object)}.
* @throws IllegalArgumentException If the {@code path} is null.
* @throws NullPointerException If the {@code path} is null.
*/
public static boolean deleteAll(final Path path, final Filter<? super Path> filter) throws IOException {
deleteAll0(path, filter != null ? filter : anyStreamFilter);
Expand All @@ -251,7 +251,7 @@ public static boolean deleteAll(final Path path, final Filter<? super Path> filt
* @param path The path to delete recursively.
* @return {@code true} if and only if the file or directory was successfully deleted; {@code false} otherwise.
* @throws IOException If an I/O error has occurred.
* @throws IllegalArgumentException If the {@code path} is null.
* @throws NullPointerException If the {@code path} is null.
*/
public static boolean deleteAll(final Path path) throws IOException {
deleteAll0(path, anyStreamFilter);
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/libj/io/ReaderInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public ReaderInputStream(final Reader reader, final CharsetEncoder encoder, fina
*
* @param reader The target {@link Reader}.
* @param encoder The charset encoder.
* @throws IllegalArgumentException If {@code reader} or {@code encoder} is null.
* @throws NullPointerException If {@code reader} or {@code encoder} is null.
*/
public ReaderInputStream(final Reader reader, final CharsetEncoder encoder) {
this(reader, encoder, DEFAULT_BUFFER_SIZE);
Expand All @@ -120,7 +120,8 @@ public ReaderInputStream(final Reader reader, final CharsetEncoder encoder) {
* @param reader The target {@link Reader}.
* @param charset The charset encoding.
* @param bufferSize The size of the input buffer in number of characters.
* @throws IllegalArgumentException If {@code reader} or {@code charset} is null, or if {@code bufferSize} is negative.
* @throws NullPointerException If {@code reader} or {@code charset} is null.
* @throws IllegalArgumentException If {@code bufferSize} is negative.
*/
public ReaderInputStream(final Reader reader, final Charset charset, final int bufferSize) {
this(reader, charset.newEncoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE), bufferSize);
Expand All @@ -133,7 +134,7 @@ public ReaderInputStream(final Reader reader, final Charset charset, final int b
*
* @param reader The target {@link Reader}.
* @param charset The charset encoding.
* @throws IllegalArgumentException If {@code reader} or {@code charset} is null.
* @throws NullPointerException If {@code reader} or {@code charset} is null.
*/
public ReaderInputStream(final Reader reader, final Charset charset) {
this(reader, charset, DEFAULT_BUFFER_SIZE);
Expand All @@ -146,8 +147,8 @@ public ReaderInputStream(final Reader reader, final Charset charset) {
* @param reader The target {@link Reader}.
* @param charsetName The name of the charset encoding.
* @param bufferSize The size of the input buffer in number of characters.
* @throws IllegalArgumentException If {@code reader} is null, or if {@code bufferSize} is negative.
* @throws IllegalCharsetNameException If the given charset name is illegal.
* @throws NullPointerException If {@code reader} is null.
* @throws IllegalArgumentException If {@code bufferSize} is negative, or the given charset name is illegal.
*/
public ReaderInputStream(final Reader reader, final String charsetName, final int bufferSize) {
this(reader, Charset.forName(charsetName), bufferSize);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/libj/io/Readers.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class Readers {
* @param reader The {@link Reader}.
* @return A string of the remaining contents from the specified {@link Reader}.
* @throws IOException If an I/O error has occurred.
* @throws IllegalArgumentException If {@code reader} is null.
* @throws NullPointerException If {@code reader} is null.
*/
public static String readFully(final Reader reader) throws IOException {
return readFully(reader, new StringBuilder()).toString();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/libj/io/ReplayReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public int read() throws IOException {
* @param cbuf Destination buffer.
* @return The number of characters read, or -1 if the end of the stream has been reached.
* @throws IOException If an I/O error has occurred.
* @throws IllegalArgumentException If {@code cbuf} is null.
* @throws NullPointerException If {@code cbuf} is null.
*/
@Override
public int read(final char[] cbuf) throws IOException {
Expand All @@ -371,7 +371,7 @@ public int read(final char[] cbuf) throws IOException {
* @throws IOException If an I/O error has occurred.
* @throws IndexOutOfBoundsException If {@code off} is negative, or {@code len} is negative, or {@code len} is greater than
* {@code cbuf.length - off}.
* @throws IllegalArgumentException If {@code cbuf} is null.
* @throws NullPointerException If {@code cbuf} is null.
*/
@Override
public int read(final char[] cbuf, final int off, final int len) throws IOException {
Expand Down

0 comments on commit 192f802

Please sign in to comment.