1 /* |
1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2013, 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. |
35 * Make sure that rmid prints out a correct usage statement when run with an |
36 * Make sure that rmid prints out a correct usage statement when run with an |
36 * incorrect command line. |
37 * incorrect command line. |
37 */ |
38 */ |
38 public class CheckUsage { |
39 public class CheckUsage { |
39 public static void main(String[] args) { |
40 public static void main(String[] args) { |
40 |
|
41 System.err.println("\nregression test for 4259564\n"); |
|
42 |
|
43 JavaVM rmidVM = null; |
|
44 |
|
45 try { |
41 try { |
46 // make sure the registry exits with a proper usage statement |
|
47 ByteArrayOutputStream berr = new ByteArrayOutputStream(); |
42 ByteArrayOutputStream berr = new ByteArrayOutputStream(); |
48 |
43 |
49 // run a VM to start the registry |
44 // create rmid with incorrect command line args |
50 rmidVM = new JavaVM("sun.rmi.server.Activation", "", "foo", |
45 JavaVM rmidVM = new JavaVM("sun.rmi.server.Activation", "", "foo", |
51 System.out, berr); |
46 System.out, berr); |
52 System.err.println("starting rmid"); |
47 System.err.println("starting rmid"); |
53 rmidVM.start(); |
|
54 |
48 |
55 // wait for registry exit |
49 // run the subprocess and wait for it to exit |
56 int rmidVMExitStatus = rmidVM.getVM().waitFor(); |
50 int rmidVMExitStatus = rmidVM.execute(); |
57 System.err.println("rmid exited with status: " + |
51 System.err.println("rmid exited with status: " + |
58 rmidVMExitStatus); |
52 rmidVMExitStatus); |
59 |
53 |
60 String usage = new String(berr.toByteArray()); |
54 String usage = new String(berr.toByteArray()); |
61 |
55 |