Modify

Opened 3 years ago

Last modified 6 months ago

#17465 new defect

IAE: Listener buildings_tools.DrawBuildingAction was not registered before or already removed.

Reported by: anonymous Owned by: Upliner
Priority: normal Milestone:
Component: Plugin buildings_tools Version:
Keywords: template_report Cc: marcelshabani@…, EmilyBA

Description

What steps will reproduce the problem?

What is the expected result?

I wanted to update JOSM from vesion 14460 to 14824 unfortunaly.

What happens instead?

I tried to download JOSM it fails in all the ways but it fails.

Please provide any additional information below. Attach a screenshot if possible.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2018-11-28 01:09:01 +0100 (Wed, 28 Nov 2018)
Build-Date:2018-11-28 00:26:41
Revision:14460
Relative:URL: ^/trunk

Identification: JOSM/1.5 (14460 en) Windows 10 64-Bit
OS Build number: Windows 10 Enterprise 1803 (17134)
Memory Usage: 247 MB / 247 MB (111 MB allocated, but free)
Java version: 1.8.0_171-b11, Oracle Corporation, Java HotSpot(TM) Client VM
Screen: \Display0 1366x768
Maximum Screen Size: 1366x768
Dataset consistency test: No problems found

Plugins:
+ BuildingGeneralization (23)
+ buildings_tools (34867)
+ download_along (34869)
+ utilsplugin2 (34506)

Last errors/warnings:
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- W: java.net.SocketTimeoutException: connect timed out
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Listener org.openstreetmap.josm.plugins.buildings_tools.DrawBuildingAction@1009c08 (instance of org.openstreetmap.josm.plugins.buildings_tools.DrawBuildingAction) was not registered before or already removed.
- W: Warning - <html>JOSM could not find information about the following plugins:<ul><li>BuildingGeneralization</li><li>utilsplugin2</li><li>buildings_tools</li><li>download_along</li></ul>The plugins are not going to be loaded.</html>


=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (15) of main
java.lang.IllegalArgumentException: Listener org.openstreetmap.josm.plugins.buildings_tools.DrawBuildingAction@1009c08 (instance of org.openstreetmap.josm.plugins.buildings_tools.DrawBuildingAction) was not registered before or already removed.
	at org.openstreetmap.josm.tools.ListenerList.failRemove(ListenerList.java:132)
	at org.openstreetmap.josm.tools.ListenerList.removeListener(ListenerList.java:126)
	at org.openstreetmap.josm.data.Preferences.removePreferenceChangeListener(Preferences.java:176)
	at org.openstreetmap.josm.actions.mapmode.MapMode.exitMode(MapMode.java:85)
	at org.openstreetmap.josm.plugins.buildings_tools.DrawBuildingAction.exitMode(DrawBuildingAction.java:154)
	at org.openstreetmap.josm.gui.MapFrame.activeOrEditLayerChanged(MapFrame.java:845)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.fireActiveLayerChange(MainLayerManager.java:269)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.setActiveLayer(MainLayerManager.java:262)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realRemoveSingleLayer(MainLayerManager.java:302)
	at org.openstreetmap.josm.gui.layer.LayerManager.realRemoveLayer(LayerManager.java:265)
	at org.openstreetmap.josm.gui.layer.LayerManager.lambda$removeLayer$1(LayerManager.java:247)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:237)
	at org.openstreetmap.josm.gui.layer.LayerManager.removeLayer(LayerManager.java:247)
	at org.openstreetmap.josm.gui.layer.LayerManager.realResetState(LayerManager.java:511)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realResetState(MainLayerManager.java:491)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:237)
	at org.openstreetmap.josm.gui.layer.LayerManager.resetState(LayerManager.java:502)
	at org.openstreetmap.josm.gui.MainTermination.run(MainTermination.java:43)
	at org.openstreetmap.josm.spi.lifecycle.Lifecycle.exitJosm(Lifecycle.java:117)
	at org.openstreetmap.josm.gui.MainApplication.exitJosm(MainApplication.java:500)
	at org.openstreetmap.josm.gui.MainFrame$ExitWindowAdapter.windowClosing(MainFrame.java:181)
	at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
	at java.awt.Window.processWindowEvent(Unknown Source)
	at javax.swing.JFrame.processWindowEvent(Unknown Source)
	at java.awt.Window.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Attachments (1)

