Repository: tomee Updated Branches: refs/heads/develop eb3736dd9 -> 936430684
TOMEE-1521 handling war in ears in AutoDeployer Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/93643068 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/93643068 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/93643068 Branch: refs/heads/develop Commit: 936430684fb314582e09a8a479510f90929280f8 Parents: eb3736d Author: Romain Manni-Bucau <[email protected]> Authored: Fri Feb 27 20:18:28 2015 +0100 Committer: Romain Manni-Bucau <[email protected]> Committed: Fri Feb 27 20:18:28 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/93643068/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; } /**
