Lines 266-275
Link Here
|
266 |
|
266 |
|
267 |
// Stages 3b & 4 |
267 |
// Stages 3b & 4 |
268 |
JarScanner jarScanner = context.getJarScanner(); |
268 |
JarScanner jarScanner = context.getJarScanner(); |
|
|
269 |
|
270 |
TldJarScannerCallback objCallBack = new TldJarScannerCallback(); |
269 |
jarScanner.scan(context.getServletContext(), |
271 |
jarScanner.scan(context.getServletContext(), |
270 |
context.getLoader().getClassLoader(), |
272 |
context.getLoader().getClassLoader(), |
271 |
new TldJarScannerCallback(), noTldJars); |
273 |
objCallBack, noTldJars); |
272 |
|
274 |
|
|
|
275 |
if(objCallBack.scanFoundNoTLDs()){ |
276 |
log.info(sm.getString("tldConfig.noTldSummary")); |
277 |
} |
278 |
|
273 |
// Now add all the listeners we found to the listeners for this context |
279 |
// Now add all the listeners we found to the listeners for this context |
274 |
String list[] = getTldListeners(); |
280 |
String list[] = getTldListeners(); |
275 |
|
281 |
|
Lines 290-299
Link Here
|
290 |
} |
296 |
} |
291 |
|
297 |
|
292 |
private class TldJarScannerCallback implements JarScannerCallback { |
298 |
private class TldJarScannerCallback implements JarScannerCallback { |
293 |
|
299 |
boolean tldFound = false; |
|
|
300 |
|
294 |
@Override |
301 |
@Override |
295 |
public void scan(JarURLConnection urlConn) throws IOException { |
302 |
public void scan(JarURLConnection urlConn) throws IOException { |
296 |
tldScanJar(urlConn); |
303 |
tldFound = tldScanJar(urlConn); |
297 |
} |
304 |
} |
298 |
|
305 |
|
299 |
@Override |
306 |
@Override |
Lines 300-308
Link Here
|
300 |
public void scan(File file) { |
307 |
public void scan(File file) { |
301 |
File metaInf = new File(file, "META-INF"); |
308 |
File metaInf = new File(file, "META-INF"); |
302 |
if (metaInf.isDirectory()) { |
309 |
if (metaInf.isDirectory()) { |
303 |
tldScanDir(metaInf); |
310 |
tldFound = tldScanDir(metaInf); |
304 |
} |
311 |
} |
305 |
} |
312 |
} |
|
|
313 |
|
314 |
private boolean scanFoundNoTLDs() { |
315 |
return !tldFound; |
316 |
} |
306 |
} |
317 |
} |
307 |
|
318 |
|
308 |
// -------------------------------------------------------- Private Methods |
319 |
// -------------------------------------------------------- Private Methods |
Lines 432-439
Link Here
|
432 |
* |
443 |
* |
433 |
* Keep in sync with o.a.j.comiler.TldLocationsCache |
444 |
* Keep in sync with o.a.j.comiler.TldLocationsCache |
434 |
*/ |
445 |
*/ |
435 |
private void tldScanDir(File start) { |
446 |
private boolean tldScanDir(File start) { |
436 |
|
447 |
boolean isFound = false; |
437 |
if (log.isTraceEnabled()) { |
448 |
if (log.isTraceEnabled()) { |
438 |
log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath())); |
449 |
log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath())); |
439 |
} |
450 |
} |
Lines 446-451
Link Here
|
446 |
tldScanDir(fileList[i]); |
457 |
tldScanDir(fileList[i]); |
447 |
} else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) { |
458 |
} else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) { |
448 |
InputStream stream = null; |
459 |
InputStream stream = null; |
|
|
460 |
isFound = true; |
449 |
try { |
461 |
try { |
450 |
stream = new FileInputStream(fileList[i]); |
462 |
stream = new FileInputStream(fileList[i]); |
451 |
XmlErrorHandler handler = tldScanStream(stream); |
463 |
XmlErrorHandler handler = tldScanStream(stream); |
Lines 465-471
Link Here
|
465 |
} |
477 |
} |
466 |
} |
478 |
} |
467 |
} |
479 |
} |
468 |
} |
480 |
} |
|
|
481 |
if(!isFound){ |
482 |
if (log.isDebugEnabled()) { |
483 |
log.debug(sm.getString("tldConfig.noTldInDir", start.getAbsolutePath())); |
484 |
} |
485 |
} |
486 |
return isFound; |
469 |
} |
487 |
} |
470 |
|
488 |
|
471 |
/* |
489 |
/* |
Lines 476-486
Link Here
|
476 |
* |
494 |
* |
477 |
* Keep in sync with o.a.j.comiler.TldLocationsCache |
495 |
* Keep in sync with o.a.j.comiler.TldLocationsCache |
478 |
*/ |
496 |
*/ |
479 |
private void tldScanJar(JarURLConnection jarConn) { |
497 |
private boolean tldScanJar(JarURLConnection jarConn) { |
480 |
|
498 |
|
481 |
Jar jar = null; |
499 |
Jar jar = null; |
482 |
InputStream is; |
500 |
InputStream is; |
483 |
|
501 |
boolean isFound = false; |
484 |
try { |
502 |
try { |
485 |
jar = JarFactory.newInstance(jarConn.getURL()); |
503 |
jar = JarFactory.newInstance(jarConn.getURL()); |
486 |
|
504 |
|
Lines 489-494
Link Here
|
489 |
while (entryName != null) { |
507 |
while (entryName != null) { |
490 |
if (entryName.startsWith("META-INF/") && |
508 |
if (entryName.startsWith("META-INF/") && |
491 |
entryName.endsWith(".tld")) { |
509 |
entryName.endsWith(".tld")) { |
|
|
510 |
isFound = true; |
492 |
is = null; |
511 |
is = null; |
493 |
try { |
512 |
try { |
494 |
is = jar.getEntryInputStream(); |
513 |
is = jar.getEntryInputStream(); |
Lines 507-512
Link Here
|
507 |
jar.nextEntry(); |
526 |
jar.nextEntry(); |
508 |
entryName = jar.getEntryName(); |
527 |
entryName = jar.getEntryName(); |
509 |
} |
528 |
} |
|
|
529 |
if(!isFound){ |
530 |
if (log.isDebugEnabled()) { |
531 |
log.debug(sm.getString("tldConfig.noTldInJar", |
532 |
jarConn.getURL().getFile())); |
533 |
} |
534 |
} |
510 |
} catch (IOException ioe) { |
535 |
} catch (IOException ioe) { |
511 |
log.warn(sm.getString("tldConfig.jarFail", jarConn.getURL()), ioe); |
536 |
log.warn(sm.getString("tldConfig.jarFail", jarConn.getURL()), ioe); |
512 |
} finally { |
537 |
} finally { |
Lines 514-519
Link Here
|
514 |
jar.close(); |
539 |
jar.close(); |
515 |
} |
540 |
} |
516 |
} |
541 |
} |
|
|
542 |
return isFound; |
517 |
} |
543 |
} |
518 |
|
544 |
|
519 |
|
545 |
|