Error when dragging station outside the frame

Hello !
I hesitated to post on the forums “Bug” but I’m not sure that the exception is not caused by my code.
I have the following exception when dragging the station outside the frame :


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at bibliothek.gui.dock.FlapDockStation$FlapDropOperation.getCombination(FlapDockStation.java:2099)
    at bibliothek.gui.dock.FlapDockStation$FlapDropOperation.getDisplayerCombination(FlapDockStation.java:2103)
    at bibliothek.gui.dock.control.relocator.TabMerger.canMerge(TabMerger.java:47)
    at bibliothek.gui.dock.control.relocator.MultiMerger.canMerge(MultiMerger.java:79)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.canMerge(DefaultDockRelocator.java:270)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.preparePut(DefaultDockRelocator.java:213)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.selectNextTarget(DefaultDockRelocator.java:631)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.dragMouseDragged(DefaultDockRelocator.java:583)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator.dragMouseDragged(DefaultDockRelocator.java:529)
    at bibliothek.gui.dock.control.relocator.DefaultDockRelocator$MouseRepresentativeListener.mouseDragged(DefaultDockRelocator.java:1026)
    at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:303)
    at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:302)
    at java.awt.Component.processMouseMotionEvent(Component.java:6337)
    at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
    at java.awt.Component.processEvent(Component.java:6058)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4652)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:603)
    at java.awt.EventQueue$1.run(EventQueue.java:601)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$2.run(EventQueue.java:617)
    at java.awt.EventQueue$2.run(EventQueue.java:615)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Here the code to reproduce the issue :

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGridArea;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.util.DockUtilities;

public class Dock2 {

    public static void addGridArea(String id, CControl control) {
        CGridArea area = new CGridArea(control, id) {
            @Override
            public boolean isStackable() {
                return true;
            }

            @Override
            public boolean isExternalizable() {
                return true;
            }
        };

        area.setTitleShown(true);
        area.setTitleText(id);
        control.addDockable(area);
        control.addStation(area, true);
        CLocation location = CLocation.base().normal();
        area.setLocation(location);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new JFrame("Demo");

                final CControl control = new CControl(frame);
                frame.add(control.getContentArea(), BorderLayout.CENTER);

                addGridArea("Grid1", control);

                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setBounds(20, 20, 400, 400);
                frame.setVisible(true);
            }

        });
    }
}


Thank.

Hi

That is clearly a bug. Will be fixed in the next version.

Whenever the framework throws an exception without a clear message telling you what is wrong, it is a bug. :wink:

Thank you.
This reassures me !