Lines 19-24
Link Here
|
19 |
package org.apache.tomcat.util.digester; |
19 |
package org.apache.tomcat.util.digester; |
20 |
|
20 |
|
21 |
|
21 |
|
|
|
22 |
import java.net.URL; |
23 |
import java.net.URLClassLoader; |
24 |
|
25 |
import org.apache.juli.logging.Log; |
22 |
import org.xml.sax.Attributes; |
26 |
import org.xml.sax.Attributes; |
23 |
|
27 |
|
24 |
|
28 |
|
Lines 141-151
Link Here
|
141 |
} |
145 |
} |
142 |
|
146 |
|
143 |
// Instantiate the new object and push it on the context stack |
147 |
// Instantiate the new object and push it on the context stack |
144 |
Class<?> clazz = digester.getClassLoader().loadClass(realClassName); |
148 |
ClassLoader classLoader = digester.getClassLoader(); |
145 |
Object instance = clazz.newInstance(); |
149 |
try { |
146 |
digester.push(instance); |
150 |
Class<?> clazz = classLoader.loadClass(realClassName); |
|
|
151 |
Object instance = clazz.newInstance(); |
152 |
digester.push(instance); |
153 |
} catch (ClassNotFoundException t) { |
154 |
Log log = digester.log; |
155 |
log.warn(t.getMessage(), t); |
156 |
showClassPath(classLoader, 0, log); |
157 |
throw t; |
158 |
} |
147 |
} |
159 |
} |
148 |
|
160 |
|
|
|
161 |
public static void showClassPath(ClassLoader classLoader, |
162 |
int antiRecursion, Log log) { |
163 |
StringBuffer extraInfo = new StringBuffer("ClassLoader " + classLoader |
164 |
+ "\n"); |
165 |
if (classLoader instanceof URLClassLoader) { |
166 |
URLClassLoader ucl = (URLClassLoader) classLoader; |
167 |
URL[] urls = ucl.getURLs(); |
168 |
if (null == urls || 0 == urls.length) { |
169 |
extraInfo.append("null == urls"); |
170 |
} else { |
171 |
int i = 0; |
172 |
for (i = 0; i < urls.length; i++) { |
173 |
URL url = urls[i]; |
174 |
extraInfo.append(url.toString()).append(",\n"); |
175 |
} |
176 |
log.warn(extraInfo); |
177 |
} |
178 |
ClassLoader parent = ucl.getParent(); |
179 |
if (null != parent) { |
180 |
if (!parent.equals(ucl)) { |
181 |
if (7 < antiRecursion) { |
182 |
log.error("too many recursions"); |
183 |
} else { |
184 |
antiRecursion++; |
185 |
log.warn("\nParent " + antiRecursion + ":"); |
186 |
showClassPath(parent, antiRecursion, log); |
187 |
} |
188 |
} |
189 |
} |
190 |
} |
191 |
} |
149 |
|
192 |
|
150 |
/** |
193 |
/** |
151 |
* Process the end of this element. |
194 |
* Process the end of this element. |