diff --git a/src/main/java/org/cactoos/io/ResourceOf.java b/src/main/java/org/cactoos/io/ResourceOf.java index 7aa7cd273..d7d519d1b 100644 --- a/src/main/java/org/cactoos/io/ResourceOf.java +++ b/src/main/java/org/cactoos/io/ResourceOf.java @@ -215,10 +215,25 @@ public ResourceOf(final Text res, @Override @SuppressWarnings("PMD.CloseResource") public InputStream stream() throws Exception { + if (this.path == null) { + throw new IllegalArgumentException( + "The \"path\" of the resource is NULL, which is not allowed" + ); + } + if (this.loader == null) { + throw new IllegalArgumentException( + "The \"classloader\" is NULL, which is not allowed" + ); + } InputStream input = this.loader.getResourceAsStream( this.path.asString() ); if (input == null) { + if (this.fallback == null) { + throw new IllegalArgumentException( + "The \"fallback\" is NULL, which is not allowed" + ); + } input = new IoCheckedFunc<>(this.fallback) .apply(this.path) .stream();