diff src/main/java/nl/cwi/monetdb/mcl/net/MapiSocket.java @ 225:5ddb1f20d5d5

Socket may also throw an UnknownHostException. Add it to MapiSocket.connect() and catch it in MonetConnection(Properties props).
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 03 May 2018 17:48:16 +0200 (2018-05-03)
parents c38d4eaf5479
children d4baf8a4b43a
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/mcl/net/MapiSocket.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/net/MapiSocket.java
@@ -23,6 +23,7 @@ import java.io.UnsupportedEncodingExcept
 import java.io.Writer;
 import java.net.Socket;
 import java.net.SocketException;
+import java.net.UnknownHostException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.MessageDigest;
@@ -242,17 +243,19 @@ public final class MapiSocket {
 	 * thrown when a redirect is encountered.
 	 *
 	 * @param host the hostname, or null for the loopback address
-	 * @param port the port number
+	 * @param port the port number (must be between 0 and 65535, inclusive)
 	 * @param user the username
 	 * @param pass the password
 	 * @return A List with informational (warning) messages. If this
 	 *		list is empty; then there are no warnings.
 	 * @throws IOException if an I/O error occurs when creating the socket
+	 * @throws SocketException - if there is an error in the underlying protocol, such as a TCP error.
+	 * @throws UnknownHostException if the IP address of the host could not be determined
 	 * @throws MCLParseException if bogus data is received
 	 * @throws MCLException if an MCL related error occurs
 	 */
 	public List<String> connect(String host, int port, String user, String pass)
-		throws IOException, MCLParseException, MCLException
+		throws IOException, UnknownHostException, SocketException, MCLParseException, MCLException
 	{
 		// Wrap around the internal connect that needs to know if it
 		// should really make a TCP connection or not.
@@ -260,7 +263,7 @@ public final class MapiSocket {
 	}
 
 	private List<String> connect(String host, int port, String user, String pass, boolean makeConnection)
-		throws IOException, MCLParseException, MCLException
+		throws IOException, UnknownHostException, SocketException, MCLParseException, MCLException
 	{
 		if (ttl-- <= 0)
 			throw new MCLException("Maximum number of redirects reached, aborting connection attempt. Sorry.");