You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/03/19 21:46:15 UTC
svn commit: r1302649 -
/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Author: markt
Date: Mon Mar 19 20:46:15 2012
New Revision: 1302649
URL: http://svn.apache.org/viewvc?rev=1302649&view=rev
Log:
Make implementation of getParentClassLoader() consistent with the other implementations across the code base.
Modified:
tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1302649&r1=1302648&r2=1302649&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Mon Mar 19 20:46:15 2012
@@ -177,7 +177,10 @@ public class Catalina {
}
public ClassLoader getParentClassLoader() {
- return parentClassLoader;
+ if (parentClassLoader != null) {
+ return (parentClassLoader);
+ }
+ return ClassLoader.getSystemClassLoader();
}
public void setServer(Server server) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1302649 - /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Posted by Mark Thomas <ma...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 20/03/2012 01:35, Christopher Schultz wrote:
> Mark,
>
> On 3/19/12 4:46 PM, markt@apache.org wrote:
>> Author: markt Date: Mon Mar 19 20:46:15 2012 New Revision:
>> 1302649
>>
>> URL: http://svn.apache.org/viewvc?rev=1302649&view=rev Log: Make
>> implementation of getParentClassLoader() consistent with the
>> other implementations across the code base.
>>
>> Modified:
>> tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
>>
>> Modified:
>> tomcat/trunk/java/org/apache/catalina/startup/Catalina.java URL:
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1302649&r1=1302648&r2=1302649&view=diff
>>
>>
==============================================================================
>> --- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
>> (original) +++
>> tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Mon
>> Mar 19 20:46:15 2012 @@ -177,7 +177,10 @@ public class Catalina
>> { }
>>
>> public ClassLoader getParentClassLoader() { - return
>> parentClassLoader; + if (parentClassLoader != null) { +
>> return (parentClassLoader); + } + return
>> ClassLoader.getSystemClassLoader(); }
>
> Not sure if this nit is too find to pick, but ClassLoader Javadoc
> says that if getParent() returns null, then the parent is the
> "bootstrap" ClassLoader. There seems to be a difference between
> "system" and "bootstrap" but it's not evident merely from reading
> the javadoc.
I am well aware of the difference.
> In this case, system ~= bootstrap, but I wanted to make sure that
> was an intentional decision. On the other hand, there's no way to
> directly get the bootstrap ClassLoader via the API anyway, so I'm
> not sure it matters at all.
The patch was intentional. The aim was to make the handling consistent.
There may be a separate issue around bootstrap vs system in osgi
environments but we can cross that bridge when we come to it.
Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPaEqSAAoJEBDAHFovYFnnKegQAJwM7fSX/kgLCEU2dpvEJKcp
34p1YXUTqqCS3pYCze/0z3smLf68RKBoMpXy9F361K8FZk62bG7LbC8nTw15yLWc
W75xH+bFJrODQ/+N9b91Q3mwkn1idBgogNphdNwWL5j7G0h4b2IHhUavKlZ4e62O
HnpOqv/WrU192dtgPNFOpC7MJlI6ZLUamhABtE+iMdZZfpiMnoNoVvvCQhPoqNe/
k6X1d30OQxAhy+FKiWkuJKO4af1vbuY5fyuKmkqAb0PxeY3BRLksn0CfZAS8+yhz
lh+VWIyacmgbQZXf3gWEbcIpU+nqyNdl0CbmaYiELbAtWvxgnJCWcC8a5RVS3k5t
eZbay3acX0+njEs3R6FCNVJiAwC0gcfQngu9phLyHWSNr8vUtyV0QFaYyX2No2hV
JV5ZZl2y1oPanXixcAaquYEYeP66z2KfXb7SohaD8JWnCXosy1QmXawGwqMdXDKm
yrh78SyfRTSLHz9rW5NdVWwGPe08Zg06cwf1qT08HUiBMZiZwnc8rjH6PoeUGW06
O21gp1w25Ee/dyEBe7wXbP47bhMc3tYT9agy1b07Roxaqv4g0nc7MFueeZUsC0Dq
55Vs3Wg148pyecXu6b1LrJqENsUfCVbnKEiukF4Yxyq5TMPL63NF7TG/x8yhELyq
wcdjNRHVTs0EQtkuRkBn
=uaUd
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1302649 - /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Chuck,
On 3/19/12 9:53 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net]
>> Subject: Re: svn commit: r1302649 -
>> /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
>
>> There seems to be a difference between "system" and "bootstrap" but
>> it's not evident merely from reading the javadoc.
>
> The bootstrap classloader (aka null or primordial classloader) is the
> one the JVM uses to load the standard JRE classes - the ones in
> rt.jar and a few other places; it cannot be overridden. The system
> classloader is the one that handles the classpath setting, and can be
> specified by system property if you don't want the default behavior.
> The parent of all classloaders is eventually the bootstrap
> classloader, simply because that's what you get when the classloader
> reference is null.
>
>> In this case, system ~= bootstrap
>
> I have no idea what "~=" means, but it is never true that the system
> classloader is the same as the bootstrap classloader.
Yeah, I meant that this code uses "null" to mean "parent is the system
ClassLoader" while the documentation for ClassLoader says that "null"
means "parent is the bootstrap ClassLoader".
The behavior established by this commit would be surprising to me given
the javadocs.
-chris
RE: svn commit: r1302649 -
/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Subject: Re: svn commit: r1302649 - /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> There seems to be a difference between "system" and "bootstrap"
> but it's not evident merely from reading the javadoc.
The bootstrap classloader (aka null or primordial classloader) is the one the JVM uses to load the standard JRE classes - the ones in rt.jar and a few other places; it cannot be overridden. The system classloader is the one that handles the classpath setting, and can be specified by system property if you don't want the default behavior. The parent of all classloaders is eventually the bootstrap classloader, simply because that's what you get when the classloader reference is null.
> In this case, system ~= bootstrap
I have no idea what "~=" means, but it is never true that the system classloader is the same as the bootstrap classloader.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Re: svn commit: r1302649 - /tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,
On 3/19/12 4:46 PM, markt@apache.org wrote:
> Author: markt
> Date: Mon Mar 19 20:46:15 2012
> New Revision: 1302649
>
> URL: http://svn.apache.org/viewvc?rev=1302649&view=rev
> Log:
> Make implementation of getParentClassLoader() consistent with the other implementations across the code base.
>
> Modified:
> tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
>
> Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1302649&r1=1302648&r2=1302649&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Mon Mar 19 20:46:15 2012
> @@ -177,7 +177,10 @@ public class Catalina {
> }
>
> public ClassLoader getParentClassLoader() {
> - return parentClassLoader;
> + if (parentClassLoader != null) {
> + return (parentClassLoader);
> + }
> + return ClassLoader.getSystemClassLoader();
> }
Not sure if this nit is too find to pick, but ClassLoader Javadoc says
that if getParent() returns null, then the parent is the "bootstrap"
ClassLoader. There seems to be a difference between "system" and
"bootstrap" but it's not evident merely from reading the javadoc.
In this case, system ~= bootstrap, but I wanted to make sure that was an
intentional decision. On the other hand, there's no way to directly get
the bootstrap ClassLoader via the API anyway, so I'm not sure it matters
at all.
-chris