ASF Bugzilla – Attachment 17923 Details for
Bug 38795
[PATCH] StandardContext doesn't always reset thread's contextClassLoader
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Defensive coding patch for 5.0.xx
StandardContext_5.0.x.java.diff (text/plain), 6.15 KB, created by
Darryl Miles
on 2006-03-20 09:28:49 UTC
(
hide
)
Description:
Defensive coding patch for 5.0.xx
Filename:
MIME Type:
Creator:
Darryl Miles
Created:
2006-03-20 09:28:49 UTC
Size:
6.15 KB
patch
obsolete
>--- jakarta-tomcat-5.0.30-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java 2004-11-24 16:55:09.000000000 +0000 >+++ jakarta-tomcat-5.0.30-src-dlm/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java 2006-03-18 21:50:43.000000000 +0000 >@@ -4219,17 +4219,18 @@ > // Binding thread > ClassLoader oldCCL = bindThread(); > >- // Standard container startup >- if (log.isDebugEnabled()) >- log.debug("Processing standard container startup"); >+ boolean mainOk = false; > >- if (ok) { >+ try { > >- boolean mainOk = false; >- try { >+ if (ok) { > > started = true; > >+ // Standard container startup >+ if (log.isDebugEnabled()) >+ log.debug("Processing standard container startup"); >+ > // Start our subordinate components, if any > if ((loader != null) && (loader instanceof Lifecycle)) > ((Lifecycle) loader).start(); >@@ -4279,17 +4280,18 @@ > > mainOk = true; > >- } finally { >- // Unbinding thread >- unbindThread(oldCCL); >- if (!mainOk) { >- // An exception occurred >- // Register with JMX anyway, to allow management >- registerJMX(); >- } > } > >+ } finally { >+ // Unbinding thread >+ unbindThread(oldCCL); >+ if (!mainOk) { >+ // An exception occurred >+ // Register with JMX anyway, to allow management >+ registerJMX(); >+ } > } >+ > if (!getConfigured()) { > log.error( "Error getConfigured"); > ok = false; >@@ -4306,39 +4308,43 @@ > // Binding thread > oldCCL = bindThread(); > >- // Create context attributes that will be required >- if (ok) { >- if (log.isDebugEnabled()) >- log.debug("Posting standard context attributes"); >- postWelcomeFiles(); >- } >+ try { > >- if (ok) { >- // Notify our interested LifecycleListeners >- lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); >- } >+ // Create context attributes that will be required >+ if (ok) { >+ if (log.isDebugEnabled()) >+ log.debug("Posting standard context attributes"); >+ postWelcomeFiles(); >+ } > >- // Configure and call application event listeners and filters >- if (ok) { >- if (!listenerStart()) { >- log.error( "Error listenerStart"); >- ok = false; >+ if (ok) { >+ // Notify our interested LifecycleListeners >+ lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); > } >- } >- if (ok) { >- if (!filterStart()) { >- log.error( "Error filterStart"); >- ok = false; >+ >+ // Configure and call application event listeners and filters >+ if (ok) { >+ if (!listenerStart()) { >+ log.error( "Error listenerStart"); >+ ok = false; >+ } >+ } >+ if (ok) { >+ if (!filterStart()) { >+ log.error( "Error filterStart"); >+ ok = false; >+ } > } >- } > >- // Load and initialize all "load on startup" servlets >- if (ok) { >- loadOnStartup(findChildren()); >- } >+ // Load and initialize all "load on startup" servlets >+ if (ok) { >+ loadOnStartup(findChildren()); >+ } > >- // Unbinding thread >- unbindThread(oldCCL); >+ } finally { >+ // Unbinding thread >+ unbindThread(oldCCL); >+ } > > // Set available status depending upon startup success > if (ok) { >@@ -4501,34 +4507,34 @@ > // Binding thread > ClassLoader oldCCL = bindThread(); > >- // Stop our filters >- filterStop(); >+ try { > >- // Stop ContainerBackgroundProcessor thread >- super.threadStop(); >+ // Stop our filters >+ filterStop(); > >- if ((manager != null) && (manager instanceof Lifecycle)) { >- ((Lifecycle) manager).stop(); >- } >+ // Stop ContainerBackgroundProcessor thread >+ super.threadStop(); > >- // Stop our application listeners >- // I think this should be after the children are stopped, >- // because now servlet destroy() is called AFTER >- // contextDestroyed, which is a Spec violation as noted >- // Bugzilla 30762. >- // listenerStop(); >+ if ((manager != null) && (manager instanceof Lifecycle)) { >+ ((Lifecycle) manager).stop(); >+ } > >- // Finalize our character set mapper >- setCharsetMapper(null); >+ // Stop our application listeners >+ // I think this should be after the children are stopped, >+ // because now servlet destroy() is called AFTER >+ // contextDestroyed, which is a Spec violation as noted >+ // Bugzilla 30762. >+ // listenerStop(); > >- // Normal container shutdown processing >- if (log.isDebugEnabled()) >- log.debug("Processing standard container shutdown"); >- // Notify our interested LifecycleListeners >- lifecycle.fireLifecycleEvent(STOP_EVENT, null); >- started = false; >+ // Finalize our character set mapper >+ setCharsetMapper(null); > >- try { >+ // Normal container shutdown processing >+ if (log.isDebugEnabled()) >+ log.debug("Processing standard container shutdown"); >+ // Notify our interested LifecycleListeners >+ lifecycle.fireLifecycleEvent(STOP_EVENT, null); >+ started = false; > > // Stop the Valves in our pipeline (including the basic), if any > if (pipeline instanceof Lifecycle) {
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 38795
:
17909
| 17923 |
17924