2002/css-validator/org/w3c/css/util HTTPURL.java,1.13,1.14

Update of /sources/public/2002/css-validator/org/w3c/css/util
In directory hutz:/tmp/cvs-serv22891/util

Modified Files:
	HTTPURL.java 
Log Message:
Added code for error Handling (Jean-Guilhem Rouel)

Index: HTTPURL.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/util/HTTPURL.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- HTTPURL.java	18 Mar 2005 08:37:59 -0000	1.13
+++ HTTPURL.java	22 Jul 2005 09:45:18 -0000	1.14
@@ -114,12 +114,13 @@
     }
 
     public static URL getURL(String url) throws IOException {
-	//	url = URLEncoder.encode(url);
+	// url = URLEncoder.encode(url);
 	try {
 	    return new URL(url);
 	} catch (MalformedURLException e) {
-	    if (!url.startsWith("http:")) {
-		return new URL("http://" + url);
+	    //if (!url.startsWith("http:")) { // ook!? dkfj://wwww.3.org -> http://dkfj://www.w3.org
+	    if(url.indexOf("://") == -1) { // the protocol is missing
+	    	return new URL("http://" + url);
 	    } else {
 		throw (IOException) e.fillInStackTrace();
 	    }

Received on Friday, 22 July 2005 09:45:26 UTC