~ubuntu-branches/ubuntu/precise/tomcat7/precise-proposed

« back to all changes in this revision

Viewing changes to java/org/apache/jasper/JspCompilationContext.java

  • Committer: Bazaar Package Importer
  • Author(s): tony mancill
  • Date: 2011-07-25 22:58:33 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110725225833-1t773ak3y3g9utm2
Tags: 7.0.19-1
* Team upload.
* New upstream release.
  - Includes fix for CVE-2011-2526 (Closes: #634992)
* Remove patch for CVE-2011-2204 (included upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
295
295
                // May not be in a JAR in some IDE environments
296
296
                result = context.getResource(canonicalURI(res));
297
297
            }
298
 
        } else if (res.startsWith("jar:file:")) {
 
298
        } else if (res.startsWith("jar:jndi:")) {
299
299
                // This is a tag file packaged in a jar that is being checked
300
300
                // for a dependency
301
301
                result = new URL(res);
385
385
        return jspUri;
386
386
    }
387
387
 
 
388
    /**
 
389
     * @deprecated Will be removed in Tomcat 8.0.x. Use
 
390
     * {@link #getLastModified(String)} instead.
 
391
     */
 
392
    @Deprecated
388
393
    public long getJspLastModified() {
389
394
        long result = -1;
390
395
        URLConnection uc = null;
422
427
        return result;
423
428
    }
424
429
 
 
430
 
 
431
    public Long getLastModified(String resource) {
 
432
        long result = -1;
 
433
        URLConnection uc = null;
 
434
        try {
 
435
            URL jspUrl = getResource(resource);
 
436
            if (jspUrl == null) {
 
437
                incrementRemoved();
 
438
                return Long.valueOf(result);
 
439
            }
 
440
            uc = jspUrl.openConnection();
 
441
            if (uc instanceof JarURLConnection) {
 
442
                result = ((JarURLConnection) uc).getJarEntry().getTime();
 
443
            } else {
 
444
                result = uc.getLastModified();
 
445
            }
 
446
        } catch (IOException e) {
 
447
            if (log.isDebugEnabled()) {
 
448
                log.debug(Localizer.getMessage(
 
449
                        "jsp.error.lastModified", getJspFile()), e);
 
450
            }
 
451
            result = -1;
 
452
        } finally {
 
453
            if (uc != null) {
 
454
                try {
 
455
                    uc.getInputStream().close();
 
456
                } catch (IOException e) {
 
457
                    if (log.isDebugEnabled()) {
 
458
                        log.debug(Localizer.getMessage(
 
459
                                "jsp.error.lastModified", getJspFile()), e);
 
460
                    }
 
461
                    result = -1;
 
462
                }
 
463
            }
 
464
        }
 
465
        return Long.valueOf(result);
 
466
    }
 
467
 
425
468
    public boolean isTagFile() {
426
469
        return isTagFile;
427
470
    }