bug 385461: bundle.getLocation() is not always a valid URL.
diff --git a/org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerUtils.java b/org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerUtils.java
index 46fa649..7f80c0d 100644
--- a/org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerUtils.java
+++ b/org.eclipse.gemini.web.core/src/main/java/org/eclipse/gemini/web/internal/WebContainerUtils.java
@@ -17,7 +17,6 @@
 package org.eclipse.gemini.web.internal;
 
 import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -98,14 +97,7 @@
         String contextPath = getWebContextPathHeader(bundle);
 
         if (contextPath == null) {
-            boolean isDirectory;
-            try {
-                isDirectory = isDirectory(new URL(bundle.getLocation()));
-            } catch (MalformedURLException e) {
-                LOGGER.warn("Unable to determine if bundle '" + bundle.getLocation() + "'is a directory.", e);
-                isDirectory = false;
-            }
-            contextPath = getBaseName(bundle.getLocation(), isDirectory);
+            contextPath = getBaseName(bundle.getLocation(), false);
         }
 
         return contextPath;
diff --git a/org.eclipse.gemini.web.core/src/test/java/org/eclipse/gemini/web/internal/WebContainerUtilsTests.java b/org.eclipse.gemini.web.core/src/test/java/org/eclipse/gemini/web/internal/WebContainerUtilsTests.java
index dae4a33..cda4936 100644
--- a/org.eclipse.gemini.web.core/src/test/java/org/eclipse/gemini/web/internal/WebContainerUtilsTests.java
+++ b/org.eclipse.gemini.web.core/src/test/java/org/eclipse/gemini/web/internal/WebContainerUtilsTests.java
@@ -90,16 +90,6 @@
     }
 
     @Test
-    public void testIsWebBundleWithWarExtensionAndDirectory() {
-        Bundle bundle = createNiceMock(Bundle.class);
-        expect(bundle.getLocation()).andReturn("file:src/test/resources/contains-system-bundle-package.war").anyTimes();
-        expect(bundle.getHeaders()).andReturn(EMPTY_PROPERTIES);
-        replay(bundle);
-        assertTrue(WebContainerUtils.isWebBundle(bundle));
-        assertEquals("contains-system-bundle-package.war", WebContainerUtils.getContextPath(bundle));
-    }
-
-    @Test
     public void testIsWebBundleWithWarExtensionAndTrailingSlashes() {
         Bundle bundle = createNiceMock(Bundle.class);
         expect(bundle.getLocation()).andReturn("file:foo.war//").anyTimes();
@@ -180,18 +170,6 @@
     }
 
     @Test
-    public void testContextPathDefaultedMalformedException() throws Exception {
-        Dictionary<String, String> p = new Hashtable<String, String>();
-
-        Bundle bundle = createNiceMock(Bundle.class);
-        expect(bundle.getLocation()).andReturn("jar:bar.war").anyTimes();
-        expect(bundle.getHeaders()).andReturn(p).anyTimes();
-        replay(bundle);
-
-        assertEquals("bar", WebContainerUtils.getContextPath(bundle));
-    }
-
-    @Test
     public void testContextPathDefaultedWindowsPath() throws Exception {
         Dictionary<String, String> p = new Hashtable<String, String>();
 
@@ -208,11 +186,14 @@
         Dictionary<String, String> p = new Hashtable<String, String>();
 
         Bundle bundle = createNiceMock(Bundle.class);
-        expect(bundle.getLocation()).andReturn("file:../formtags.war?Import-Package:org.foo.bar").anyTimes();
+        expect(bundle.getLocation()).andReturn("file:../formtags.war?Import-Package:org.foo.bar").andReturn("initial@file:../formtags.war").andReturn(
+            "file:../formtags.war#fragment");
         expect(bundle.getHeaders()).andReturn(p).anyTimes();
         replay(bundle);
 
         assertEquals("formtags", WebContainerUtils.getContextPath(bundle));
+        assertEquals("formtags", WebContainerUtils.getContextPath(bundle));
+        assertEquals("formtags", WebContainerUtils.getContextPath(bundle));
     }
 
     @Test