Repository: tomee Updated Branches: refs/heads/tomee-1.7.x 4c4d4371a -> dd7ee771c
TOMEE-1521 handling wars in ears for AutoDeployer Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/dd7ee771 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/dd7ee771 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/dd7ee771 Branch: refs/heads/tomee-1.7.x Commit: dd7ee771c101f4ab293b64014289f060a856b070 Parents: 4c4d437 Author: Romain Manni-Bucau <[email protected]> Authored: Fri Feb 27 20:18:44 2015 +0100 Committer: Romain Manni-Bucau <[email protected]> Committed: Fri Feb 27 20:19:09 2015 +0100 ---------------------------------------------------------------------- .../org/apache/openejb/config/AutoDeployer.java | 48 ++++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/dd7ee771/container/openejb-core/src/main/java/org/apache/openejb/config/AutoDeployer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoDeployer.java b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoDeployer.java index 79ade76..57fd3ce 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoDeployer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoDeployer.java @@ -96,6 +96,9 @@ public class AutoDeployer { assembler.createApplication(appInfo); + // war can be unpacked so it changes the last modified time + files.get(appPath).setModified(getLastModifiedInDir(new File(appPath))); + } catch (final Exception e) { logger.error("Failed Auto-Deployment of: " + appPath, e); } @@ -340,34 +343,41 @@ public class AutoDeployer { // super(dir.getAbsolutePath(), 0, getLastModifiedInDir(dir)); } + } - private static long getLastModifiedInDir(final File dir) { - assert dir != null; + public static long getLastModifiedInDir(final File dir) { + assert dir != null; - long value = dir.lastModified(); - final File[] children = dir.listFiles(); - long test; + if (dir.isFile()) { + return dir.lastModified(); + } - if (children != null) { - for (final File child : children) { - if (!child.canRead()) { - continue; - } + long value = dir.lastModified(); + final File[] children = dir.listFiles(); + long test; - if (child.isDirectory()) { - test = getLastModifiedInDir(child); - } else { - test = child.lastModified(); - } + if (children != null) { + for (final File child : children) { + if (!child.canRead()) { + continue; + } - if (test > value) { - value = test; + if (child.isDirectory()) { + if (new File(child.getParentFile(), child.getName() + ".war").exists()) { // unpacked + continue; } + test = getLastModifiedInDir(child); + } else { + test = child.lastModified(); } - } - return value; + if (test > value) { + value = test; + } + } } + + return value; } /**
