You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/03/26 16:43:44 UTC

svn commit: r927923 - in /tomcat/trunk/java/org/apache/catalina/startup: HostConfig.java LocalStrings.properties LocalStrings_es.properties LocalStrings_fr.properties LocalStrings_ja.properties

Author: markt
Date: Fri Mar 26 15:43:44 2010
New Revision: 927923

URL: http://svn.apache.org/viewvc?rev=927923&view=rev
Log:
Clean up
 - Eclipse warnings
 - Unnecessary code
 - Line length
 - i18n message names

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_es.properties
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_fr.properties
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_ja.properties

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=927923&r1=927922&r2=927923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Fri Mar 26 15:43:44 2010
@@ -362,9 +362,9 @@ public class HostConfig
     	DeployedApplication app = deployed.get(name);
     	if (app == null) {
     		return 0L;
-    	} else {
-    		return app.timestamp;
     	}
+    	
+    	return app.timestamp;
     }
     
     
@@ -379,9 +379,9 @@ public class HostConfig
         DeployedApplication app = deployed.get(name);
         if (app == null) {
             return false;
-        } else {
-            return true;
         }
+        
+        return true;
     }
     
     
@@ -829,9 +829,6 @@ public class HostConfig
                     ostream = null;
                     istream.close();
                     istream = null;
-                    entry = null;
-                    jar.close();
-                    jar = null;
                 }
             } catch (Exception e) {
                 // Ignore and continue
@@ -868,7 +865,7 @@ public class HostConfig
         
         // Deploy the application in this WAR file
         if(log.isInfoEnabled()) 
-            log.info(sm.getString("hostConfig.deployJar", file));
+            log.info(sm.getString("hostConfig.deployWar", file));
 
         try {
             Context context = null;
@@ -928,12 +925,13 @@ public class HostConfig
                 }
                 deployedApp.redeployResources.put(docBase.getAbsolutePath(),
                         new Long(docBase.lastModified()));
-                addWatchedResources(deployedApp, docBase.getAbsolutePath(), context);
+                addWatchedResources(deployedApp, docBase.getAbsolutePath(),
+                        context);
             } else {
                 addWatchedResources(deployedApp, null, context);
             }
         } catch (Throwable t) {
-            log.error(sm.getString("hostConfig.deployJar.error", file), t);
+            log.error(sm.getString("hostConfig.deployWar.error", file), t);
         }
         
         deployed.put(contextPath, deployedApp);
