[Arakhnę-Dev] [133] Use the new URISchemeType enumeration insteed of Strings.

[ Thread Index | Date Index | More arakhne.org/dev Archives ]


Revision: 133
Author:   galland
Date:     2010-02-17 10:52:54 +0100 (Wed, 17 Feb 2010)
Log Message:
-----------
Use the new URISchemeType enumeration insteed of Strings.

Modified Paths:
--------------
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLClassLoader.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLStreamHandlerFactory.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandler.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandlerFactory.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandler.java
    trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandlerFactory.java

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLClassLoader.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLClassLoader.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLClassLoader.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -458,7 +458,7 @@
 				p = new FilePermission(path, SecurityConstants.FILE_READ_ACTION);
 			}
 		}
-		else if ((p == null) && (url.getProtocol().equals("file"))) { //$NON-NLS-1$
+		else if ((p == null) && (URISchemeType.FILE.isURL(url))) {
 			String path = url.getFile().replace('/', File.separatorChar);
 			path = ParseUtil.decode(path);
 			if (path.endsWith(File.separator))

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLStreamHandlerFactory.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLStreamHandlerFactory.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/DynamicURLStreamHandlerFactory.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -60,8 +60,8 @@
 	 * Create an URLStreamHandler factory with default protocols.
 	 */
 	public DynamicURLStreamHandlerFactory() {
-		addHandler("file", FileURLStreamHandler.class); //$NON-NLS-1$
-		addHandler("resource", ResourceURLStreamHandler.class); //$NON-NLS-1$
+		addHandler(URISchemeType.FILE.name().toLowerCase(), FileURLStreamHandler.class);
+		addHandler(URISchemeType.RESOURCE.name().toLowerCase(), ResourceURLStreamHandler.class);
 	}
 	
 	/**

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandler.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandler.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandler.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -53,7 +53,7 @@
 	 */
 	@Override
 	protected URLConnection openConnection(URL url) throws IOException {
-		if ("file".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
+		if (URISchemeType.FILE.isURL(url)) {
 			return new FileURLConnection(url);
 		}
 		throw new UnsupportedOperationException("Unsupported protocol: "+url); //$NON-NLS-1$

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandlerFactory.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandlerFactory.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/FileURLStreamHandlerFactory.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -49,7 +49,7 @@
 	 */
 	@Override
 	public URLStreamHandler createURLStreamHandler(String protocol) {
-		if ("file".equalsIgnoreCase(protocol)) //$NON-NLS-1$
+		if (URISchemeType.FILE.isScheme(protocol))
             return new FileURLStreamHandler();
 		// Force the default factory to retreive stream handler.
 		return null;

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/LibraryLoader.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -180,7 +180,7 @@
      * @see        java.lang.System#load(java.lang.String)
      */
     public static void load(URL filename) throws IOException {
-        if (filename.getProtocol().equalsIgnoreCase("file")) { //$NON-NLS-1$
+        if (URISchemeType.FILE.isURL(filename)) {
         	try {
         		load(new File(filename.toURI()));
         	} 

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandler.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandler.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandler.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -52,7 +52,7 @@
 	 */
 	@Override
 	protected URLConnection openConnection(URL url) throws IOException {
-		if ("resource".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
+		if (URISchemeType.RESOURCE.isURL(url)) {
 			return new ResourceURLConnection(url);
 		}
 		throw new UnsupportedOperationException("Unsupported protocol: "+url); //$NON-NLS-1$

Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandlerFactory.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandlerFactory.java	2010-02-17 09:52:25 UTC (rev 132)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ResourceURLStreamHandlerFactory.java	2010-02-17 09:52:54 UTC (rev 133)
@@ -48,7 +48,7 @@
 	 */
 	@Override
 	public URLStreamHandler createURLStreamHandler(String protocol) {
-		if ("resource".equalsIgnoreCase(protocol)) //$NON-NLS-1$
+		if (URISchemeType.RESOURCE.isScheme(protocol))
             return new ResourceURLStreamHandler();
 		// Force the default factory to retreive stream handler.
 		return null;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/