Index: src/main/java/org/ow2/petals/system/classloader/factory/URLFactory.java
===================================================================
--- src/main/java/org/ow2/petals/system/classloader/factory/URLFactory.java	(revision 25513)
+++ src/main/java/org/ow2/petals/system/classloader/factory/URLFactory.java	(working copy)
@@ -26,7 +26,9 @@
 
 package org.ow2.petals.system.classloader.factory;
 
+import java.io.File;
 import java.io.IOException;
+import java.net.URISyntaxException;
 import java.net.URL;
 
 /**
@@ -65,16 +67,31 @@
     public static URLFactory getFactory(URL url) throws IOException {
 
         String path = url.getPath();
-        if (path.matches(".*\\..ar")) {
-            // jar detected if path ends with .?ar (*.jar, *.war, *.ear)
+        if (path.matches(".*\\.[ejw]ar")) {
+            // jar detected if path ends with .[ejw]ar (*.jar, *.war, *.ear)
             return new JarURLFactory(url);
-        } else if (path.endsWith("/")) {
-            // directory detected if url ends with a separator /
-            return new DirURLFactory(url);
         } else {
-            String err = "Unsupported URL '" + url + "' support "
-                    + "only jar archive and directory";
-            throw new IOException(err);
+            try {
+                final File filePath = new File(url.toURI());
+                if (filePath.exists()) {
+                    if (filePath.isDirectory()) {
+                        // directory detected
+                        return new DirURLFactory(url);
+                    } else {
+                        String err = "Unsupported URL '" + url + "' support "
+                                + "only jar/war/ear archive and existing directory";
+                        throw new IOException(err);
+                    }
+                } else {
+                    String err = "Unsupported URL '" + url
+                            + "' support only jar/war/ear archive and existing directory";
+                    throw new IOException(err);
+                }
+            } catch (final URISyntaxException e) {
+                String err = "Unsupported URL '" + url + "' support (invalid URI syntax: "
+                        + e.getMessage() + ") only jar/war/ear archive and existing directory";
+                throw new IOException(err);
+            }
         }
     }
 
Index: src/test/java/org/ow2/petals/system/classloader/factory/URLFactoryTest.java
===================================================================
--- src/test/java/org/ow2/petals/system/classloader/factory/URLFactoryTest.java	(revision 25513)
+++ src/test/java/org/ow2/petals/system/classloader/factory/URLFactoryTest.java	(working copy)
@@ -21,7 +21,9 @@
  */
 package org.ow2.petals.system.classloader.factory;
 
+import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 
 import junit.framework.TestCase;
@@ -29,17 +31,104 @@
 /**
  * Tests of the URLFactory
  * 
- * @author ddesjardins - eBMWebsourcing
+ * @author cdeneux - eBMWebsourcing
  */
 public class URLFactoryTest extends TestCase {
 
-	public void testGetFactory() {
-		try {
-			URLFactory.getFactory(new URL("http://www.objectweb.org"));
-			fail();
-		} catch (IOException e) {
-			// do nothing
-		}
-	}
+    public void test0() throws MalformedURLException {
+        URL tmp = new File("/tmp").toURI().toURL();
+        System.out.println("/tmp : " + tmp.toString());
+        URL toto = new File("/toto").toURI().toURL();
+        System.out.println("/toto : " + toto.toString());
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a JAR
+     * file on a Unix platform.
+     */
+    public void testGetFactory_JarFile_Unix() throws MalformedURLException, IOException {
+        final URLFactory urlFactory = URLFactory.getFactory(new URL("file:///home/user/file.jar"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof JarURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a JAR
+     * file on a Windows platform.
+     */
+    public void testGetFactory_JarFile_Windows() throws MalformedURLException, IOException {
+        final URLFactory urlFactory = URLFactory.getFactory(new URL("file://C:/temp/file.jar"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof JarURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a JAR
+     * file as a remote HTTP resource.
+     */
+    public void testGetFactory_JarHttp() throws MalformedURLException, IOException {
+        final URLFactory urlFactory = URLFactory.getFactory(new URL("http://www.ow2.org/file.jar"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof JarURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a WAR
+     * file on a Unix platform.
+     */
+    public void testGetFactory_WarFile_Unix() throws MalformedURLException, IOException {
+        final URLFactory urlFactory = URLFactory.getFactory(new URL("file:///home/user/file.war"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof JarURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a EAR
+     * file on a Unix platform.
+     */
+    public void testGetFactory_EarFile_Unix() throws MalformedURLException, IOException {
+        final URLFactory urlFactory = URLFactory.getFactory(new URL("file:///home/user/file.ear"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof JarURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a
+     * directory ended with a '/'.
+     */
+    public void testGetFactory_DirWithEndingSlash() throws MalformedURLException, IOException {
+        final URL dirURL = Thread.currentThread().getContextClassLoader().getResource("packages");
+        assertNotNull("Directory not found in resources of the classloader.", dirURL);
+        final URLFactory urlFactory = URLFactory.getFactory(new URL(dirURL.toString() + "/"));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof DirURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating a
+     * directory not ended with a '/'.
+     */
+    public void testGetFactory_DirWithoutEndingSlash() throws MalformedURLException, IOException {
+        final URL dirURL = Thread.currentThread().getContextClassLoader().getResource("packages");
+        assertNotNull("Directory not found in resources of the classloader.", dirURL);
+        final URLFactory urlFactory = URLFactory.getFactory(new URL(dirURL.toString()));
+        assertNotNull(urlFactory);
+        assertEquals(true, urlFactory instanceof DirURLFactory);
+    }
+
+    /**
+     * Check {@link URLFactory#getFactory(URL)} against a URL locating any file.
+     */
+    public void testGetFactory_File() throws MalformedURLException {
+        final URL dirURL = Thread.currentThread().getContextClassLoader()
+                .getResource("fakearchive/archive");
+        assertNotNull("File not found in resources of the classloader.", dirURL);
+        try {
+            URLFactory.getFactory(new URL(dirURL.toString()));
+            fail("Exception '" + IOException.class.getName() + "' is not thrown.");
+        } catch (final IOException e) {
+            // NOP: Expected exception
+        }
+    }
 
 }
