View | Details | Raw Unified | Return to bug 56438
Collapse All | Expand All

(-)java/org/apache/catalina/startup/LocalStrings.properties (+3 lines)
Lines 124-131 Link Here
124
tldConfig.cce=Lifecycle event data object {0} is not a Context
124
tldConfig.cce=Lifecycle event data object {0} is not a Context
125
tldConfig.dirFail=Failed to process directory [{0}] for TLD files
125
tldConfig.dirFail=Failed to process directory [{0}] for TLD files
126
tldConfig.dirScan=Scanning for TLD files in directory [{0}]
126
tldConfig.dirScan=Scanning for TLD files in directory [{0}]
127
tldConfig.noTldInDir=No TLD files were found in directory [{0}].
127
tldConfig.execute=Error processing TLD files for context with name [{0}]
128
tldConfig.execute=Error processing TLD files for context with name [{0}]
128
tldConfig.jarFail=Failed to process JAR [{0}] for TLD files
129
tldConfig.jarFail=Failed to process JAR [{0}] for TLD files
130
tldConfig.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to the org.apache.catalina.startup.TldConfig.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
131
tldConfig.noTldSummary=At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
129
tldConfig.webinfFail=Failed to process TLD found at [{0}]
132
tldConfig.webinfFail=Failed to process TLD found at [{0}]
130
tldConfig.webinfScan=Scanning WEB-INF for TLD files in [{0}]
133
tldConfig.webinfScan=Scanning WEB-INF for TLD files in [{0}]
131
tldConfig.webxmlAdd=Adding path [{0}] for URI [{1}]
134
tldConfig.webxmlAdd=Adding path [{0}] for URI [{1}]
(-)java/org/apache/catalina/startup/TldConfig.java (-8 / +34 lines)
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
        if(objCallBack.scanFoundNoTLDs()){
275
            log.info(sm.getString("tldConfig.noTldSummary"));
276
        }
273
        // Now add all the listeners we found to the listeners for this context
277
        // Now add all the listeners we found to the listeners for this context
274
        String list[] = getTldListeners();
278
        String list[] = getTldListeners();
275
279
Lines 290-299 Link Here
290
    }
294
    }
291
295
292
    private class TldJarScannerCallback implements JarScannerCallback {
296
    private class TldJarScannerCallback implements JarScannerCallback {
293
297
        boolean tldFound = false;
298
        
294
        @Override
299
        @Override
295
        public void scan(JarURLConnection urlConn) throws IOException {
300
        public void scan(JarURLConnection urlConn) throws IOException {
296
            tldScanJar(urlConn);
301
            tldFound = tldScanJar(urlConn);
297
        }
302
        }
298
303
299
        @Override
304
        @Override
Lines 300-308 Link Here
300
        public void scan(File file) {
305
        public void scan(File file) {
301
            File metaInf = new File(file, "META-INF");
306
            File metaInf = new File(file, "META-INF");
302
            if (metaInf.isDirectory()) {
307
            if (metaInf.isDirectory()) {
303
                tldScanDir(metaInf);
308
                tldFound = tldScanDir(metaInf);
304
            }
309
            }
305
        }
310
        }
311
        
312
        private boolean scanFoundNoTLDs() {
313
            return !tldFound;
314
        }
306
    }
315
    }
307
316
308
    // -------------------------------------------------------- Private Methods
317
    // -------------------------------------------------------- Private Methods
Lines 432-439 Link Here
432
     *
441
     *
433
     * Keep in sync with o.a.j.comiler.TldLocationsCache
442
     * Keep in sync with o.a.j.comiler.TldLocationsCache
434
     */
443
     */
435
    private void tldScanDir(File start) {
444
    private boolean tldScanDir(File start) {
436
445
        boolean isFound = false;
446
        
437
        if (log.isTraceEnabled()) {
447
        if (log.isTraceEnabled()) {
438
            log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath()));
448
            log.trace(sm.getString("tldConfig.dirScan", start.getAbsolutePath()));
439
        }
449
        }
Lines 446-451 Link Here
446
                    tldScanDir(fileList[i]);
456
                    tldScanDir(fileList[i]);
447
                } else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) {
457
                } else if (fileList[i].getAbsolutePath().endsWith(TLD_EXT)) {
448
                    InputStream stream = null;
458
                    InputStream stream = null;
459
                    isFound = true;
449
                    try {
460
                    try {
450
                        stream = new FileInputStream(fileList[i]);
461
                        stream = new FileInputStream(fileList[i]);
451
                        XmlErrorHandler handler = tldScanStream(stream);
462
                        XmlErrorHandler handler = tldScanStream(stream);
Lines 466-471 Link Here
466
                }
477
                }
467
            }
478
            }
468
        }
479
        }
480
        if(!isFound){
481
            if (log.isDebugEnabled()) {
482
                log.debug(sm.getString("tldConfig.noTldInDir", start.getAbsolutePath()));
483
            }
484
        }
485
        return isFound;
469
    }
486
    }
470
487
471
    /*
488
    /*
Lines 476-485 Link Here
476
     * 
493
     * 
477
     * Keep in sync with o.a.j.comiler.TldLocationsCache
494
     * Keep in sync with o.a.j.comiler.TldLocationsCache
478
     */
495
     */
479
    private void tldScanJar(JarURLConnection jarConn) {
496
    private boolean tldScanJar(JarURLConnection jarConn) {
480
497
481
        Jar jar = null;
498
        Jar jar = null;
482
        InputStream is;
499
        InputStream is;
500
        boolean isFound = false;
483
        
501
        
484
        try {
502
        try {
485
            jar = JarFactory.newInstance(jarConn.getURL());
503
            jar = JarFactory.newInstance(jarConn.getURL());
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

Return to bug 56438