@@ -1000,7 +998,8 @@ public class HostConfig
                     try {
                         context = (Context) digester.parse(xml);
                         if (context == null) {
-                            log.error(sm.getString("hostConfig.deployDescriptor.error",
+                            log.error(sm.getString(
+                                    "hostConfig.deployDescriptor.error",
                                     xml));
                             return;
                         }
@@ -1062,7 +1061,8 @@ public class HostConfig
      * @param contextPath of the context which will be checked
      */
     protected boolean deploymentExists(String contextPath) {
-        return (deployed.containsKey(contextPath) || (host.findChild(contextPath) != null));
+        return (deployed.containsKey(contextPath) ||
+                (host.findChild(contextPath) != null));
     }
     
 
@@ -1072,9 +1072,11 @@ public class HostConfig
      * @param docBase web app docBase
      * @param context web application context
      */
-    protected void addWatchedResources(DeployedApplication app, String docBase, Context context) {
-        // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*, WEB-INF/*.xml), where
-        //        we would only check if at least one resource is newer than app.timestamp
+    protected void addWatchedResources(DeployedApplication app, String docBase,
+            Context context) {
+        // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*,
+        //        WEB-INF/*.xml), where we would only check if at least one
+        //        resource is newer than app.timestamp
         File docBaseFile = null;
         if (docBase != null) {
             docBaseFile = new File(docBase);
@@ -1090,12 +1092,14 @@ public class HostConfig
                     resource = new File(docBaseFile, watchedResources[i]);
                 } else {
                     if(log.isDebugEnabled())
-                        log.debug("Ignoring non-existent WatchedResource '" + resource.getAbsolutePath() + "'");
+                        log.debug("Ignoring non-existent WatchedResource '" +
+                                resource.getAbsolutePath() + "'");
                     continue;
                 }
             }
             if(log.isDebugEnabled())
-                log.debug("Watching WatchedResource '" + resource.getAbsolutePath() + "'");
+                log.debug("Watching WatchedResource '" +
+                        resource.getAbsolutePath() + "'");
             app.reloadResources.put(resource.getAbsolutePath(), 
                     new Long(resource.lastModified()));
         }
@@ -1111,15 +1115,18 @@ public class HostConfig
         for (int i = 0; i < resources.length; i++) {
             File resource = new File(resources[i]);
             if (log.isDebugEnabled())
-                log.debug("Checking context[" + app.name + "] redeploy resource " + resource);
+                log.debug("Checking context[" + app.name +
+                        "] redeploy resource " + resource);
             if (resource.exists()) {
                 long lastModified =
                     app.redeployResources.get(resources[i]).longValue();
-                if ((!resource.isDirectory()) && resource.lastModified() > lastModified) {
+                if ((!resource.isDirectory()) &&
+                        resource.lastModified() > lastModified) {
                     // Undeploy application
                     if (log.isInfoEnabled())
                         log.info(sm.getString("hostConfig.undeploy", app.name));
-                    ContainerBase context = (ContainerBase) host.findChild(app.name);
+                    ContainerBase context =
+                        (ContainerBase) host.findChild(app.name);
                     try {
                         host.removeChild(context);
                     } catch (Throwable t) {
@@ -1137,8 +1144,11 @@ public class HostConfig
                         try {
                             File current = new File(resources[j]);
                             current = current.getCanonicalFile();
-                            if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
-                                    || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
+                            if ((current.getAbsolutePath().startsWith(
+                                    appBase().getAbsolutePath() +
+                                    File.separator))
+                                    || (current.getAbsolutePath().startsWith(
+                                            configBase().getAbsolutePath()))) {
                                 if (log.isDebugEnabled())
                                     log.debug("Delete " + current);
                                 ExpandWar.delete(current);
@@ -1171,7 +1181,8 @@ public class HostConfig
                 // Undeploy application
                 if (log.isInfoEnabled())
                     log.info(sm.getString("hostConfig.undeploy", app.name));
-                ContainerBase context = (ContainerBase) host.findChild(app.name);
+                ContainerBase context = 
+                    (ContainerBase) host.findChild(app.name);
                 try {
                     host.removeChild(context);
                 } catch (Throwable t) {
@@ -1189,8 +1200,10 @@ public class HostConfig
                     try {
                         File current = new File(resources[j]);
                         current = current.getCanonicalFile();
-                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
-                            || (current.getAbsolutePath().startsWith(configBase().getAbsolutePath()))) {
+                        if ((current.getAbsolutePath().startsWith(
+                                appBase().getAbsolutePath() + File.separator))
+                            || (current.getAbsolutePath().startsWith(
+                                    configBase().getAbsolutePath()))) {
                             if (log.isDebugEnabled())
                                 log.debug("Delete " + current);
                             ExpandWar.delete(current);
@@ -1200,15 +1213,18 @@ public class HostConfig
                                 ("hostConfig.canonicalizing", app.name), e);
                     }
                 }
-                // Delete reload resources as well (to remove any remaining .xml descriptor)
+                // Delete reload resources as well (to remove any remaining .xml
+                // descriptor)
                 String[] resources2 =
                     app.reloadResources.keySet().toArray(new String[0]);
                 for (int j = 0; j < resources2.length; j++) {
                     try {
                         File current = new File(resources2[j]);
                         current = current.getCanonicalFile();
-                        if ((current.getAbsolutePath().startsWith(appBase().getAbsolutePath() + File.separator))
-                            || ((current.getAbsolutePath().startsWith(configBase().getAbsolutePath())
+                        if ((current.getAbsolutePath().startsWith(
+                                appBase().getAbsolutePath() + File.separator))
+                            || ((current.getAbsolutePath().startsWith(
+                                    configBase().getAbsolutePath())
                                  && (current.getAbsolutePath().endsWith(".xml"))))) {
                             if (log.isDebugEnabled())
                                 log.debug("Delete " + current);
@@ -1227,8 +1243,10 @@ public class HostConfig
         for (int i = 0; i < resources.length; i++) {
             File resource = new File(resources[i]);
             if (log.isDebugEnabled())
-                log.debug("Checking context[" + app.name + "] reload resource " + resource);
-            long lastModified = app.reloadResources.get(resources[i]).longValue();
+                log.debug("Checking context[" + app.name +
+                        "] reload resource " + resource);
+            long lastModified =
+                app.reloadResources.get(resources[i]).longValue();
             if ((!resource.exists() && lastModified != 0L) 
                 || (resource.lastModified() != lastModified)) {
                 // Reload application
@@ -1250,7 +1268,8 @@ public class HostConfig
                              ("hostConfig.context.restart", app.name), e);
                 }
                 // Update times
-                app.reloadResources.put(resources[i], new Long(resource.lastModified()));
+                app.reloadResources.put(resources[i],
+                        new Long(resource.lastModified()));
                 app.timestamp = System.currentTimeMillis();
                 return;
             }

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=927923&r1=927922&r2=927923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Fri Mar 26 15:43:44 2010
@@ -77,8 +77,8 @@ hostConfig.deployDescriptor.error=Error 
 hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the host appBase has been specified, and will be ignored
 hostConfig.deployDir=Deploying web application directory {0}
 hostConfig.deployDir.error=Error deploying web application directory {0}
-hostConfig.deployJar=Deploying web application archive {0}
-hostConfig.deployJar.error=Error deploying web application archive {0}
+hostConfig.deployWar=Deploying web application archive {0}
+hostConfig.deployWar.error=Error deploying web application archive {0}
 hostConfig.deploy.error=Exception while deploying web application directory {0}
 hostConfig.deploying=Deploying discovered web applications
 hostConfig.expand=Expanding web application archive {0}

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_es.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_es.properties?rev=927923&r1=927922&r2=927923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_es.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_es.properties Fri Mar 26 15:43:44 2010
@@ -53,8 +53,8 @@ hostConfig.deployDescriptor.error = Erro
 hostConfig.deployDescriptor.localDocBaseSpecified = Se ha especificado un docBase {0} dentro del appBase de la m\u00E1quina y ser\u00E1 ignorado
 hostConfig.deployDir = Despliegue del directorio {0} de la aplicaci\u00F3n web
 hostConfig.deployDir.error = Error durante el despliegue del directorio {0} de la aplicaci\u00F3n web
-hostConfig.deployJar = Despliegue del archivo {0} de la aplicaci\u00F3n web
-hostConfig.deployJar.error = Error durante el despliegue del archivo {0} de la aplicaci\u00F3n web
+hostConfig.deployWar = Despliegue del archivo {0} de la aplicaci\u00F3n web
+hostConfig.deployWar.error = Error durante el despliegue del archivo {0} de la aplicaci\u00F3n web
 hostConfig.deploy.error = Excepci\u00F3n en el directorio {0} de la aplicaci\u00F3n web
 hostConfig.deploying = Desplegando aplicaciones web descubiertas
 hostConfig.expand = Descompresi\u00F3n del archivo {0} de la aplicaci\u00F3n web

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_fr.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_fr.properties?rev=927923&r1=927922&r2=927923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_fr.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_fr.properties Fri Mar 26 15:43:44 2010
@@ -39,8 +39,8 @@ hostConfig.deployDescriptor=D\u00e9ploie
 hostConfig.deployDescriptor.error=Erreur lors du d\u00e9ploiement du descripteur de configuration {0}
 hostConfig.deployDir=D\u00e9ploiement du r\u00e9pertoire {0} de l''application web
 hostConfig.deployDir.error=Erreur lors du d\u00e9ploiement du r\u00e9pertoire {0} de l''application web
-hostConfig.deployJar=D\u00e9ploiement de l''archive {0} de l''application web
-hostConfig.deployJar.error=Erreur lors du d\u00e9ploiement de l''archive {0} de l''application web
+hostConfig.deployWar=D\u00e9ploiement de l''archive {0} de l''application web
+hostConfig.deployWar.error=Erreur lors du d\u00e9ploiement de l''archive {0} de l''application web
 hostConfig.deploy.error=Exception lors du r\u00e9pertoire {0} de l''application web
 hostConfig.deploying=D\u00e9ploiement des applications web d\u00e9couvertes (discovered)
 hostConfig.expand=D\u00e9compression de l''archive {0} de l''application web

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_ja.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_ja.properties?rev=927923&r1=927922&r2=927923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_ja.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings_ja.properties Fri Mar 26 15:43:44 2010
@@ -40,8 +40,8 @@ hostConfig.deployDescriptor=\u8a2d\u5b9a
 hostConfig.deployDescriptor.error=\u8a2d\u5b9a\u8a18\u8ff0\u5b50 {0} \u3092\u914d\u5099\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
 hostConfig.deployDir=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30a3\u30ec\u30af\u30c8\u30ea {0} \u3092\u914d\u5099\u3057\u307e\u3059
 hostConfig.deployDir.error=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30a3\u30ec\u30af\u30c8\u30ea {0} \u3092\u914d\u5099\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-hostConfig.deployJar=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30a2\u30fc\u30ab\u30a4\u30d6 {0} \u3092\u914d\u5099\u3057\u307e\u3059
-hostConfig.deployJar.error=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30a2\u30fc\u30ab\u30a4\u30d6 {0} \u3092\u914d\u5099\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
+hostConfig.deployWar=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30a2\u30fc\u30ab\u30a4\u30d6 {0} \u3092\u914d\u5099\u3057\u307e\u3059
+hostConfig.deployWar.error=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30a2\u30fc\u30ab\u30a4\u30d6 {0} \u3092\u914d\u5099\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
 hostConfig.deploy.error=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30c7\u30a3\u30ec\u30af\u30c8\u30ea {0} \u3092\u914d\u5099\u4e2d\u306e\u4f8b\u5916\u3067\u3059
 hostConfig.deploying=\u898b\u3064\u304b\u3063\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u914d\u5099\u3057\u307e\u3059
 hostConfig.expand=Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30a2\u30fc\u30ab\u30a4\u30d6 {0} \u3092\u5c55\u958b\u3057\u307e\u3059



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org