harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r413812 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/MulticastSocket.java test/java/tests/api/java/net/MulticastSocketTest.java
Date Tue, 13 Jun 2006 05:48:09 GMT
Author: hindessm
Date: Mon Jun 12 22:48:08 2006
New Revision: 413812

URL: http://svn.apache.org/viewvc?rev=413812&view=rev
Log:
Applying fix for "[#HARMONY-497] [classlib][luni] java.net.MulticastSocket cannot be instantiated."

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java?rev=413812&r1=413811&r2=413812&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/MulticastSocket.java
Mon Jun 12 22:48:08 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,11 +17,10 @@
 
 
 import java.io.IOException;
-import java.security.AccessController;
 import java.util.Enumeration;
 
+import org.apache.harmony.luni.net.SocketImplProvider;
 import org.apache.harmony.luni.util.Msg;
-import org.apache.harmony.luni.util.PriviAction;
 
 /**
  * This class models a multicast socket for sending & receiving datagram packets
@@ -544,7 +543,7 @@
 	synchronized void createSocket(int aPort, InetAddress addr)
 			throws SocketException {
 		impl = factory != null ? factory.createDatagramSocketImpl()
-				: createSocketImpl();
+				: SocketImplProvider.getMulticastSocketImpl();
 		impl.create();
 		try {
 			// the required default options are now set in the VM where they
@@ -607,31 +606,5 @@
 		checkClosedAndBind(false);
 		impl.setOption(SocketOptions.IP_MULTICAST_LOOP, loop ? Boolean.TRUE
 				: Boolean.FALSE);
-	}
-
-	/**
-	 * Answer a concrete instance of MulticastSocketImpl, either as declared in
-	 * the system properties or the default, PlainDatagramSocketImpl. The latter
-	 * does not support security checks.
-	 * 
-	 * @return DatagramSocketImpl the concrete instance
-	 * 
-	 * @exception SocketException
-	 *                if an error occurs during the instantiation of a type
-	 *                declared in the system properties
-	 */
-	DatagramSocketImpl createSocketImpl() throws SocketException {
-		Object socketImpl = null;
-		String prefix;
-		prefix = (String) AccessController.doPrivileged(new PriviAction(
-				"impl.prefix", "Plain"));
-		try {
-			Class aClass = Class.forName("java.net." + prefix
-					+ "MulticastSocketImpl");
-			socketImpl = aClass.newInstance();
-		} catch (Exception e) {
-			throw new SocketException(Msg.getString("K0033"));
-		}
-		return (DatagramSocketImpl) socketImpl;
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java?rev=413812&r1=413811&r2=413812&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
Mon Jun 12 22:48:08 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.
@@ -114,9 +114,9 @@
 	/**
 	 * @tests java.net.MulticastSocket#MulticastSocket()
 	 */
-	public void test_Constructor() {
-		// Test for method java.net.MulticastSocket()
-		// Used in tests
+	public void test_Constructor() throws IOException {
+		// regression test for 497
+        new MulticastSocket();
 	}
 
 	/**



Mime
View raw message