Skip to content

Commit

Permalink
Now with null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed Aug 4, 2022
1 parent 4f74122 commit b0c185b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Objects;

import lombok.extern.slf4j.Slf4j;

Expand All @@ -35,7 +34,7 @@ public static String inputStreamToString(final InputStream is, final Charset cha
}

public static String resourceToString(final String resource, final Charset charset, final ClassLoader cl)
throws IOException {
return inputStreamToString(cl.getResourceAsStream(resource), charset);
throws IOException {
return inputStreamToString(Objects.requireNonNull(cl.getResourceAsStream(resource)), charset);
}
}

0 comments on commit b0c185b

Please sign in to comment.