summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Trimble2012-09-18 18:50:46 (EDT)
committerIan Trimble2012-09-18 18:50:46 (EDT)
commit3d168a9b84e6602ad64d467ef88732d2682bedab (patch)
treef2d5920f39a247947abf628587c2829f052a16be
parent2312a9f3faf575ae3ef29e890606c93c03818343 (diff)
downloadwebtools.jsf-3d168a9b84e6602ad64d467ef88732d2682bedab.zip
webtools.jsf-3d168a9b84e6602ad64d467ef88732d2682bedab.tar.gz
webtools.jsf-3d168a9b84e6602ad64d467ef88732d2682bedab.tar.bz2
Bug 380306 - [hotbug_request]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.java75
1 files changed, 67 insertions, 8 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 01677e1..10b99d0 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
@@ -64,9 +64,64 @@ public class JarFileFaceletTaglibLocator extends AbstractFaceletTaglibLocator
static
{
final List<IMatcher> matchers = new ArrayList<IMatcher>();
- matchers.add(_taglibGlassfishFinder);
- matchers.add(_taglibMetaInfFinder);
- MATCHERS = Collections.unmodifiableList(matchers);
+// 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.add( new IMatcher() {
+// public boolean matches(Object matchThis) {
+// if (matchThis instanceof JarEntry)
+// {
+// try
+// {
+// String name = ((JarEntry) matchThis).getName();
+// if (name != null && name.length() > "META-INF/.taglib.xml".length()) //$NON-NLS-1$
+// {
+// return _taglibMetaInfFinder.matches(matchThis);
+//
+// }
+// } catch (Exception e)
+// {
+// JSFCommonPlugin.log(e, "While matching jar entry: "+matchThis); //$NON-NLS-1$
+// }
+// }
+// return false;
+// }
+// });
+ MATCHERS = Collections.unmodifiableList(matchers);
}
private static final String DISPLAYNAME = Messages.JarFileFaceletTaglibLocator_0;
private static final String ID = JarFileFaceletTaglibLocator.class
@@ -118,14 +173,12 @@ 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", System.currentTimeMillis()-curTime); //$NON-NLS-1$
for (final LibJarEntry jarEntry : tagLibsFound)
{
final IFaceletTagRecord record = _factory.createRecords(jarEntry
@@ -216,6 +269,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
{
@@ -272,6 +326,11 @@ 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", cpJarFile.getPath(), time); //$NON-NLS-1$
+ }
return tagLibsFound;
}