Author: kfujino
Date: Wed Jan 13 08:12:16 2016
New Revision: 1724367
URL: http://svn.apache.org/viewvc?rev=1724367&view=rev
Log:
Simplify the code of JvmRouteBinderValve.startInternal().
Avoid potential NPE when JvmRouteBinderValve is configured directly at Engine
element.
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java?rev=1724367&r1=1724366&r2=1724367&view=diff
==============================================================================
---
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
(original)
+++
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
Wed Jan 13 08:12:16 2016
@@ -20,9 +20,7 @@ import java.io.IOException;
import javax.servlet.ServletException;
-import org.apache.catalina.Container;
-import org.apache.catalina.Engine;
-import org.apache.catalina.Host;
+import org.apache.catalina.Cluster;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Manager;
import org.apache.catalina.Session;
@@ -380,24 +378,9 @@ public class JvmRouteBinderValve extends
protected synchronized void startInternal() throws LifecycleException {
if (cluster == null) {
- Container hostContainer = getContainer();
- // compatibility with JvmRouteBinderValve version 1.1
- // ( setup at context.xml or context.xml.default )
- if (!(hostContainer instanceof Host)) {
- if (log.isWarnEnabled()) {
- log.warn(sm.getString("jvmRoute.configure.warn"));
- }
- hostContainer = hostContainer.getParent();
- }
- if (hostContainer instanceof Host
- && ((Host) hostContainer).getCluster() != null) {
- cluster = (CatalinaCluster) ((Host)
hostContainer).getCluster();
- } else {
- Container engine = hostContainer.getParent() ;
- if (engine instanceof Engine
- && ((Engine) engine).getCluster() != null) {
- cluster = (CatalinaCluster) ((Engine) engine).getCluster();
- }
+ Cluster containerCluster = getContainer().getCluster();
+ if (containerCluster instanceof CatalinaCluster) {
+ setCluster((CatalinaCluster)containerCluster);
}
}
Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1724367&r1=1724366&r2=1724367&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Wed Jan 13 08:12:16 2016
@@ -140,6 +140,11 @@
set to <code>true</code>, ensure that the heartbeat thread does not
start. (kfujino)
</fix>
+ <scode>
+ Simplify the code of <code>JvmRouteBinderValve.startInternal()</code>.
+ Avoid potential NPE when <code>JvmRouteBinderValve</code> is configured
+ directly at <code>Engine</code> element. (kfujino)
+ </scode>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]