harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r394866 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/ test/java/tests/api/java/net/
Date Tue, 18 Apr 2006 06:58:12 GMT
Author: mloenko
Date: Mon Apr 17 23:58:11 2006
New Revision: 394866

URL: http://svn.apache.org/viewcvs?rev=394866&view=rev
Log:
Fixes for HARMONY-181
3 missing getChannel() methods in java.net package

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/DatagramSocket.java
Mon Apr 17 23:58:11 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 
 
 import java.io.IOException;
+import java.nio.channels.DatagramChannel;
 
 import org.apache.harmony.luni.net.SocketImplProvider;
 
@@ -782,5 +783,15 @@
 	 */
 	public boolean isClosed() {
 		return isClosed;
+	}
+	
+	/**
+	 * if DatagramSocket is created by a DatagramChannel, returns the related
+	 * DatagramChannel
+	 * 
+	 * @return the related DatagramChannel if any
+	 */
+	public DatagramChannel getChannel() {
+		return null;
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/ServerSocket.java
Mon Apr 17 23:58:11 2006
@@ -17,6 +17,7 @@
 
 
 import java.io.IOException;
+import java.nio.channels.ServerSocketChannel;
 
 import org.apache.harmony.luni.net.SocketImplProvider;
 
@@ -133,35 +134,6 @@
 		if (!isBound())
 			throw new SocketException(Msg.getString("K031f"));
 
-		// If a SOCKS proxy is being used, accept does strange things.
-		// Instead of returning a new Socket and allowing this ServerSocket
-		// to be used for another accept, it actually uses the current
-		// ServerSocket
-		// as the accepted Socket. So, closing the returned socket will close
-		// the
-		// ServerSocket as well. The ServerSocket cannot be used for a second
-		// accept.
-        //FIXME: paulex comment this for compile
-//        if (IOUtil.usingSocks()) {
-//            if (impl instanceof PlainSocketImpl) {
-//                try {
-//                    SecurityManager security = System.getSecurityManager();
-//                    if (security != null) {
-//                        security.checkAccept(getInetAddress().getHostAddress(),
-//                                getLocalPort());
-//                    }
-//                } catch (SecurityException e) {
-//                    close();
-//                    throw e;
-//                }
-//
-//                ((PlainSocketImpl) impl).socksAccept();
-//                return new Socket(impl);
-//            }
-//
-//            throw new IOException(Msg.getString("K0041")); //$NON-NLS-1$
-//        }
-
 		Socket aSocket = new Socket();
 		try {
 			synchronized (this) {
@@ -249,7 +221,6 @@
 	 *                thrown if option cannot be retrieved
 	 */
 	public synchronized int getSoTimeout() throws IOException {
-        // TODO Bug-Reporter:check changed! checkClosedAndCreate(true);
         if (!isCreated) {
             synchronized (this) {
                 if (!isCreated) {
@@ -501,6 +472,16 @@
 		return ((Integer) impl.getOption(SocketOptions.SO_RCVBUF)).intValue();
 	}
 	
+	/**
+	 * if ServerSocket is created by a ServerSocketChannel, returns the related
+	 * ServerSocketChannel
+	 * 
+	 * @return the related ServerSocketChannel if any
+	 */
+	public ServerSocketChannel getChannel(){
+		return null;
+	}
+
     /**
 	 * sets performance preference for connectionTime,latency and bandwidth
 	 * 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Socket.java
Mon Apr 17 23:58:11 2006
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.channels.SocketChannel;
 import java.security.AccessController;
 
 import org.apache.harmony.luni.net.NetUtil;
@@ -1045,6 +1046,17 @@
 			return true;
 		return false;
 	}
+	
+	/**
+	 * if Socket is created by a SocketChannel, returns the related
+	 * SocketChannel
+	 * 
+	 * @return the related SocketChannel
+	 */
+	public SocketChannel getChannel() {
+		return null;
+	}
+
     
     /**
 	 * sets performance preference for connectionTime,latency and bandwidth

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/DatagramSocketTest.java
Mon Apr 17 23:58:11 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1850,6 +1850,13 @@
 		} catch (Exception e) {
 			fail("Got exception during isClosed tests" + e.toString());
 		}
+	}
+	
+	/**
+	 * @tests java.net.DatagramSocket#getChannel()
+	 */
+	public void test_getChannel() throws Exception {
+		assertNull(new DatagramSocket().getChannel());
 	}
 
 	/**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/ServerSocketTest.java
Mon Apr 17 23:58:11 2006
@@ -882,6 +882,13 @@
 		}
 	}
 	
+	/**
+	 * @tests java.net.ServerSocket#getChannel()
+	 */
+	public void test_getChannel() throws Exception {
+		assertNull(new ServerSocket().getChannel());
+	}
+	
 	/*
 	* @tests java.net.ServerSocket#setPerformancePreference()
 	*/

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java?rev=394866&r1=394865&r2=394866&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/SocketTest.java
Mon Apr 17 23:58:11 2006
@@ -2163,6 +2163,13 @@
 	}
 
 	/**
+	 * @tests java.net.Socket#getChannel()
+	 */
+	public void test_getChannel() throws Exception {
+		assertNull(new Socket().getChannel());
+	}
+	
+	/**
 	 * @tests java.net.Socket#sendUrgentData(int)
 	 */
 	public void test_sendUrgentDataI() {



Mime
View raw message