Returns the parsed tag library XML for the given resource path. @param tldResourcePath the TLD resource path @return the parsed tag library XML, or null if not found @throws JasperException if an error occurs during parsing
(TldResourcePath tldResourcePath)
| 131 | * @throws JasperException if an error occurs during parsing |
| 132 | */ |
| 133 | public TaglibXml getTaglibXml(TldResourcePath tldResourcePath) throws JasperException { |
| 134 | TaglibXmlCacheEntry cacheEntry = tldResourcePathTaglibXmlMap.get(tldResourcePath); |
| 135 | if (cacheEntry == null) { |
| 136 | return null; |
| 137 | } |
| 138 | long[] lastModified = getLastModified(tldResourcePath); |
| 139 | if (lastModified[0] != cacheEntry.getWebAppPathLastModified() || |
| 140 | lastModified[1] != cacheEntry.getEntryLastModified()) { |
| 141 | synchronized (cacheEntry) { |
| 142 | if (lastModified[0] != cacheEntry.getWebAppPathLastModified() || |
| 143 | lastModified[1] != cacheEntry.getEntryLastModified()) { |
| 144 | // Re-parse TLD |
| 145 | TaglibXml updatedTaglibXml; |
| 146 | try { |
| 147 | updatedTaglibXml = tldParser.parse(tldResourcePath); |
| 148 | } catch (IOException | SAXException e) { |
| 149 | throw new JasperException(e); |
| 150 | } |
| 151 | cacheEntry.setTaglibXml(updatedTaglibXml); |
| 152 | cacheEntry.setWebAppPathLastModified(lastModified[0]); |
| 153 | cacheEntry.setEntryLastModified(lastModified[1]); |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | return cacheEntry.getTaglibXml(); |
| 158 | } |
| 159 | |
| 160 | |
| 161 | private long[] getLastModified(TldResourcePath tldResourcePath) { |
no test coverage detected