15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* @test 25 * @bug 4136563 26 * @summary Naming.lookup fails to throw exception for invalid hostname 27 * 28 * @bug 4208801 29 * @summary (1.x) java.rmi.Naming defaults to local hostname, not 30 * local IP address 31 * 32 * @author Laird Dornin 33 * 34 * @library ../testlibrary 35 * @build TestLibrary 36 * @run main/othervm InvalidName 37 */ 38 39 import java.net.URL; 40 import java.net.InetAddress; 41 import java.net.MalformedURLException; 42 import java.rmi.registry.Registry; 43 import java.rmi.Naming; 44 import java.rmi.Remote; 45 import java.rmi.server.RemoteObject; 46 import java.rmi.server.UnicastRemoteObject; 47 48 public class InvalidName { 49 public static void main(String[] args) { 50 51 String testName; 52 53 // ensure that an exception is thrown for Naming URL with '#' 54 try { | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* @test 25 * @bug 4136563 26 * @summary Naming.lookup fails to throw exception for invalid hostname 27 * 28 * @bug 4208801 29 * @summary (1.x) java.rmi.Naming defaults to local hostname, not 30 * local IP address 31 * 32 * @author Laird Dornin 33 * 34 * @library ../testlibrary 35 * @modules java.rmi/sun.rmi.registry 36 * java.rmi/sun.rmi.server 37 * java.rmi/sun.rmi.transport 38 * java.rmi/sun.rmi.transport.tcp 39 * @build TestLibrary 40 * @run main/othervm InvalidName 41 */ 42 43 import java.net.URL; 44 import java.net.InetAddress; 45 import java.net.MalformedURLException; 46 import java.rmi.registry.Registry; 47 import java.rmi.Naming; 48 import java.rmi.Remote; 49 import java.rmi.server.RemoteObject; 50 import java.rmi.server.UnicastRemoteObject; 51 52 public class InvalidName { 53 public static void main(String[] args) { 54 55 String testName; 56 57 // ensure that an exception is thrown for Naming URL with '#' 58 try { |