summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Trimble2013-04-22 16:50:30 (EDT)
committerIan Trimble2013-04-22 16:50:30 (EDT)
commiteb98560f04e8999462853ab6143ecea32480b32a (patch)
tree7e9aa8e8b3955fed0c21070faf0bcc09bfe6a1f9
parent3338e3bd78368de2f08363a2534e108742927dc8 (diff)
downloadwebtools.jsf-eb98560f04e8999462853ab6143ecea32480b32a.zip
webtools.jsf-eb98560f04e8999462853ab6143ecea32480b32a.tar.gz
webtools.jsf-eb98560f04e8999462853ab6143ecea32480b32a.tar.bz2
Bug 389917
JSFNonELAttributeValueValidator is slow on some files
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java53
1 files changed, 46 insertions, 7 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java
index 1ff250b..904f499 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facelet.core/src/org/eclipse/jst/jsf/facelet/core/internal/registry/taglib/JarFileFaceletTaglibLocator.java
@@ -66,8 +66,38 @@ public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
static
{
final List<IMatcher> matchers = new ArrayList<IMatcher>();
- matchers.add(_taglibGlassfishFinder);
- matchers.add(_taglibMetaInfFinder);
+ matchers.add( new IMatcher() {
+ public boolean matches(Object matchThis) {
+ if (matchThis instanceof JarEntry)
+ {
+ final String name = ((JarEntry) matchThis).getName();
+ if (name != null)
+ {
+ final int nameLength = name.length();
+ if (nameLength > ".taglib.xml".length() || !name.endsWith(".taglib.xml")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ return false;
+ }
+ if (nameLength > "META-INF/.taglib.xml".length()) //$NON-NLS-1$
+ {
+ if (_taglibMetaInfFinder.matches(matchThis))
+ {
+ return true;
+ }
+ if (nameLength > "com/sun/faces/metadata/taglib/.taglib.xml".length()) //$NON-NLS-1$
+ {
+ if (_taglibGlassfishFinder.matches(matchThis))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+ return false;
+ }
+ });
MATCHERS = Collections.unmodifiableList(matchers);
}
private static final String DISPLAYNAME = Messages.JarFileFaceletTaglibLocator_0;
@@ -120,14 +150,14 @@ public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
final List<LibJarEntry> tagLibsFound = new ArrayList<LibJarEntry>();
final Collection<? extends ClasspathJarFile> jars = _locator
.getJars(project);
+ long curTime = System.currentTimeMillis();
for (final ClasspathJarFile cpJarFile : jars)
{
- final JarFile jarFile = cpJarFile.getJarFile();
- if (jarFile != null)
- {
- tagLibsFound.addAll(processJar(cpJarFile, _jarEntryMatchers));
- }
+ tagLibsFound.addAll(processJar(cpJarFile, _jarEntryMatchers));
}
+ System.out.printf(
+ "Time spent processing jars: %d\n", //$NON-NLS-1$
+ Long.valueOf(System.currentTimeMillis()-curTime));
for (final LibJarEntry jarEntry : tagLibsFound)
{
final IFaceletTagRecord record = _factory.createRecords(jarEntry
@@ -218,6 +248,7 @@ public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
final List<IMatcher> jarEntryMatchers)
{
final List<LibJarEntry> tagLibsFound = new ArrayList<LibJarEntry>();
+ long curTime = System.currentTimeMillis();
final JarFile jarFile = cpJarFile.getJarFile();
try
{
@@ -289,6 +320,14 @@ public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
}
}
}
+ long time = System.currentTimeMillis()-curTime;
+ if (time > 10)
+ {
+ System.out.printf(
+ "Time spent in processJar for %s was %dms\n", //$NON-NLS-1$
+ cpJarFile.getPath(),
+ Long.valueOf(time));
+ }
return tagLibsFound;
}