Name: dbT83986 Date: 03/09/99
Trying to instantiate a URL using the constructor
URL(String, String, String) results in a NullPointerException
rather than the expected MalformedURLException if the following
values are supplied
import java.io.*;
import java.net.*;
public class URLTest
{
public static void main(String args[])
{
try{
URL u = new URL("http", "java.sun.com", null);
}
catch (MalformedURLException mue)
{
System.out.println("Caught MalformedURLException " + mue );
}
catch (Exception e)
{
System.out.println("Caught unexpected exception " + e );
}
}
}
Running the above code produces the output
security properties not found. using defaults.
Caught unexpected exception java.lang.NullPointerException:
output of java -fullversion is
java full version "JDK-1.2-V"
Suspect code is probably trying to parse the ref in file, without
first checking whether file is null.
(Review ID: 54723)
======================================================================
- duplicates
-
JDK-4101491 The java.net.URL constructor allows null host parameter for http and
- Closed