URL.java: remove unnecessary reflection

Helps detecting lacking classes at compilation time if those classes
are deleted

Bug: 29569605
Change-Id: I720d864e79599fca3c111b8055a73e4ac7f5201e
diff --git a/ojluni/src/main/java/java/net/URL.java b/ojluni/src/main/java/java/net/URL.java
index 8af827c..15d09d1 100755
--- a/ojluni/src/main/java/java/net/URL.java
+++ b/ojluni/src/main/java/java/net/URL.java
@@ -1193,15 +1193,15 @@
             // Makes okhttp the default http/https handler
             if (handler == null) {
                 try {
+                    // BEGIN android-changed
+                    // Use of okhttp for http and https
+                    // Removed unnecessary use of reflection for sun classes
                     if (protocol.equals("file")) {
-                        handler = (URLStreamHandler)Class.
-                            forName("sun.net.www.protocol.file.Handler").newInstance();
+                        handler = new sun.net.www.protocol.file.Handler();
                     } else if (protocol.equals("ftp")) {
-                        handler = (URLStreamHandler)Class.
-                            forName("sun.net.www.protocol.ftp.Handler").newInstance();
+                        handler = new sun.net.www.protocol.ftp.Handler();
                     } else if (protocol.equals("jar")) {
-                        handler = (URLStreamHandler)Class.
-                            forName("sun.net.www.protocol.jar.Handler").newInstance();
+                        handler = new sun.net.www.protocol.jar.Handler();
                     } else if (protocol.equals("http")) {
                         handler = (URLStreamHandler)Class.
                             forName("com.android.okhttp.HttpHandler").newInstance();
@@ -1209,6 +1209,7 @@
                         handler = (URLStreamHandler)Class.
                             forName("com.android.okhttp.HttpsHandler").newInstance();
                     }
+                    // END android-changed
                 } catch (Exception e) {
                     throw new AssertionError(e);
                 }