atom feed3 messages in org.apache.tomcat.devRe: svn commit: r1242101 - in /tomcat...
FromSent OnAttachments
mar...@apache.orgFeb 8, 2012 1:19 pm 
Konstantin KolinkoMar 20, 2012 8:40 am 
Mark ThomasMar 20, 2012 1:14 pm 
Subject:Re: svn commit: r1242101 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/core/StandardServer.java java/org/apache/catalina/util/ExtensionValidator.java webapps/docs/changelog.xml
From:Mark Thomas (mar@apache.org)
Date:Mar 20, 2012 1:14:54 pm
List:org.apache.tomcat.dev

On 20/03/2012 15:41, Konstantin Kolinko wrote:

1). Why isn't is starting with this.getParentClassLoader(); ?

The actual shared classloader is the one used in WebappLoader#createClassLoader(). I'd say that calling Server.getParentClassLoader() will be closer to the truth here.

E.g. Tomcat class creates and calls Server instance directly, without relying on Catalina. So using Server.getParentClassLoader() seems to be better here.

+1 to that change.

+ // Walk the class loader hierarchy. Stop at the system class
loader. + // This will add the shared (if present) and common class loaders + while (cl != ClassLoader.getSystemClassLoader()) {

2) It should not hurt to move ClassLoader.getSystemClassLoader() out of the loop. This method involves a SecurityManager check and it is better to do it once.

+1.

+ if (cl instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader) cl).getURLs(); + for (URL url : urls) { + if (url.getProtocol().equals("file")) { + try { + File f = new File (url.toURI()); + if (f.isFile() && + f.getName().endsWith(".jar")) { + ExtensionValidator.addSystemResource(f);

3) The above is a static method and it does not check for duplicates.

It would be a substantial change to ExtensionValidator to fix it, so I submitted the following issue: https://issues.apache.org/bugzilla/show_bug.cgi?id=52952

Comments on bug.

Mark