This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java.net.InetSocketAddres


Hello list,


The appended patch adds some documentation and argument checks for the port 
numbers.


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1417
diff -u -b -r1.1417 ChangeLog
--- ChangeLog	28 Aug 2002 05:24:10 -0000	1.1417
+++ ChangeLog	28 Aug 2002 06:21:09 -0000
@@ -1,5 +1,10 @@
 2002-08-28  Michael Koch <konqueror@gmx.de>
 
+	* java(net/InetSocketAddress: added some documentation and argument
+	checks for the port numbers.
+
+2002-08-28  Michael Koch <konqueror@gmx.de>
+
 	* java/net/Authenticator.java: added some documentation.
 
 2002-08-27  Tom Tromey  <tromey@redhat.com>
Index: java/net/InetSocketAddress.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/InetSocketAddress.java,v
retrieving revision 1.2
diff -u -b -r1.2 InetSocketAddress.java
--- java/net/InetSocketAddress.java	27 Aug 2002 17:47:26 -0000	1.2
+++ java/net/InetSocketAddress.java	28 Aug 2002 06:21:09 -0000
@@ -50,14 +50,37 @@
     InetAddress addr;
     int port;
     
+    /**
+     * Constructs an InetSocketAddress instance.
+     * 
+     * @param addr Address of the socket
+     * @param port Port if the socket
+     *
+     * @exception IllegalArgumentException If the port number is illegel
+     */
     public InetSocketAddress(InetAddress addr, int port)
+	throws IllegalArgumentException
     {
+	if (port < 0 || port > 65535)
+          throw new IllegalArgumentException();
+  
 	this.addr = addr;
 	this.port = port;
     }
 
+    /**
+     * Constructs an InetSocketAddress instance.
+     * 
+     * @param port Port if the socket
+     *
+     * @exception IllegalArgumentException If the port number is illegel
+     */
     public InetSocketAddress(int port)
+	throws IllegalArgumentException
     {
+	if (port < 0 || port > 65535)
+          throw new IllegalArgumentException();
+
 	this.port = port;
 	try {
 	    this.addr = InetAddress.getLocalHost();
@@ -66,8 +89,18 @@
     }
 
 
+    /**
+     * Constructs an InetSocketAddress instance.
+     * 
+     * @param addr Address of the socket
+     * @param port Port if the socket
+     */
     public InetSocketAddress(String hostname, int port)
+	throws IllegalArgumentException
     {
+	if (port < 0 || port > 65535)
+          throw new IllegalArgumentException();
+
 	this.port = port;
 	try {
 	    this.addr = InetAddress.getByName(hostname);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]