You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2003/02/19 08:03:46 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java
billbarker 2003/02/18 23:03:45
Modified: jasper2/src/share/org/apache/jasper
JspCompilationContext.java
jasper2/src/share/org/apache/jasper/compiler
TagFileProcessor.java
Log:
Fix for most of the pre-compile problems with TC-5.
The basic problem is that with Jspc, there is no 'RuntimeContext'. I've patched around the worst parts of it, but I'm the first to admit that I don't know Jasper down to this sort of level.
Jan, Kin-Man, please review (and feel free to -1 if I've broken something).
Revision Changes Path
1.32 +5 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
Index: JspCompilationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- JspCompilationContext.java 12 Feb 2003 16:37:11 -0000 1.31
+++ JspCompilationContext.java 19 Feb 2003 07:03:44 -0000 1.32
@@ -201,6 +201,8 @@
public ClassLoader getClassLoader() {
if( loader != null )
return loader;
+ if( rctxt == null)
+ return getClass().getClassLoader();
return rctxt.getParentClassLoader();
}
1.40 +62 -49 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java
Index: TagFileProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- TagFileProcessor.java 5 Feb 2003 23:35:21 -0000 1.39
+++ TagFileProcessor.java 19 Feb 2003 07:03:45 -0000 1.40
@@ -412,60 +412,73 @@
JspCompilationContext ctxt = compiler.getCompilationContext();
JspRuntimeContext rctxt = ctxt.getRuntimeContext();
- JspServletWrapper wrapper =
+ JspServletWrapper wrapper = null;
+ if( rctxt != null ) {
+ wrapper =
(JspServletWrapper) rctxt.getWrapper(tagFilePath);
- synchronized(rctxt) {
- if (wrapper == null) {
- wrapper = new JspServletWrapper(ctxt.getServletContext(),
- ctxt.getOptions(),
- tagFilePath,
- tagInfo,
- ctxt.getRuntimeContext(),
- (JarFile) ctxt.getTagFileJars().get(tagFilePath));
- rctxt.addWrapper(tagFilePath,wrapper);
+ synchronized(rctxt) {
+ if (wrapper == null) {
+ wrapper = new JspServletWrapper(ctxt.getServletContext(),
+ ctxt.getOptions(),
+ tagFilePath,
+ tagInfo,
+ ctxt.getRuntimeContext(),
+ (JarFile) ctxt.getTagFileJars().get(tagFilePath));
+ rctxt.addWrapper(tagFilePath,wrapper);
+ }
}
+ } else {
+ wrapper = new JspServletWrapper(ctxt.getServletContext(),
+ ctxt.getOptions(),
+ tagFilePath,
+ tagInfo,
+ ctxt.getRuntimeContext(),
+ (JarFile)ctxt.getTagFileJars().get(tagFilePath)
+ );
+ }
+
- Class tagClazz;
- int tripCount = wrapper.incTripCount();
- try {
- if (tripCount > 0) {
- // When tripCount is greater than zero, a circular
- // dependency exists. The circularily dependant tag
- // file is compiled in prototype mode, to avoid infinite
- // recursion.
+ Class tagClazz;
+ int tripCount = wrapper.incTripCount();
+ try {
+ if (tripCount > 0) {
+ // When tripCount is greater than zero, a circular
+ // dependency exists. The circularily dependant tag
+ // file is compiled in prototype mode, to avoid infinite
+ // recursion.
- JspServletWrapper tempWrapper
- = new JspServletWrapper(ctxt.getServletContext(),
- ctxt.getOptions(),
- tagFilePath,
- tagInfo,
- ctxt.getRuntimeContext(),
- (JarFile) ctxt.getTagFileJars().get(tagFilePath));
- tagClazz = tempWrapper.loadTagFilePrototype();
- tempVector.add(
- tempWrapper.getJspEngineContext().getCompiler());
- } else {
- tagClazz = wrapper.loadTagFile();
- }
- } finally {
- wrapper.decTripCount();
+ JspServletWrapper tempWrapper
+ = new JspServletWrapper(ctxt.getServletContext(),
+ ctxt.getOptions(),
+ tagFilePath,
+ tagInfo,
+ ctxt.getRuntimeContext(),
+ (JarFile) ctxt.getTagFileJars().get(tagFilePath));
+ tagClazz = tempWrapper.loadTagFilePrototype();
+ tempVector.add(
+ tempWrapper.getJspEngineContext().getCompiler());
+ } else {
+ tagClazz = wrapper.loadTagFile();
}
-
- // Add the dependants for this tag file to its parent's
- // dependant list.
- PageInfo pageInfo = wrapper.getJspEngineContext().getCompiler().
- getPageInfo();
- if (pageInfo != null) {
- Iterator iter = pageInfo.getDependants().iterator();
- if (iter.hasNext()) {
- parentPageInfo.addDependant((String)iter.next());
- }
+ } finally {
+ wrapper.decTripCount();
+ }
+
+ // Add the dependants for this tag file to its parent's
+ // dependant list.
+ PageInfo pageInfo = wrapper.getJspEngineContext().getCompiler().
+ getPageInfo();
+ if (pageInfo != null) {
+ Iterator iter = pageInfo.getDependants().iterator();
+ if (iter.hasNext()) {
+ parentPageInfo.addDependant((String)iter.next());
}
-
- return tagClazz;
}
+
+ return tagClazz;
}
+
/*
* A visitor that scan the page, looking for tag handlers that are tag
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org