josm_fix_map_mode_readonly_layer_v1.patch (2.7 KB) - added by Woazboat 6 months ago.
Disable edit map modes when layer is in readonly mode

Download all attachments as: .zip

Change History (22)

comment:1 in reply to:  description Changed 3 years ago by Hb---

Replying to anonym:

Memory Usage: 247 MB / 247 MB (111 MB allocated, but free)
Java version: 1.8.0_171-b11, Oracle Corporation, Java HotSpot(TM) Client VM

1.
You try to WebStart JOSM from a 32-bit Browser on a 64-Bit Operating system. This starting variant limits the available memory for JOSM to ~250 MB. This not enough.

Please download josm-tested.jar to your hard disk and start JOSM directly as shown in Download#Java.

2.
Your Java version seems a bit outdated. The above mentioned page provides a "manual" download link. Please update this first.

comment:2 Changed 3 years ago by Don-vip

Component: CorePlugin buildings_tools
Owner: changed from team to Upliner

comment:3 Changed 3 years ago by GerdP

@anonym: Please try to update the plugins, they are not all up to date.

comment:4 Changed 3 years ago by Don-vip

Summary: can't download or update josm in windows 10.IAE: Listener buildings_tools.DrawBuildingAction was not registered before or already removed.

comment:5 Changed 3 years ago by Don-vip

Ticket #17855 has been marked as a duplicate of this ticket.

comment:6 Changed 2 years ago by Don-vip

Ticket #18686 has been marked as a duplicate of this ticket.

comment:7 Changed 12 months ago by simon04

Ticket #20917 has been marked as a duplicate of this ticket.

comment:8 Changed 12 months ago by simon04

Cc: EmilyBA added

comment:9 Changed 10 months ago by Don-vip

Ticket #21100 has been marked as a duplicate of this ticket.

comment:10 Changed 6 months ago by Woazboat

Is there any particular reason why the buildings_tool DrawBuildingAction checks if a layer is supported using:

@Override
public boolean layerIsSupported(Layer l) {
    return l instanceof OsmDataLayer;
}

@Override
public void enterMode() {
    super.enterMode();

    MapFrame map = MainApplication.getMap();
    if (getLayerManager().getEditDataSet() == null) {
        map.selectSelectTool(false);
        return;
    }

    // ...
}

instead of e.g. how it's done in other actions like in DrawAction:

@Override
public boolean layerIsSupported(Layer l) {
    return isEditableDataLayer(l);
}

@Override
protected void updateEnabledState() {
    setEnabled(getLayerManager().getEditLayer() != null);
}

@Override
public void enterMode() {
    if (!isEnabled())
        return;
    super.enterMode();

    // ...
}

I think this might be the source of this bug

comment:11 Changed 6 months ago by GerdP

Yes, that's true. When I load an *.osm file with locked='true' the bug is reproducable.

Changed 6 months ago by Woazboat

Disable edit map modes when layer is in readonly mode

comment:12 Changed 6 months ago by Woazboat

