From f2b3266e2a5eaeaeb3f20fa50815b8469d597129 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 26 Sep 2008 12:20:03 +0000 Subject: [PATCH] Code clean up in o.a.c.h.deploy No functional change git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@699296 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/ha/deploy/FarmWarDeployer.java | 12 ++++++------ java/org/apache/catalina/ha/deploy/WarWatcher.java | 12 +++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java index 4b65259fd..aa6ceb6e9 100644 --- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java +++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java @@ -70,7 +70,8 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, protected boolean started = false; //default 5 seconds - protected HashMap fileFactories = new HashMap(); + protected HashMap fileFactories = + new HashMap(); protected String deployDir; @@ -212,7 +213,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, */ public void messageReceived(ClusterMessage msg) { try { - if (msg instanceof FileMessage && msg != null) { + if (msg instanceof FileMessage) { FileMessage fmsg = (FileMessage) msg; if (log.isDebugEnabled()) log.debug("receive cluster deployment [ path: " @@ -250,7 +251,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, removeFactory(fmsg); } } - } else if (msg instanceof UndeployMessage && msg != null) { + } else if (msg instanceof UndeployMessage) { try { UndeployMessage umsg = (UndeployMessage) msg; String path = umsg.getContextPath(); @@ -291,8 +292,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, throws java.io.FileNotFoundException, java.io.IOException { File tmpFile = new File(msg.getFileName()); File writeToFile = new File(getTempDir(), tmpFile.getName()); - FileMessageFactory factory = (FileMessageFactory) fileFactories.get(msg - .getFileName()); + FileMessageFactory factory = fileFactories.get(msg.getFileName()); if (factory == null) { factory = FileMessageFactory.getInstance(writeToFile, true); fileFactories.put(msg.getFileName(), factory); @@ -450,7 +450,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, } catch (Exception x) { log.error("No removal", x); } - install(contextName, deployWar.toURL()); + install(contextName, deployWar.toURI().toURL()); } catch (Exception x) { log.error("Unable to install WAR file", x); } diff --git a/java/org/apache/catalina/ha/deploy/WarWatcher.java b/java/org/apache/catalina/ha/deploy/WarWatcher.java index beb763608..479c4af71 100644 --- a/java/org/apache/catalina/ha/deploy/WarWatcher.java +++ b/java/org/apache/catalina/ha/deploy/WarWatcher.java @@ -54,7 +54,8 @@ public class WarWatcher { /** * Currently deployed files */ - protected Map currentStatus = new HashMap(); + protected Map currentStatus = + new HashMap(); /*--Constructor---------------------------------------------*/ @@ -83,9 +84,10 @@ public class WarWatcher { } //check all the status codes and update the FarmDeployer - for (Iterator i = currentStatus.entrySet().iterator(); i.hasNext();) { - Map.Entry entry = (Map.Entry) i.next(); - WarInfo info = (WarInfo) entry.getValue(); + for (Iterator> i = + currentStatus.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = i.next(); + WarInfo info = entry.getValue(); int check = info.check(); if (check == 1) { listener.fileModified(info.getWar()); @@ -103,7 +105,7 @@ public class WarWatcher { * @param warfile */ protected void addWarInfo(File warfile) { - WarInfo info = (WarInfo) currentStatus.get(warfile.getAbsolutePath()); + WarInfo info = currentStatus.get(warfile.getAbsolutePath()); if (info == null) { info = new WarInfo(warfile); info.setLastState(-1); //assume file is non existent -- 2.11.0