src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/URLReader.java

Print this page

        

*** 28,37 **** --- 28,38 ---- import java.io.CharArrayReader; import java.io.IOException; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; + import java.util.Objects; import jdk.nashorn.internal.runtime.Source; /** * A Reader that reads from a URL. Used to make sure that the reader * reads content from given URL and can be trusted to do so.
*** 75,86 **** * @param url URL for this URLReader * @param cs Charset used to convert bytes to chars * @throws NullPointerException if url is null */ public URLReader(final URL url, final Charset cs) { ! // null check ! url.getClass(); this.url = url; this.cs = cs; } @Override --- 76,86 ---- * @param url URL for this URLReader * @param cs Charset used to convert bytes to chars * @throws NullPointerException if url is null */ public URLReader(final URL url, final Charset cs) { ! Objects.requireNonNull(url); this.url = url; this.cs = cs; } @Override