From 246cde364b330ce25730b8a5b68913d6ff08b5f4 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 16 Dec 2010 10:55:25 +0000 Subject: [PATCH] improved test timing git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2611 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../jetty/server/ResourceCacheTest.java | 26 +++++++++---------- .../eclipse/jetty/webapp/WebAppContext.java | 3 ++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResourceCacheTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResourceCacheTest.java index 0300becd9a6..6ea3ef7d1ee 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResourceCacheTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResourceCacheTest.java @@ -141,43 +141,43 @@ public class ResourceCacheTest assertEquals(80,cache.getCachedSize()); assertEquals(1,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[1]); assertEquals(90,cache.getCachedSize()); assertEquals(2,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[2]); assertEquals(30,cache.getCachedSize()); assertEquals(2,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[3]); assertEquals(60,cache.getCachedSize()); assertEquals(3,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[4]); assertEquals(90,cache.getCachedSize()); assertEquals(3,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[5]); assertEquals(90,cache.getCachedSize()); assertEquals(2,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[6]); assertEquals(60,cache.getCachedSize()); assertEquals(1,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); FileOutputStream out = new FileOutputStream(files[6]); out.write(' '); @@ -186,37 +186,37 @@ public class ResourceCacheTest assertEquals(70,cache.getCachedSize()); assertEquals(1,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[6]); assertEquals(71,cache.getCachedSize()); assertEquals(2,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[0]); assertEquals(72,cache.getCachedSize()); assertEquals(3,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[1]); assertEquals(82,cache.getCachedSize()); assertEquals(4,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[2]); assertEquals(32,cache.getCachedSize()); assertEquals(4,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); content=cache.lookup(names[3]); assertEquals(61,cache.getCachedSize()); assertEquals(4,cache.getCachedFiles()); - Thread.sleep(2); + Thread.sleep(200); cache.flushCache(); assertEquals(0,cache.getCachedSize()); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index 71db6d20ccc..30b0bf16b64 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -1078,7 +1078,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL try { - dir=dir.getCanonicalFile(); + if (dir!=null) + dir=dir.getCanonicalFile(); } catch(Exception e) {