ASF Bugzilla – Attachment 36186 Details for
Bug 62757
JspCompilationContext is unable to compile class for JSP due to a null tagHandlerClass in Generator.TagHandlerInfo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Alternative patch
bug62757-tc9-v1.patch (text/plain), 6.16 KB, created by
Mark Thomas
on 2018-10-02 20:43:28 UTC
(
hide
)
Description:
Alternative patch
Filename:
MIME Type:
Creator:
Mark Thomas
Created:
2018-10-02 20:43:28 UTC
Size:
6.16 KB
patch
obsolete
>Index: java/org/apache/jasper/compiler/JspRuntimeContext.java >=================================================================== >--- java/org/apache/jasper/compiler/JspRuntimeContext.java (revision 1842653) >+++ java/org/apache/jasper/compiler/JspRuntimeContext.java (working copy) >@@ -378,8 +378,7 @@ > for (int i = 0; i < wrappers.length; i++ ) { > JspServletWrapper jsw = (JspServletWrapper)wrappers[i]; > JspCompilationContext ctxt = jsw.getJspEngineContext(); >- // JspServletWrapper also synchronizes on this when >- // it detects it has to do a reload >+ // Sync on JspServletWrapper when calling ctxt.compile() > synchronized(jsw) { > try { > ctxt.compile(); >Index: java/org/apache/jasper/compiler/TagFileProcessor.java >=================================================================== >--- java/org/apache/jasper/compiler/TagFileProcessor.java (revision 1842653) >+++ java/org/apache/jasper/compiler/TagFileProcessor.java (working copy) >@@ -543,12 +543,11 @@ > wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt > .getOptions(), tagFilePath, tagInfo, ctxt > .getRuntimeContext(), tagJar); >- rctxt.addWrapper(wrapperUri, wrapper); >- > // Use same classloader and classpath for compiling tag files > wrapper.getJspEngineContext().setClassLoader( > ctxt.getClassLoader()); > wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath()); >+ rctxt.addWrapper(wrapperUri, wrapper); > } else { > // Make sure that JspCompilationContext gets the latest TagInfo > // for the tag file. TagInfo instance was created the last >Index: java/org/apache/jasper/servlet/JspServletWrapper.java >=================================================================== >--- java/org/apache/jasper/servlet/JspServletWrapper.java (revision 1842653) >+++ java/org/apache/jasper/servlet/JspServletWrapper.java (working copy) >@@ -89,7 +89,6 @@ > private long available = 0L; > private final ServletConfig config; > private final Options options; >- private volatile boolean firstTime = true; > /** Whether the servlet needs reloading on next access */ > private volatile boolean reload = true; > private final boolean isTagFile; >@@ -158,7 +157,7 @@ > } > > private boolean getReloadInternal() { >- return firstTime || reload && !ctxt.getRuntimeContext().isCompileCheckInProgress(); >+ return reload && !ctxt.getRuntimeContext().isCompileCheckInProgress(); > } > > public Servlet getServlet() throws ServletException { >@@ -171,11 +170,11 @@ > * possible (see BZ 62603) for a race condition to cause failures > * if a Servlet or tag is reloaded while a compile check is running > */ >- if (getReloadInternal()) { >+ if (getReloadInternal() || theServlet == null) { > synchronized (this) { > // Synchronizing on jsw enables simultaneous loading > // of different pages, but not the same page. >- if (getReloadInternal()) { >+ if (getReloadInternal() || theServlet == null) { > // This is to maintain the original protocol. > destroy(); > >@@ -193,7 +192,7 @@ > > servlet.init(config); > >- if (!firstTime) { >+ if (theServlet != null) { > ctxt.getRuntimeContext().incrementJspReloadCount(); > } > >@@ -257,10 +256,11 @@ > if (ctxt.isRemoved()) { > throw new FileNotFoundException(jspUri); > } >- if (options.getDevelopment() || firstTime ) { >+ if (options.getDevelopment() || tagHandlerClass == null) { > synchronized (this) { >- firstTime = false; >- ctxt.compile(); >+ if (options.getDevelopment() || tagHandlerClass == null) { >+ ctxt.compile(); >+ } > } > } else { > if (compileException != null) { >@@ -268,9 +268,14 @@ > } > } > >- if (getReloadInternal()) { >- tagHandlerClass = ctxt.load(); >- reload = false; >+ if (getReloadInternal() || tagHandlerClass == null) { >+ synchronized (this) { >+ if (getReloadInternal() || tagHandlerClass == null) { >+ tagHandlerClass = ctxt.load(); >+ // Volatile 'reload' forces in order write of 'tagHandlerClass' >+ reload = false; >+ } >+ } > } > } catch (FileNotFoundException ex) { > throw new JasperException(ex); >@@ -306,8 +311,12 @@ > Object target; > if (isTagFile) { > if (reload) { >- tagHandlerClass = ctxt.load(); >- reload = false; >+ synchronized (this) { >+ if (reload) { >+ tagHandlerClass = ctxt.load(); >+ reload = false; >+ } >+ } > } > target = tagHandlerClass.newInstance(); > } else { >@@ -375,12 +384,12 @@ > /* > * (1) Compile > */ >- if (options.getDevelopment() || firstTime ) { >+ if (options.getDevelopment() || theServlet == null) { > synchronized (this) { >- firstTime = false; >- >- // The following sets reload to true, if necessary >- ctxt.compile(); >+ if (options.getDevelopment() || theServlet == null) { >+ // The following sets reload to true, if necessary >+ ctxt.compile(); >+ } > } > } else { > if (compileException != null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62757
:
36169
| 36186