--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 1998-1999 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,15 +34,15 @@
*
* @library ../../testlibrary
* @build CheckFQDN CheckFQDNClient CheckFQDN_Stub TellServerName
- * @run main/othervm/timeout=120 CheckFQDN
+ * @run main/othervm/timeout=120 CheckFQDN
*/
-/**
+/**
* Get the hostname used by rmi using different rmi properities:
*
* if set java.rmi.server.hostname, hostname should equal this
* property.
- *
+ *
* if set java.rmi.server.useLocalHostname, hostname must contain a '.'
*
* if set no properties hostname should be an ipaddress.
@@ -58,118 +58,118 @@
import java.io.*;
/**
- * Export a remote object through which the exec'ed client vm can
+ * Export a remote object through which the exec'ed client vm can
* inform the main test what its host name is.
*/
-public class CheckFQDN extends UnicastRemoteObject
+public class CheckFQDN extends UnicastRemoteObject
implements TellServerName {
-
+
static String propertyBeingTested = null;
static String propertyBeingTestedValue = null;
public static void main(String args[]) {
- Object dummy = new Object();
- CheckFQDN checkFQDN = null;
- try {
- checkFQDN = new CheckFQDN();
+ Object dummy = new Object();
+ CheckFQDN checkFQDN = null;
+ try {
+ checkFQDN = new CheckFQDN();
+
+ System.err.println
+ ("\nRegression test for bug/rfe 4115683\n");
+
+ Registry registry = java.rmi.registry.LocateRegistry.
+ createRegistry(TestLibrary.REGISTRY_PORT);
+ registry.bind("CheckFQDN", checkFQDN);
- System.err.println
- ("\nRegression test for bug/rfe 4115683\n");
-
- Registry registry = java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
- registry.bind("CheckFQDN", checkFQDN);
-
- /* test the host name scheme in different environments.*/
- testProperty("java.rmi.server.useLocalHostname", "true", "");
- testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
- testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
- " -Djava.rmi.server.useLocalHostname=true ");
- testProperty("", "", "");
+ /* test the host name scheme in different environments.*/
+ testProperty("java.rmi.server.useLocalHostname", "true", "");
+ testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest", "");
+ testProperty("java.rmi.server.hostname", "thisIsJustAnRMITest",
+ " -Djava.rmi.server.useLocalHostname=true ");
+ testProperty("", "", "");
- } catch (Exception e) {
- TestLibrary.bomb(e);
- } finally {
- if (checkFQDN != null) {
- TestLibrary.unexport(checkFQDN);
- }
- }
- System.err.println("\nTest for bug/ref 4115683 passed.\n");
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ } finally {
+ if (checkFQDN != null) {
+ TestLibrary.unexport(checkFQDN);
+ }
+ }
+ System.err.println("\nTest for bug/ref 4115683 passed.\n");
}
- /**
+ /**
* Spawn a vm and feed it a property which sets the client's rmi
* hostname.
*/
- public static void testProperty(String property,
- String propertyValue,
- String extraProp)
+ public static void testProperty(String property,
+ String propertyValue,
+ String extraProp)
{
- try {
- String propOption = "";
- String equal = "";
- if (!property.equals("")) {
- propOption = " -D";
- equal = "=";
- }
+ try {
+ String propOption = "";
+ String equal = "";
+ if (!property.equals("")) {
+ propOption = " -D";
+ equal = "=";
+ }
- JavaVM jvm = new JavaVM("CheckFQDNClient",
- propOption + property +
- equal +
- propertyValue + extraProp,
- "");
-
- propertyBeingTested=property;
- propertyBeingTestedValue=propertyValue;
+ JavaVM jvm = new JavaVM("CheckFQDNClient",
+ propOption + property +
+ equal +
+ propertyValue + extraProp,
+ "");
+
+ propertyBeingTested=property;
+ propertyBeingTestedValue=propertyValue;
- // create a client to tell checkFQDN what its rmi name is. */
- jvm.start();
+ // create a client to tell checkFQDN what its rmi name is. */
+ jvm.start();
- if (jvm.getVM().waitFor() != 0 ) {
- TestLibrary.bomb("Test failed, error in client.");
- }
-
- } catch (Exception e) {
- TestLibrary.bomb(e);
- }
+ if (jvm.getVM().waitFor() != 0 ) {
+ TestLibrary.bomb("Test failed, error in client.");
+ }
+
+ } catch (Exception e) {
+ TestLibrary.bomb(e);
+ }
}
CheckFQDN() throws RemoteException { }
- /**
- * Remote method to allow client vm to tell the main test what its
+ /**
+ * Remote method to allow client vm to tell the main test what its
* host name is .
*/
- public void tellServerName(String serverName)
- throws RemoteException {
+ public void tellServerName(String serverName)
+ throws RemoteException {
- if (propertyBeingTested.equals("java.rmi.server.hostname")) {
- if ( !propertyBeingTestedValue.equals(serverName)) {
- TestLibrary.bomb(propertyBeingTested +
- ":\n Client rmi server name does " +
- "not equal the one specified " +
- "by java.rmi.server.hostname: " +
- serverName +" != " +
- propertyBeingTestedValue);
- }
+ if (propertyBeingTested.equals("java.rmi.server.hostname")) {
+ if ( !propertyBeingTestedValue.equals(serverName)) {
+ TestLibrary.bomb(propertyBeingTested +
+ ":\n Client rmi server name does " +
+ "not equal the one specified " +
+ "by java.rmi.server.hostname: " +
+ serverName +" != " +
+ propertyBeingTestedValue);
+ }
- /** use local host name, must contain a '.' */
- } else if (propertyBeingTested.equals
- ("java.rmi.server.useLocalHostname")) {
- if (serverName.indexOf('.') < 0) {
- TestLibrary.bomb(propertyBeingTested +
- ":\nThe client servername contains no '.'");
- }
- } else {
- // no propety set, must be ip address
- if ((serverName.indexOf('.') < 0) ||
- (!Character.isDigit(serverName.charAt(0)))) {
- TestLibrary.bomb("Default name scheme:\n"+
- " The client servername contains no '.'"+
- "or is not an ip address");
- }
- }
- System.err.println("Servername used: " + serverName);
+ /** use local host name, must contain a '.' */
+ } else if (propertyBeingTested.equals
+ ("java.rmi.server.useLocalHostname")) {
+ if (serverName.indexOf('.') < 0) {
+ TestLibrary.bomb(propertyBeingTested +
+ ":\nThe client servername contains no '.'");
+ }
+ } else {
+ // no propety set, must be ip address
+ if ((serverName.indexOf('.') < 0) ||
+ (!Character.isDigit(serverName.charAt(0)))) {
+ TestLibrary.bomb("Default name scheme:\n"+
+ " The client servername contains no '.'"+
+ "or is not an ip address");
+ }
+ }
+ System.err.println("Servername used: " + serverName);
}
}