[armedbear-cvs] r13097 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Fri Dec 17 22:16:28 UTC 2010


Author: ehuelsmann
Date: Fri Dec 17 17:16:27 2010
New Revision: 13097

Log:
Remove redundant function [toURL(Pathname p)] from Pathname. 

Modified:
   trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
   trunk/abcl/src/org/armedbear/lisp/Pathname.java

Modified: trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java	Fri Dec 17 17:16:27 2010
@@ -232,17 +232,13 @@
     };
 
     protected static void addURL(JavaClassLoader jcl, LispObject jar) {
-	try {
-	    if(jar instanceof Pathname) {
-		jcl.addURL(((Pathname) jar).toURL());
-	    } else if(jar instanceof AbstractString) {
-		jcl.addURL(new Pathname(jar.toString()).toURL());
-	    } else {
-		error(new TypeError(jar + " must be a pathname designator"));
-	    }
-	} catch(java.net.MalformedURLException e) {
-	    error(new LispError(jar + " is not a valid URL"));
-	}
+        if (jar instanceof Pathname) {
+            jcl.addURL(((Pathname) jar).toURL());
+        } else if (jar instanceof AbstractString) {
+            jcl.addURL(new Pathname(jar.toString()).toURL());
+        } else {
+            error(new TypeError(jar + " must be a pathname designator"));
+        }
     }
 
 

Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java	Fri Dec 17 17:16:27 2010
@@ -997,22 +997,18 @@
         return true;
     }
 
-    public static URL toURL(Pathname p) {
-        URL url = null;
-        if (!(p.host instanceof Cons)) {
-            Debug.assertTrue(false); // XXX
-        }
-        try {
-            url = new URL(p.getNamestring());
-        } catch (MalformedURLException e) {
-            Debug.assertTrue(false); // XXX
-        }
-        return url;
-    }
+//    public static URL toURL(Pathname p) {
+ //       try {
+//            return p.toURL();
+//        } catch (MalformedURLException e) {
+//            Debug.assertTrue(false);
+//            return null; // not reached
+//        }
+//    }
 
     URLConnection getURLConnection() {
         Debug.assertTrue(isURL());
-        URL url = Pathname.toURL(this);
+        URL url = this.toURL();
         URLConnection result = null;
         try {
             result = url.openConnection();
@@ -2163,7 +2159,7 @@
                 }
             }
         } else if (isURL()) {
-            URL url = toURL(this);
+            URL url = this.toURL();
             try { 
                 result = url.openStream();
             } catch (IOException e) {
@@ -2381,11 +2377,16 @@
         return getNamestring();
     }
 
-    public URL toURL() throws MalformedURLException {
-        if(isURL()) {
-            return new URL(getNamestring());
-        } else {
-            return toFile().toURL();
+    public URL toURL() {
+        try {
+            if (isURL()) {
+                return new URL(getNamestring());
+            } else {
+                return toFile().toURL();
+            }
+        } catch (MalformedURLException e) {
+            error(new LispError(getNamestring() + " is not a valid URL"));
+            return null; // not reached
         }
     }
 




More information about the armedbear-cvs mailing list