knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject knox git commit: KNOX-1684 - Avoid NPE for deployments in GatewayServer
Date Tue, 18 Dec 2018 17:46:08 GMT
Repository: knox
Updated Branches:
  refs/heads/master c659fdb70 -> 59c45d3a3


KNOX-1684 - Avoid NPE for deployments in GatewayServer

Signed-off-by: Kevin Risden <krisden@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/59c45d3a
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/59c45d3a
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/59c45d3a

Branch: refs/heads/master
Commit: 59c45d3a3e040a5640c203bec5a64f466d83cf7b
Parents: c659fdb
Author: Kevin Risden <krisden@apache.org>
Authored: Tue Dec 18 11:31:06 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Tue Dec 18 12:11:12 2018 -0500

----------------------------------------------------------------------
 .../org/apache/knox/gateway/GatewayServer.java  | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/59c45d3a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index 7dba62a..a935933 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -809,29 +809,29 @@ public class GatewayServer {
     }
 
     // Find all the deployed contexts we need to deactivate.
-    List<WebAppContext> deactivate = new ArrayList<>();
     if( deployments != null ) {
+      List<WebAppContext> deactivate = new ArrayList<>();
       for( WebAppContext app : deployments.values() ) {
         String appPath = app.getContextPath();
         if( appPath.equals( topoPath ) || appPath.startsWith( topoPathSlash ) ) {
           deactivate.add( app );
         }
       }
-    }
 
-    // Deactivate the required deployed contexts.
-    for( WebAppContext context : deactivate ) {
-      String contextPath = context.getContextPath();
-      deployments.remove( contextPath );
-      contexts.removeHandler( context );
-      try {
-        context.stop();
-      } catch( Exception e ) {
-        auditor.audit(Action.UNDEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE);
-        log.failedToUndeployTopology( topology.getName(), e );
+      // Deactivate the required deployed contexts.
+      for( WebAppContext context : deactivate ) {
+        String contextPath = context.getContextPath();
+        deployments.remove( contextPath );
+        contexts.removeHandler( context );
+        try {
+          context.stop();
+        } catch( Exception e ) {
+          auditor.audit(Action.UNDEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE);
+          log.failedToUndeployTopology( topology.getName(), e );
+        }
       }
+      deactivate.clear();
     }
-    deactivate.clear();
   }
 
   // Using an inner class to hide the handleTopologyEvent method from consumers of GatewayServer.


Mime
View raw message