review request 7172551

Lance Andersen - Oracle Lance.Andersen at oracle.com
Thu Jun 7 22:35:40 UTC 2012


Hi Joe,

Thank you for the note.

Here is the diff 

ace2 51 =>hg diff DriverManager.java 
diff -r fc0e508b713f src/share/classes/java/sql/DriverManager.java
--- a/src/share/classes/java/sql/DriverManager.java	Thu Jun 07 01:01:09 2012 -0700
+++ b/src/share/classes/java/sql/DriverManager.java	Thu Jun 07 20:09:05 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.concurrent.CopyOnWriteArrayList;
+import sun.reflect.Reflection;
 
 
 /**
@@ -461,6 +462,15 @@
     }
 
     //------------------------------------------------------------------------
+    
+    // Internal method used to get the caller's class loader.
+    // Replaces the call to the native method
+    private static ClassLoader getCallerClassLoader() {
+        Class<?> cc = Reflection.getCallerClass(3);
+        ClassLoader cl = (cc != null) ? cc.getClassLoader() : null;
+        return cl;
+    }
+
 
     // Indicates whether the class object that would be created if the code calling
     // DriverManager is accessible.
@@ -604,8 +614,6 @@
         throw new SQLException("No suitable driver found for "+ url, "08001");
     }
 
-    /* Returns the caller's class loader, or null if none */
-    private static native ClassLoader getCallerClassLoader();
 
 }
 
 ace2 52 =>


Best
Lance

On Jun 7, 2012, at 6:03 PM, Joe Darcy wrote:

> Hi Lance,
> 
> On 6/7/2012 2:13 PM, Lance Andersen - Oracle wrote:
>> Thanks Chris, Alan, Joe, Mandy.
>> 
>> Joe I will update the copyright but will not plan on a webrev for that..
> 
> Sure.
> 
>> I thought line 470 was readable
>> 
>>          ClassLoader cl = cc != null ? cc.getClassLoader() : null;
> 
> I would have written this as
> 
> 
>    ClassLoader cl = (cc != null) ? cc.getClassLoader() : null;
> 
> The other reviewers accepted the old version so I'll leave it to your discretion about whether to change it or not.
> 
> Cheers,
> 
> -Joe
> 
>> 
>> I would prefer to get this back for now vs. make that change as part of an additional cleanup i have planned to DriverManager.
>> 
>>  as if I do this now, I would want to do another full  build and run of all of the tests.  I know Alan would like this back for jigsaw sooner rather than later.
>> 
>> I think I can streamline this code some more but would like to get this back  (as well as my other week old review requests ;-) ).
>> 
>> Are you Ok with just the copyright change for now?
>> 
>> 
>> Best
>> Lance
>> 
>> On Jun 7, 2012, at 4:49 PM, Mandy Chung wrote:
>> 
>>> Looks good.  It's a good clean up.
>>> 
>>> Mandy
>>> 
>>> On 6/7/2012 11:47 AM, Lance Andersen - Oracle wrote:
>>>> Hi all,
>>>> 
>>>> Another review request (to go with the others that are outstanding).
>>>> 
>>>> This is change is for jigsaw, where we are removing the native code used by DriverManager.  The webrev can be found at:
>>>> 
>>>> http://cr.openjdk.java.net/~lancea/7172551/webrev.00
>>>> 
>>>> Best,
>>>> Lance
>>>> 
>>>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>>>> Oracle Java Engineering
>>>> 1 Network Drive
>>>> Burlington, MA 01803
>>>> Lance.Andersen at oracle.com
>>>> 
>> 
>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen at oracle.com
>> 


Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com




More information about the core-libs-dev mailing list