1 /*
2 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 /*
25 * @test
26 * @bug 4982668
27 * @summary Test that a map containing 'null' values is handled
28 * properly when converting the map into a hashtable,
29 * i.e. all 'null' values should be removed before creating
30 * the hashtable in order to avoid a NullPointerException.
31 * Check also that null values for keys are not allowed in
32 * the maps passed to the JMXConnector[Server] factories.
33 * @author Luis-Miguel Alventosa
34 * @run clean MapNullValuesTest
35 * @run build MapNullValuesTest
36 * @run main MapNullValuesTest
37 */
38
39 import java.rmi.RemoteException;
40 import java.rmi.registry.Registry;
41 import java.rmi.registry.LocateRegistry;
42 import java.util.HashMap;
43 import java.util.Hashtable;
44 import java.util.Iterator;
45 import java.util.Map;
46 import java.util.Set;
47 import javax.management.MBeanServer;
48 import javax.management.MBeanServerFactory;
49 import javax.management.remote.JMXConnector;
50 import javax.management.remote.JMXConnectorFactory;
51 import javax.management.remote.JMXConnectorServer;
52 import javax.management.remote.JMXConnectorServerFactory;
53 import javax.management.remote.JMXServiceURL;
|
1 /*
2 * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 /*
25 * @test
26 * @bug 4982668
27 * @summary Test that a map containing 'null' values is handled
28 * properly when converting the map into a hashtable,
29 * i.e. all 'null' values should be removed before creating
30 * the hashtable in order to avoid a NullPointerException.
31 * Check also that null values for keys are not allowed in
32 * the maps passed to the JMXConnector[Server] factories.
33 * @author Luis-Miguel Alventosa
34 * @modules java.management/com.sun.jmx.remote.util
35 * @run clean MapNullValuesTest
36 * @run build MapNullValuesTest
37 * @run main MapNullValuesTest
38 */
39
40 import java.rmi.RemoteException;
41 import java.rmi.registry.Registry;
42 import java.rmi.registry.LocateRegistry;
43 import java.util.HashMap;
44 import java.util.Hashtable;
45 import java.util.Iterator;
46 import java.util.Map;
47 import java.util.Set;
48 import javax.management.MBeanServer;
49 import javax.management.MBeanServerFactory;
50 import javax.management.remote.JMXConnector;
51 import javax.management.remote.JMXConnectorFactory;
52 import javax.management.remote.JMXConnectorServer;
53 import javax.management.remote.JMXConnectorServerFactory;
54 import javax.management.remote.JMXServiceURL;
|