W3C home > Mailing lists > Public > www-validator-cvs@w3.org > July 2005

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

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 22 Jul 2005 09:45:20 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Dvu5o-0005yS-Of@lionel-hutz.w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:48 GMT