W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2009

2006/unicorn/src/org/w3c/unicorn/input URIInputParameter.java,1.12,1.13

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 06 Oct 2009 10:04:43 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Mv6uR-0008Nh-AT@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/input
In directory hutz:/tmp/cvs-serv32202/src/org/w3c/unicorn/input

Modified Files:
	URIInputParameter.java 
Log Message:
new UnicornException method

Index: URIInputParameter.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/input/URIInputParameter.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- URIInputParameter.java	6 Oct 2009 08:16:02 -0000	1.12
+++ URIInputParameter.java	6 Oct 2009 10:04:41 -0000	1.13
@@ -37,45 +37,45 @@
 		URL docUrl = null;
 		try {
 			if (uri.equals(""))
-				throw new UnicornException(Message.ERROR, "$message_empty_uri", null);
+				throw new UnicornException(Message.ERROR, "$message_empty_uri");
 			
 			Pattern urlPattern = Pattern.compile("^(https?)://([A-Z0-9][A-Z0-9_-]*)(\\.[A-Z0-9][A-Z0-9_-]*)*(:(\\d+))?([/#]\\p{ASCII}*)?", Pattern.CASE_INSENSITIVE);
 			if (!urlPattern.matcher(uri).matches()) {
 				if (!uri.contains("://")) 
 					uri = "http://" + uri;
 				if (!urlPattern.matcher(uri).matches())
-					throw new UnicornException(Message.ERROR, "$message_invalid_url_syntax ", uri);
+					throw new UnicornException(Message.ERROR, "$message_invalid_url_syntax", null, uri);
 			}
 			docUrl = new URL(uri);
 			if (!docUrl.getProtocol().equals("http") && !docUrl.getProtocol().equals("https"))
-				throw new UnicornException(Message.ERROR, "$message_unsupported_protocol " + docUrl.getProtocol(), null);
+				throw new UnicornException(Message.ERROR, "$message_unsupported_protocol", null, docUrl.getProtocol());
 			HttpURLConnection con = (HttpURLConnection) docUrl.openConnection();
 			con.setConnectTimeout(connectTimeOut);
 			con.connect();
 			int responseCode = con.getResponseCode();
 			switch (responseCode) {
 			case HttpURLConnection.HTTP_UNAUTHORIZED:
-				throw new UnicornException(Message.ERROR, "$message_unauthorized_access", null);
+				throw new UnicornException(Message.ERROR, "$message_unauthorized_access");
 			case HttpURLConnection.HTTP_NOT_FOUND:
-				throw new UnicornException(Message.ERROR, "$message_document_not_found", null);
+				throw new UnicornException(Message.ERROR, "$message_document_not_found");
 			}
 			String sMimeType = con.getContentType();
 			sMimeType = sMimeType.split(";")[0];
 			mimeType = new MimeType(sMimeType);
 			inputModule = new URIInputModule(mimeType, uri);
 		} catch (MalformedURLException e) {
-			throw new UnicornException(Message.ERROR, "$message_invalid_url_syntax " + uri, null);
+			throw new UnicornException(Message.ERROR, "$message_invalid_url_syntax", null, uri);
 		} catch (MimeTypeParseException e) {
-			throw new UnicornException(Message.ERROR, "$message_invalid_mime_type", null);
+			throw new UnicornException(Message.ERROR, "$message_invalid_mime_type");
 		} catch (UnknownHostException e) { 
-			throw new UnicornException(Message.ERROR, "$message_unknown_host " + docUrl.getHost(), null);
+			throw new UnicornException(Message.ERROR, "$message_unknown_host" , null, docUrl.getHost());
 		} catch (SSLException e) {
-			throw new UnicornException(Message.ERROR, "$message_ssl_exception", null);
+			throw new UnicornException(Message.ERROR, "$message_ssl_exception");
 		} catch (ConnectException e) {
-			throw new UnicornException(Message.ERROR, "$message_connect_exception", null);
+			throw new UnicornException(Message.ERROR, "$message_connect_exception");
 		} catch (SocketTimeoutException e) {
 			if (e.getMessage().contains("connect timed out")) {
-				throw new UnicornException(Message.ERROR, "$message_connect_exception", null);
+				throw new UnicornException(Message.ERROR, "$message_connect_exception");
 			} else {
 				throw new UnicornException(new Message(e));
 			}
Received on Tuesday, 6 October 2009 10:04:44 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:39 UTC