jdk/test/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 30470 bd197b8eda21
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24170
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 30470
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
24170
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     4
 *
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     8
 *
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    13
 * accompanied this code).
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    14
 *
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    18
 *
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    21
 * questions.
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    22
 */
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    23
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    24
/*
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    25
  @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 30470
diff changeset
    26
  @key headful
24170
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    27
  @bug 4422345 8039083
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    28
  @summary tests serialization of DragSourceListeners
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    29
  @author das@sparc.spb.su area=dnd
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    30
  @library ../../../../lib/testlibrary
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    31
  @build jdk.testlibrary.Asserts
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    32
  @run main/othervm DragSourceListenerSerializationTest
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    33
*/
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    34
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    35
import java.awt.Button;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    36
import java.awt.Component;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    37
import java.awt.Cursor;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    38
import java.awt.Point;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    39
import java.awt.Toolkit;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    40
import java.awt.datatransfer.StringSelection;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    41
import java.awt.dnd.DnDConstants;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    42
import java.awt.dnd.DragGestureEvent;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    43
import java.awt.dnd.DragGestureRecognizer;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    44
import java.awt.dnd.DragSource;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    45
import java.awt.dnd.DragSourceAdapter;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    46
import java.awt.dnd.DragSourceContext;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    47
import java.awt.dnd.DragSourceListener;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    48
import java.awt.dnd.DragSourceMotionListener;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    49
import java.awt.event.InputEvent;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    50
import java.awt.event.MouseEvent;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    51
import java.io.ByteArrayInputStream;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    52
import java.io.ByteArrayOutputStream;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    53
import java.io.ObjectInputStream;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    54
import java.io.ObjectOutputStream;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    55
import java.io.Serializable;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    56
import java.util.Arrays;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    57
import java.util.TooManyListenersException;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    58
import java.util.stream.Collectors;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    59
import java.util.stream.Stream;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    60
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    61
import static jdk.testlibrary.Asserts.assertEquals;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    62
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    63
public class DragSourceListenerSerializationTest {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    64
    public static void main(String[] args) throws Exception {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    65
        DragSource ds = new DragSource();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    66
        TestDragSourceAdapter dsa1 = new TestDragSourceAdapter(1);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    67
        TestDragSourceAdapter dsa2 = new TestDragSourceAdapter(2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    68
        Component c = new Button();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    69
        DragGestureRecognizer dgr = ds.createDefaultDragGestureRecognizer(c,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    70
                DnDConstants.ACTION_COPY,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    71
                e -> e.startDrag(null, null));
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    72
        MouseEvent me = new MouseEvent(c, MouseEvent.MOUSE_PRESSED, 0,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    73
                InputEvent.CTRL_MASK, 100, 100, 0, false);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    74
        DragGestureEvent dge = new DragGestureEvent(dgr, DnDConstants.ACTION_COPY,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    75
                new Point(100, 100),
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    76
                Arrays.asList(me));
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    77
        DragSourceContext dsc = new DragSourceContext(
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    78
                dge,
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    79
                new Cursor(Cursor.HAND_CURSOR),
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    80
                null, null, new StringSelection("TEXT"), null);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    81
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    82
        ds.addDragSourceListener(dsa1);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    83
        ds.addDragSourceListener(dsa2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    84
        ds.addDragSourceListener(dsa2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    85
        ds.addDragSourceMotionListener(dsa1);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    86
        ds.addDragSourceMotionListener(dsa1);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    87
        ds.addDragSourceMotionListener(dsa2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    88
        dsc.addDragSourceListener(dsa2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    89
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    90
        byte[] serialized;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    91
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    92
             ObjectOutputStream oos = new ObjectOutputStream(bos)) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    93
            oos.writeObject(dsc);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    94
            serialized = bos.toByteArray();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    95
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    96
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    97
        DragSourceContext dsc_copy;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    98
        try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
    99
             ObjectInputStream ois = new ObjectInputStream(bis)) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   100
            dsc_copy = (DragSourceContext) ois.readObject();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   101
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   102
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   103
        try {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   104
            dsc_copy.addDragSourceListener(dsa1);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   105
            throw new RuntimeException("Test failed. Listener addition succeeded");
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   106
        } catch (TooManyListenersException ignored) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   107
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   108
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   109
        try {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   110
            dsc_copy.addDragSourceListener(dsa2);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   111
            throw new RuntimeException("Test failed. Listener addition succeeded");
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   112
        } catch (TooManyListenersException ignored) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   113
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   114
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   115
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   116
             ObjectOutputStream oos = new ObjectOutputStream(bos)) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   117
            oos.writeObject(ds);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   118
            serialized = bos.toByteArray();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   119
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   120
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   121
        DragSource ds_copy;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   122
        try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   123
             ObjectInputStream ois = new ObjectInputStream(bis)) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   124
             ds_copy = (DragSource) ois.readObject();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   125
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   126
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   127
        DragSourceListener[] dsls = ds_copy.getDragSourceListeners();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   128
        assertEquals(3, dsls.length, "DragSourceListeners number");
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   129
        assertEquals(1, Stream.of(dsls).filter(dsa1::equals).collect(Collectors.counting()).intValue());
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   130
        assertEquals(2, Stream.of(dsls).filter(dsa2::equals).collect(Collectors.counting()).intValue());
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   131
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   132
        DragSourceMotionListener[] dsmls = ds_copy.getDragSourceMotionListeners();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   133
        assertEquals(3, dsmls.length, "DragSourceMotionListeners number");
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   134
        assertEquals(2, Stream.of(dsmls).filter(dsa1::equals).collect(Collectors.counting()).intValue());
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   135
        assertEquals(1, Stream.of(dsmls).filter(dsa2::equals).collect(Collectors.counting()).intValue());
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   136
    }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   137
}
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   138
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   139
class TestDragSourceAdapter extends DragSourceAdapter implements Serializable {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   140
    final int id;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   141
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   142
    TestDragSourceAdapter(int id) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   143
        this.id = id;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   144
    }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   145
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   146
    public int getId() {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   147
        return id;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   148
    }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   149
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   150
    public boolean equals(Object obj) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   151
        if (obj instanceof TestDragSourceAdapter) {
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   152
            TestDragSourceAdapter tdsa = (TestDragSourceAdapter) obj;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   153
            return tdsa.getId() == getId();
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   154
        }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   155
        return false;
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   156
    }
8db250c6c7e8 8039083: REGRESSION: closed/java/awt/dnd/DragSourceListenerSerializationTest/DragSourceListenerSerializationTest.html fails with NPE since 8u20 b07 on Linux
pchelko
parents:
diff changeset
   157
}