1/*
2 * Copyright (c) 1997, 2007, 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 4072197
27 * @summary Tests for null in the array of listener method names
28 * @author Graham Hamilton
29 */
30
31import java.awt.event.ActionListener;
32import java.beans.EventSetDescriptor;
33import java.beans.IntrospectionException;
34import java.util.EventObject;
35
36public class Test4072197 {
37    public static void main(String[] args) {
38        try {
39            new EventSetDescriptor(
40                    SourceClass.class,
41                    "action",
42                    Listener.class,
43                    new String[] {"action", "event", null, "dummy"},
44                    "addActionListener",
45                    "removeActionListener"
46            );
47        } catch (IntrospectionException exception) {
48            throw new Error("unexpected exception", exception);
49        } catch (NullPointerException exception) {
50            return; // we caught the NullPointerException as expected
51        }
52        throw new Error("NullPointerException expected");
53    }
54
55    public static class SourceClass {
56        public void addActionListener(ActionListener listener) {
57        }
58
59        public void removeActionListener(ActionListener listener) {
60        }
61    }
62
63    public static class Listener {
64        public void action(EventObject event) {
65        }
66
67        public void event(EventObject event) {
68        }
69
70        public void dummy(EventObject event) {
71        }
72    }
73}
74