geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1147723 - /geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java
Date Mon, 18 Jul 2011 02:38:01 GMT
Author: rwonly
Date: Mon Jul 18 02:38:01 2011
New Revision: 1147723

URL: http://svn.apache.org/viewvc?rev=1147723&view=rev
Log:
GERONIMO-6028 should not calculate the configId from a non-exist file.

Modified:
    geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java

Modified: geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java?rev=1147723&r1=1147722&r2=1147723&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java
(original)
+++ geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/ModuleHandler.java
Mon Jul 18 02:38:01 2011
@@ -103,13 +103,22 @@ public class ModuleHandler implements Di
     @Override
     public void scanComplete(Collection<DirectoryMonitor.FileInfo> addedFiles, Collection<DirectoryMonitor.FileInfo>
modifiedFiles, Collection<DirectoryMonitor.FileInfo> deletedFiles) {       
         for (DirectoryMonitor.FileInfo deletedFile : deletedFiles) {
-            String moduleId = getModuleId(deletedFile);
-            if (isModuleDeployed(moduleId)) {
-                // check if deployed module is older
-                if (deletedFile.getModified() < getModuleLastModified(moduleId)) {
-                    fileRemoved(new File(deletedFile.getPath()), moduleId);
+            if (deletedFile.getConfigId() == null) {
+                // This means the file was never deployed, and now we are deleting it from
the hot deploy folder.
+                // We should not use getModuleId(addedFile) here, because we can not calculate
the configId from a non-exist file.
+                log.info("File: {} was removed", deletedFile.getPath());
+            } else {
+                String moduleId = deletedFile.getConfigId();
+                if (isModuleDeployed(moduleId)) {
+                    // check if deployed module is older
+                    if (deletedFile.getModified() < getModuleLastModified(moduleId)) {
+                        fileRemoved(new File(deletedFile.getPath()), moduleId);
+                    } else {
+                        log.warn("File: {} was removed, but module: {} was not undeployed,
since the deployed one is newer.", deletedFile.getPath(), moduleId);
+                    }
                 } else {
-                    log.warn("File: {} was removed, but module: {} was not undeployed, since
the deployed one is newer", deletedFile.getPath(), moduleId);
+                    //should not happen
+                    log.warn("Module: {} has been already undeployed in other ways", moduleId);
                 }
             }
         }
@@ -125,7 +134,7 @@ public class ModuleHandler implements Di
                         addedFile.setConfigId(newModuleId.length() == 0 ? moduleId : newModuleId);
                     }
                 } else {
-                    log.warn("File: {} was added, but module: {} was not redeployed, since
the deployed one is newer", addedFile.getPath(), moduleId);                    
+                    log.warn("File: {} was added, but module: {} was not redeployed, since
the deployed one is newer.", addedFile.getPath(), moduleId);                    
                 }
             } else {
                 String newModuleId = fileAdded(moduleFile);
@@ -146,7 +155,7 @@ public class ModuleHandler implements Di
                         modifiedFile.setConfigId(newModuleId.length() == 0 ? moduleId : newModuleId);
                     }
                 } else {
-                    log.warn("File: {} was modified, but module: {} was not redeployed, since
the deployed one is newer", modifiedFile.getPath(), moduleId);                           
        
+                    log.warn("File: {} was modified, but module: {} was not redeployed, since
the deployed one is newer.", modifiedFile.getPath(), moduleId);                          
         
                 }
             } else {
                 String newModuleId = fileAdded(moduleFile);



Mime
View raw message