The building tools plugin isn't the only one that's affected. Lots of other plugins also don't handle non-editable layers correctly. So far I've found this issue in pt_assistant, splinex and FastDraw (and that's only among the plugins that I have installed)

comment:13 Changed 6 months ago by skyper

Thought we'd have a ticket about pt_assistant, but cannot find it. FastDraw has already one. These tickets are possible candidates.

comment:14 Changed 6 months ago by GerdP

@Woazboat: I don't know what this code is supposed to do. Are you sure that it should be removed?

        if (getLayerManager().getEditDataSet() == null) {
            map.selectSelectTool(false);
            return;
        }

comment:15 Changed 6 months ago by GerdP

In 35864/osm:

fix #17366: IAE: Listener plugins.fastdraw.FastDrawingMode was not registered before or already removed
see #17465

  • Disable edit map modes when layer is in readonly mode (patch by Woazboat, modified to remove unused import)

comment:16 Changed 6 months ago by GerdP

In 35866/osm:

see #17465: IAE: Listener buildings_tools.DrawBuildingAction was not registered before or already removed.

  • layer is in readonly mode is not supported

comment:17 in reply to:  14 Changed 6 months ago by Woazboat

Replying to GerdP:

@Woazboat: I don't know what this code is supposed to do. Are you sure that it should be removed?

        if (getLayerManager().getEditDataSet() == null) {
            map.selectSelectTool(false);
            return;
        }

I'm fairly sure that's supposed to be an attempt to disallow use of the tool/mode when the current layer is not editable, but that's what layerIsSupported() and updateEnabledState() are for. Don't 100% know what map.selectSelectTool(false); is doing in there, but I as far as I can tell it's just supposed to switch to a different mode if activating this one failed because of the editable check.

comment:18 in reply to:  13 Changed 6 months ago by Woazboat

Replying to skyper:

Thought we'd have a ticket about pt_assistant, but cannot find it. FastDraw has already one. These tickets are possible candidates.

pt_assistant development is on github, maybe that's why: https://github.com/JOSM/pt_assistant

comment:19 Changed 6 months ago by Woazboat

What I'm not sure about is why the isEnabled() check in enterMode() is necessary (if at all). I only included it here because it's done this way in the other standard modes I've looked at for reference (e.g. draw mode).

public void enterMode() {
    if (!isEnabled())
        return;
    // ...
}

That check will cause enterMode() to abort without doing anything, but exitMode() will still be executed when the mode is changed, which will lead to the issue seen here in this ticket where a mode is exited without properly entering it first.

    public boolean selectMapMode(MapMode newMapMode, Layer newLayer) {
        MapMode oldMapMode = this.mapMode;
        if (newMapMode == oldMapMode)
            return true;
        if (newMapMode == null || !newMapMode.layerIsSupported(newLayer)) {
            newMapMode = null;
        }
        Logging.debug("Switching map mode from {0} to {1}",
                Optional.ofNullable(oldMapMode).map(m -> m.getClass().getSimpleName()).orElse("(none)"),
                Optional.ofNullable(newMapMode).map(m -> m.getClass().getSimpleName()).orElse("(none)"));

        if (oldMapMode != null) {
            MainApplication.getMenu().findMapModeMenuItem(oldMapMode).ifPresent(m -> m.setSelected(false));
            oldMapMode.exitMode();
        }
        this.mapMode = newMapMode;
        if (newMapMode != null) {
            newMapMode.enterMode();
            MainApplication.getMenu().findMapModeMenuItem(newMapMode).ifPresent(m -> m.setSelected(true));
        }
        lastMapMode.put(newLayer, newMapMode);
        fireMapModeChanged(oldMapMode, newMapMode);
        return newMapMode != null;
    }

    @Override
    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
        boolean modeChanged = false;
        Layer newLayer = e.getSource().getActiveLayer();
        if (mapMode == null || !mapMode.layerIsSupported(newLayer)) {
            MapMode newMapMode = getLastMapMode(newLayer);
            modeChanged = newMapMode != mapMode;
            if (newMapMode != null) {
                // it would be nice to select first supported mode when layer is first selected,
                // but it don't work well with for example editgpx layer
                selectMapMode(newMapMode, newLayer);
            } else if (mapMode != null) {
                mapMode.exitMode(); // if new mode is null - simply exit from previous mode
                mapMode = null;
            }
        }
        // if this is really a change (and not the first active layer)
        if (e.getPreviousActiveLayer() != null && !modeChanged && mapMode != null) {
            // Let mapmodes know about new active layer
            mapMode.exitMode();
            mapMode.enterMode();
        }

        // After all listeners notice new layer, some buttons will be disabled/enabled
        // and possibly need to be hidden/shown.
        validateToolBarsVisibility();
    }

comment:20 Changed 6 months ago by skyper

Don't forget that for many core modes, we actually have two modes, like the rectangle select and the lasso select mode or the different draw and extruder modes.

comment:21 Changed 6 months ago by Woazboat

Yes, but I don't see how the isEnabled() check in enterMode() would help in any situation. For the extrusion tool, all modes modify data and are simply disabled via:

    @Override
    public boolean layerIsSupported(Layer l) {
        return isEditableDataLayer(l);
    }

The select mode checks for non-editable layers like in a custom way (called when the left mouse button is pressed):

    private void determineMapMode(boolean hasSelectionNearby) {
        if (getLayerManager().getEditDataSet() != null) {
            if (shift && ctrl) {
                mode = Mode.ROTATE;
            } else if (alt && ctrl) {
                mode = Mode.SCALE;
            } else if (hasSelectionNearby || dragInProgress()) {
                mode = Mode.MOVE;
            } else {
                mode = Mode.SELECT;
            }
        } else {
            mode = Mode.SELECT;
        }
    }

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Upliner.
as The resolution will be set.
to The owner will be changed from Upliner to the specified user.
The owner will change to anonymous
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from Upliner to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.