jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java
changeset 43296 0f1ac3527db2
parent 42686 a907a774b802
equal deleted inserted replaced
43295:58870c7a62e0 43296:0f1ac3527db2
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   108      */
   108      */
   109     public static void testProperty(String property,
   109     public static void testProperty(String property,
   110                                     String propertyValue,
   110                                     String propertyValue,
   111                                     String extraProp)
   111                                     String extraProp)
   112     {
   112     {
       
   113         JavaVM jvm = null;
   113         try {
   114         try {
   114             String propOption = "";
   115             String propOption = "";
   115             String equal = "";
   116             String equal = "";
   116             if (!property.equals("")) {
   117             if (!property.equals("")) {
   117                 propOption = " -D";
   118                 propOption = " -D";
   118                 equal = "=";
   119                 equal = "=";
   119             }
   120             }
   120 
   121 
   121             // create a client to tell checkFQDN what its rmi name is.
   122             // create a client to tell checkFQDN what its rmi name is.
   122             JavaVM jvm = new JavaVM("CheckFQDNClient",
   123             jvm = new JavaVM("CheckFQDNClient",
   123                                     propOption + property +
   124                                     propOption + property +
   124                                     equal +
   125                                     equal +
   125                                     propertyValue + extraProp +
   126                                     propertyValue + extraProp +
   126                                     " --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED" +
   127                                     " --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED" +
   127                                     " --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED" +
   128                                     " --add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED" +
   138                 TestLibrary.bomb("Test failed, error in client.");
   139                 TestLibrary.bomb("Test failed, error in client.");
   139             }
   140             }
   140 
   141 
   141         } catch (Exception e) {
   142         } catch (Exception e) {
   142             TestLibrary.bomb(e);
   143             TestLibrary.bomb(e);
       
   144         } finally {
       
   145             if (jvm != null) {
       
   146                 jvm.destroy();
       
   147             }
   143         }
   148         }
   144     }
   149     }
   145 
   150 
   146     CheckFQDN() throws RemoteException { }
   151     CheckFQDN() throws RemoteException { }
   147 
   152