#17465 closed defect (fixed)
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)
Change History (27)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
| Component: | Core → Plugin buildings_tools |
|---|---|
| Owner: | changed from to |
comment:4 by , 7 years ago
| Summary: | can't download or update josm in windows 10. → IAE: Listener buildings_tools.DrawBuildingAction was not registered before or already removed. |
|---|
comment:8 by , 5 years ago
| Cc: | added |
|---|
comment:10 by , 4 years ago
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 by , 4 years ago
Yes, that's true. When I load an *.osm file with locked='true' the bug is reproducable.
by , 4 years ago
| Attachment: | josm_fix_map_mode_readonly_layer_v1.patch added |
|---|
Disable edit map modes when layer is in readonly mode
comment:12 by , 4 years ago
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)
follow-up: 18 comment:13 by , 4 years ago
Thought we'd have a ticket about pt_assistant, but cannot find it. FastDraw has already one. These tickets are possible candidates.
follow-ups: 17 23 comment:14 by , 4 years ago
@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:17 by , 4 years ago
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 by , 4 years ago
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 by , 4 years ago
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 by , 4 years ago
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 by , 4 years ago
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; } }
comment:23 by , 3 years ago
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; }
This if block has been around since r21236/osm (2010). We first started updating the status of the button in r4480 (2011), so buildings_tools may have been working around the same bug that r4480 fixed (see #6876).
I think we can safely remove it. I believe it exists to avoid an NPE, which should not happen with the change (isEditableDataLayer introduced in r13434), and it works around someone entering the mode, and then not being able to do anything, by exiting the mode (i.e., changing mode to select mode).



Replying to anonym:
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.