Modify

Opened 3 years ago

Last modified 2 years ago

#21740 new defect

IAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

Reported by: anonymous Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report listener regression Cc: wegavision, michael2402

Description

What steps will reproduce the problem?

  1. Immediately when starting

What is the expected result?

What happens instead?

styles initialized, background-settings loaded, then system hangs.

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

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2022-01-02 21:24:43 +0100 (Sun, 02 Jan 2022)
Revision:18360
Build-Date:2022-01-02 20:26:19
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18360 de) Linux Ubuntu 20.04.3 LTS
Memory Usage: 422 MB / 4004 MB (208 MB allocated, but free)
Java version: 11.0.13+8-Ubuntu-0ubuntu1.20.04, Ubuntu, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: de_DE.UTF-8
Environment variable LC_ALL: de_DE.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: de_DE
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: ubuntu:GNOME
Java package: openjdk-11-jre:amd64-11.0.13+8-0ubuntu1~20.04
Java ATK Wrapper package: libatk-wrapper-java:all-0.37.1-1
libcommons-compress-java: libcommons-compress-java:all-1.19-1
libcommons-logging-java: libcommons-logging-java:all-1.2-2
fonts-noto: fonts-noto:all-20200323-1build1~ubuntu20.04.1
VM arguments: [--module-path=/usr/share/openjfx/lib, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, -Djosm.restart=true, -Djava.net.useSystemProxies=true, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED]

Plugins:
+ AddrInterpolation
+ ColorPlugin
+ FixAddresses
+ HouseNumberTaggingTool
+ RoadSigns
+ apache-commons
+ apache-http
+ buildings_tools
+ contourmerge
+ jaxb (35893)
+ jna
+ jogl
+ kendzi3d-resources
+ log4j (35893)
+ print
+ tageditor
+ terracer
+ utilsplugin2

Tagging presets:
+ http://josm.openstreetmap.de/josmfile?page=Presets/geoimage.at&preset
+ http://www.country-linedance.de/daten/Verkehrszeichen-vorlage.zip

Map paint styles:
- https://github.com/simon04/coloured-addresses.mapcss/raw/master/dist/coloured-addresses.mapcss

Last errors/warnings:
- 00009.719 W:   : Could not get presets icon presets/parking.png
- 00009.721 E: Fehler beim Laden des Bildes 'presets/parking.png'
- 00009.722 W:  Parking space: Could not get presets icon presets/parking.png
- 00009.723 E: Fehler beim Laden des Bildes 'presets/parking.png'
- 00009.723 W:  Parking entrance: Could not get presets icon presets/parking.png
- 00009.725 E: Fehler beim Laden des Bildes 'presets/traffic-light.png'
- 00009.725 W:   : Could not get presets icon presets/traffic-light.png
- 00009.842 E: Handled by bug report queue: org.openstreetmap.josm.tools.JosmRuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns. Ursache: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns. Ursache: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns
- 00022.689 W: java.net.SocketTimeoutException: connect timed out
- 00022.790 E: Fehler beim Laden des Bildes 'http://openptmap.de/favicon_pt.png'



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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: main (1)
org.openstreetmap.josm.tools.JosmRuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns
	at org.openstreetmap.josm.spi.lifecycle.Lifecycle.initialize(Lifecycle.java:93)
	at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:951)
	at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:281)
	at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:739)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at org.openstreetmap.josm.spi.lifecycle.Lifecycle.initialize(Lifecycle.java:78)
	... 3 more
Caused by: java.lang.IllegalArgumentException: Attempted to add listener that was already in list:  RoadSigns
	at org.openstreetmap.josm.gui.layer.MainLayerManager.addActiveLayerChangeListener(MainLayerManager.java:177)
	at org.openstreetmap.josm.gui.tagging.presets.TaggingPresets.initialize(TaggingPresets.java:93)
	at org.openstreetmap.josm.spi.lifecycle.InitializationTask.call(InitializationTask.java:33)
	at org.openstreetmap.josm.spi.lifecycle.InitializationTask.call(InitializationTask.java:11)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Attachments (3)

21740.patch (2.8 KB ) - added by GerdP 2 years ago.
check for identity, log error instead of throwing an IllegalArgumentException (only affects ActiveLayerChangeListener)
21740-junit.patch (3.6 KB ) - added by GerdP 2 years ago.
21740-MainLayerManagerTest.patch (3.0 KB ) - added by Bjoeni 2 years ago.

Download all attachments as: .zip

Change History (63)

comment:1 by stoecker, 3 years ago

Component: CorePlugin roadsigns

comment:2 by skyper, 3 years ago

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

comment:3 by skyper, 3 years ago

Cc: wegavision added

comment:4 by skyper, 3 years ago

Keywords: listener added
Summary: Startup crashIAE: Attempted to add listener that was already in list: RoadSigns

comment:5 by taylor.smock, 3 years ago

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

comment:6 by bergaufsee@…, 3 years ago

I don't think so the plugin roadsigns is the problem. The recommended suggestion to delete the RoadSigns.jar file wasn't successful.
My solution:

comment:7 by wegavision, 3 years ago

josm-snapshot-18303.jar doesn't work neither, perhaps my problem is older, my last JOSM-upgrate may be a year ago or longer:

-jar josm-snapshot-18303.jar --skip-plugins

2022-01-08 15:33:52.599 INFORMATION: Protokollierungsgrad ist bei INFORMATION (INFO, 800)
2022-01-08 15:33:52.699 INFORMATION: Erweiterungen-Ladevorgang übersprungen
2022-01-08 15:34:04.800 WARNUNG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
2022-01-08 15:35:11.877 WARNUNG: java.nio.file.FileSystemException: C:\Users\ich\AppData\Local\Temp\josm_exec_powershell_6073909420125386713.txt: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
java.nio.file.FileSystemException: C:\Users\ich\AppData\Local\Temp\josm_exec_powershell_6073909420125386713.txt: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.

        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
        at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
        at java.nio.file.Files.delete(Unknown Source)
        at org.openstreetmap.josm.tools.Utils.execOutput(Utils.java:873)
        at org.openstreetmap.josm.tools.PlatformHookWindows.webRequest(PlatformHookWindows.java:679)
        at org.openstreetmap.josm.tools.PlatformHookWindows.getX509Certificate(PlatformHookWindows.java:362)
        at org.openstreetmap.josm.io.CertificateAmendment.addMissingCertificates(CertificateAmendment.java:240)
        at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:876)
        at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:281)
        at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:739)

2022-01-08 15:35:11.978 WARNUNG: Unable to request certificate of https://grca.nat.gov.tw
2022-01-08 15:35:17.032 WARNUNG: java.nio.file.FileSystemException: C:\Users\ich\AppData\Local\Temp\josm_exec_powershell_5483104637998495429.txt: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
java.nio.file.FileSystemException: C:\Users\ich\AppData\Local\Temp\josm_exec_powershell_5483104637998495429.txt: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.

        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
        at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
        at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
        at java.nio.file.Files.delete(Unknown Source)
        at org.openstreetmap.josm.tools.Utils.execOutput(Utils.java:873)
        at org.openstreetmap.josm.tools.PlatformHookWindows.webRequest(PlatformHookWindows.java:679)
        at org.openstreetmap.josm.tools.PlatformHookWindows.getX509Certificate(PlatformHookWindows.java:362)
        at org.openstreetmap.josm.io.CertificateAmendment.addMissingCertificates(CertificateAmendment.java:240)
        at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:876)
        at org.openstreetmap.josm.gui.MainApplication$3.processArguments(MainApplication.java:281)
        at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:739)

2022-01-08 15:35:17.033 WARNUNG: Unable to request certificate of https://grca.nat.gov.tw
2022-01-08 15:36:01.759 INFORMATION: GET https://api.openstreetmap.org/api/0.6/user/details -> HTTP/1.1 200 (4,6 s; 457 B)
2022-01-08 15:36:08.365 INFORMATION: GET https://josm.openstreetmap.de/wiki/De:StartupPage -> HTTP/1.1 200 (832 ms)
2022-01-08 15:36:11.392 INFORMATION: 82 Tag2Link Regeln wurden von resource://META-INF/resources/webjars/tag2link/2021.3.21/index.json bezogen
2022-01-08 15:36:14.236 INFORMATION: GET https://josm.openstreetmap.de/maps?ids=Bing%2CEsriWorldImagery%2CEsriWorldImageryClarity%2CMaps4BW-LGL_BW%2CMaxar-Premium%2Cstandard -> HTTP/1.1 304 (774 ms)
2022-01-08 15:36:23.800 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/parking.png'
2022-01-08 15:36:23.802 WARNUNG:   : Could not get presets icon presets/parking.png
2022-01-08 15:36:23.804 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/car.png'
2022-01-08 15:36:23.805 WARNUNG:  car only: Could not get presets icon presets/car.png
2022-01-08 15:36:23.806 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/bus.png'
2022-01-08 15:36:23.806 WARNUNG:   : Could not get presets icon presets/bus.png
2022-01-08 15:36:23.807 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/bike.png'
2022-01-08 15:36:23.808 WARNUNG:   : Could not get presets icon presets/bike.png
2022-01-08 15:36:23.809 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/motorbike.png'
2022-01-08 15:36:23.809 WARNUNG:   : Could not get presets icon presets/motorbike.png
2022-01-08 15:36:23.810 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/parking.png'
2022-01-08 15:36:23.811 WARNUNG:   : Could not get presets icon presets/parking.png
2022-01-08 15:36:23.814 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/parking.png'
2022-01-08 15:36:23.815 WARNUNG:  Parking space: Could not get presets icon presets/parking.png
2022-01-08 15:36:23.816 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/parking.png'
2022-01-08 15:36:23.819 WARNUNG:  Parking entrance: Could not get presets icon presets/parking.png
2022-01-08 15:36:23.820 SCHWERWIEGEND: Fehler beim Laden des Bildes 'presets/traffic-light.png'
2022-01-08 15:36:23.821 WARNUNG:   : Could not get presets icon presets/traffic-light.png
2022-01-08 15:36:25.649 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.650 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.656 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.659 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.660 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.660 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.660 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.661 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.661 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.662 INFORMATION: Registrierte Werkzeugleistenaktion tagging_RoadSigns/ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.662 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.671 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.671 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.674 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.675 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.675 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.676 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.676 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.677 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.677 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.677 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.678 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.678 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.679 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.679 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.683 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.684 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.685 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.687 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.690 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.691 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.691 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.692 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.692 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.693 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.693 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.693 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.694 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.695 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.695 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.696 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.704 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.706 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.707 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.707 INFORMATION: Registrierte Werkzeugleistenaktion tagging_ / / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:25.708 INFORMATION: Registrierte Werkzeugleistenaktion tagginggroup_ / / / /RoadSigns überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPresetMenu wird org.openstreetmap.josm.gui.tagging.presets.TaggingPresetMenu
2022-01-08 15:36:25.800 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.801 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.802 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.802 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.804 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.805 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.805 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.806 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.806 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.807 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.808 SCHWERWIEGEND: No tagging preset submenu for  RoadSigns
2022-01-08 15:36:25.808 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.808 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.809 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:25.809 SCHWERWIEGEND: No tagging preset submenu for
2022-01-08 15:36:26.006 INFORMATION: GET http://www.country-linedance.de/daten/image/pavement.png -> HTTP/1.1 404 (351 ms; 34 B)
2022-01-08 15:36:26.119 SCHWERWIEGEND: Fehler beim Laden des Bildes 'http://www.country-linedance.de/daten/image/pavement.png'
2022-01-08 15:36:26.238 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.239 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.240 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.240 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.242 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.242 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.243 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.243 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.244 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.245 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.245 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.246 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.246 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.246 INFORMATION: Werkzeugleistenaktion tagging_ / / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.248 INFORMATION: Werkzeugleistenaktion tagging_ / / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.249 INFORMATION: Werkzeugleistenaktion tagging_ / / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.250 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.251 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.251 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.252 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.252 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.253 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.253 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.253 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.254 INFORMATION: Werkzeugleistenaktion tagging_ / / überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.254 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.254 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.255 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.256 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.256 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.256 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.257 INFORMATION: Werkzeugleistenaktion tagging_ / /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.257 INFORMATION: Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.258 INFORMATION: Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.258 INFORMATION: Werkzeugleistenaktion tagging_ /  überschrieben: org.openstreetmap.josm.gui.tagging.presets.TaggingPreset wird org.openstreetmap.josm.gui.tagging.presets.TaggingPreset
2022-01-08 15:36:26.339 INFORMATION: GET http://www.country-linedance.de/daten/image/DE_220;DE_267.png -> HTTP/1.1 404 (21 ms; 34 B)
2022-01-08 15:36:26.453 INFORMATION: Could not load tool definition splitobject
2022-01-08 15:36:26.459 INFORMATION: Could not load tool definition reverse_terrace
2022-01-08 15:36:26.460 INFORMATION: Could not load tool definition home-icon32
2022-01-08 15:36:26.466 SCHWERWIEGEND: Fehler beim Laden des Bildes 'http://www.country-linedance.de/daten/image/DE_220;DE_267.png'
2022-01-08 15:36:26.492 INFORMATION: GET http://www.country-linedance.de/daten/image/DE_220;DE_267.png -> HTTP/1.1 404 (24 ms; 34 B)
2022-01-08 15:36:26.605 SCHWERWIEGEND: Fehler beim Laden des Bildes 'http://www.country-linedance.de/daten/image/DE_220;DE_267.png'
2022-01-08 15:36:27.216 INFORMATION: GET http://www.country-linedance.de/daten/image/20.png -> HTTP/1.1 404 (36 ms; 34 B)
2022-01-08 15:36:27.325 SCHWERWIEGEND: Fehler beim Laden des Bildes 'http://www.country-linedance.de/daten/image/20.png'
2022-01-08 15:36:30.712 INFORMATION: Message notifier active (checks every 5 minutes)
2022-01-08 15:36:30.712 INFORMATION: Changeset updater active (checks every 60 minutes if open changesets have been closed)
2022-01-08 15:36:30.716 WARNUNG: [WAY] pavements: Could not get presets icon http://www.country-linedance.de/daten/image/pavement.png
2022-01-08 15:36:30.716 WARNUNG:   : Could not get presets icon http://www.country-linedance.de/daten/image/DE_220;DE_267.png
2022-01-08 15:36:30.718 WARNUNG: [WAY]  : Could not get presets icon http://www.country-linedance.de/daten/image/DE_220;DE_267.png
2022-01-08 15:36:30.718 WARNUNG: [WAY] Maxspeed 20: Could not get presets icon http://www.country-linedance.de/daten/image/20.png
2022-01-08 15:36:30.934 INFORMATION: GET https://api.openstreetmap.org/api/0.6/user/details (Anzahl der ungelesenen Nachrichten abrufen) -> HTTP/1.1 200 (219 ms; 457 B)
Last edited 2 years ago by skyper (previous) (diff)

comment:8 by wegavision, 3 years ago

Ok 529 works without --skip-plugins

comment:9 by wegavision, 3 years ago

Just deactivate Verkehrzeichen and reinstall JOSM with josm-setup (latest) and I get Build-Date:2021-03-18 02:30:56
Revision:17588
repeatung the istallation doesn`t work
There are now two JOSM Version on my computer, starting with jar I get 18303 and with josm.setup 17588

Searching JOSM folders after deinstalling. There was one in Roaming with data from 2014 wirg sub-folder /Verkehrszeichen and /mapillary (which was my first problem, JOSM searches old pre-facebook URLs)
Installing via windows installer works and JOSM starts with the newest version

Ok JOSM works fine, now I have to search my old plugins and styles...

Last edited 3 years ago by wegavision (previous) (diff)

in reply to:  9 comment:10 by bergaufsee@…, 3 years ago

Ok JOSM works fine,

sounds good

now I have to search my old plugins and styles...

Good luck and have fun ;)

comment:11 by skyper, 2 years ago

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

in reply to:  9 comment:12 by skyper, 2 years ago

Looks like a problem updating/loading plugins as ssl certificate management is broken.

Replying to wegavision:

Ok JOSM works fine, now I have to search my old plugins and styles...

I am sorry, to read this. There is an option to save the settings to a file but it is well hidden in advance preferences and only available in expert mode.

comment:13 by skyper, 2 years ago

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

in reply to:  6 comment:14 by skyper, 2 years ago

Replying to bergaufsee@…:

I don't think so the plugin roadsigns is the problem. The recommended suggestion to delete the RoadSigns.jar file wasn't successful.
My solution:

Looking at the duplicates #21880 and #21916 which both have the tagging preset "Verkehrszeichen" in the log. I think the problem might be the missing ssl encryption for the external preset.

comment:15 by stoecker, 2 years ago

Component: Plugin roadsignsCore

Seems the "RoadSigns" comes from the preset. It's the main group of the preset. Thought why the error appears is still unclear.

comment:16 by GerdP, 2 years ago

It seems to me this ticket handles two or more completely separate issues? My understanding is that the "Listener that was already in list" problem was solved, but I don't fully understand what the rest of the comments is about.
The plugin RoadSigns adds presets, these appear in the preferences.xml. If the plugin is uninstalled (or not loaded) there is no code to remove the entries from the preferences, so the next time when JOSM starts it will complain about the presets because JOSM only knows "the names" but not the meaning.

comment:17 by stoecker, 2 years ago

And this conflicts with the preset named RoadSigns from Verkehrszeichen or why comes the double listener issue?

comment:18 by GerdP, 2 years ago

Ah, so you think the listener problem is caused by the ssl connection problem? I thought comment:8 confirmed that the listener problem is solved but I probably got that wrong.

comment:19 by stoecker, 2 years ago

I doubt SSL is really the reason, but I don't know what the root cause is.

comment:20 by GerdP, 2 years ago

It might be related to r18321 or in general with #21446. I didn't test these changes with the Roadsign plugin.

comment:21 by GerdP, 2 years ago

Ah, sorry, the plugin really isn't to blame. The preset http://www.country-linedance.de/daten/Verkehrszeichen-vorlage.zip
contains the string <group name="RoadSigns".
When I start a clean JOSM and add this external preset I get the crash about the listener.

comment:22 by GerdP, 2 years ago

Keywords: regression added
Owner: changed from team to GerdP
Status: newassigned

Yes, problem is caused by r18321. With the old code each preset in the group was registered without a name, with the new code each preset gets the group name RoadSigns and that fails.
I'll try to find a fix for that.

comment:23 by GerdP, 2 years ago

Hmm, the old code simply worked around the test which checked for duplicate listeners.
The preset was added as a listener in a state where getRawName() returned null and then modified to return RoadSigns.
So, when the next preset is added with getRawName() returning null no problem is found.
With the new code the preset is fully initialised before it is added as a listener and now the duplicate listener test fails.

Question is: Are the tests about duplicate listeners wrong or should the presets be created with unique names?

comment:24 by GerdP, 2 years ago

Summary: IAE: Attempted to add listener that was already in list: RoadSignsIAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

comment:25 by GerdP, 2 years ago

My current thinking is that an array of listeners should be searched with == instead of equals() to avoid these problems.

comment:26 by stoecker, 2 years ago

Sounds wrong.

comment:27 by GerdP, 2 years ago

I've not tried it yet. Why do you think it sounds wrong?

comment:28 by stoecker, 2 years ago

Because then any new listener is different. You'll never match.

comment:29 by GerdP, 2 years ago

My understanding of the test is that it wants to find identical objects which are registered multiple times.

comment:30 by GerdP, 2 years ago

Cc: michael2402 added

in reply to:  25 comment:31 by michael2402, 2 years ago

Replying to GerdP:

My current thinking is that an array of listeners should be searched with == instead of equals() to avoid these problems.

Yes, Listeners should be compared by instance, bot by equality.

comment:32 by michael2402, 2 years ago

And to fix the root source (why this was never discovered before):

Don't use the object as listener. Don't implement the ActiveLayerChangeListener interface in your TaggingPreset object. Use a separate Object for the listener.

Like this:

class TaggingPreset {
  private ActiveLayerChangeListener layerChangeListener = ... IMPLEMENTATION HERE ...

  // That the listener is used should be internal to the preset.
  // Currently, presets are sadly only usable with the main MapView / main layer manager.
  // If one creates a separate MapView and wants users to use the preset on the objects displayed there, this is not possible.
  // To allow this in the future, get rid of all the global OsmDataManager.getInstance() calls and store the layer manager in the preset:
  private MainLayerManager layerManager;

  // Called by the menu on init
  public void setLayerManager(MainLayerManager layerManager) {
    if (this.layerManager) {
      this.layerManager.removeActiveLayerChangeListener(this.layerChangeListener);
    }
    this.layerManager = layerManager;
    if (layerManager != null) {
      layerManager.addActiveLayerChangeListener(this.layerChangeListener);
    }
  }

  // Call to destroy / remove all listeners. Called by the "menu"
  public dispose() {
    this.setLayerManager(null);
  }
}

comment:33 by GerdP, 2 years ago

We have other code that uses the wrong test, e.g. addIfAbsent() in ChangesetCache:

    public void addChangesetCacheListener(ChangesetCacheListener listener) {
        if (listener != null) {
            listeners.addIfAbsent(listener);
        }
    }

in reply to:  33 comment:34 by michael2402, 2 years ago

Replying to GerdP:

We have other code that uses the wrong test, e.g. addIfAbsent() in ChangesetCache:

Yes, there are many places where listeners are expected to not implement the "equals()" method.

In general, it is best practice to always use a separate object for the listener that does only implement the listener, not any other interfaces, no equals().

comment:35 by GerdP, 2 years ago

OK, that sounds like a big change which may introduce a lot of binary incompatibilites. Too much for me right now.

in reply to:  35 comment:36 by michael2402, 2 years ago

Replying to GerdP:

OK, that sounds like a big change which may introduce a lot of binary incompatibilites. Too much for me right now.

It should not introduce any incompatibilities that affect plugins.
(1) That the class is not implementing the listener is no problem for the plugins, since plugins should never call that listener method.
(2) The addition and removal of the listener is only managed by JOSM, plugins should not interfere there.
(3) The new method to attach / detach the preset from the layer manager is only called by JOSM itself. And it is a new method, so no problems there.

Sadly, JOSM has no CI test for this, otherwise I would have suggested: Make a branch, see if CI finds problems.

comment:37 by marcello@…, 2 years ago

In http://www.country-linedance.de/daten/Verkehrszeichen-vorlage.zip all item names are empty. It will register many toolbar actions by the same (invalid) name. Should fix that first.

comment:38 by marcello@…, 2 years ago

BTW the patch in #21851 already fixes this because it refactors the preset action into its own class of TaggingPresetAction.

in reply to:  32 ; comment:39 by marcello@…, 2 years ago

Replying to michael2402:

And to fix the root source (why this was never discovered before):

The root cause and obvious fix is: The test is overly zealous and should only display a warning. There is nothing wrong with adding the same layer change listener multiple times (except wasted CPU cycles). In our case it just would enable or disable the preset menu twice.

Don't use the object as listener. Don't implement the ActiveLayerChangeListener interface in your TaggingPreset object. Use a separate Object for the listener.

This is debatable. Multiplying classes without good reasons makes the code less maintainable. A better reason is that a private inner class hides the listener, so nobody can call it directly.

class TaggingPreset {
  private ActiveLayerChangeListener layerChangeListener = ... IMPLEMENTATION HERE ...

  // That the listener is used should be internal to the preset.
  // Currently, presets are sadly only usable with the main MapView / main layer manager.
  // If one creates a separate MapView and wants users to use the preset on the objects displayed there, this is not possible.
  // To allow this in the future, get rid of all the global OsmDataManager.getInstance() calls and store the layer manager in the preset:
  private MainLayerManager layerManager;

That would only allow other layers to be edited.

The patch in #21851 does exactly what you want: It makes all preset editing go thru a connector. You can use the preset subsystem to edit any key/value store -- your email headers if you want -- just write the connector.

in reply to:  39 comment:40 by GerdP, 2 years ago

Replying to marcello@…:

The root cause and obvious fix is: The test is overly zealous and should only display a warning.

+1

I would simply change the code to use a for loop with == instead of making assumptions about the existence of the equals() method in the listener.

by GerdP, 2 years ago

Attachment: 21740.patch added

check for identity, log error instead of throwing an IllegalArgumentException (only affects ActiveLayerChangeListener)

comment:41 by GerdP, 2 years ago

Reg. the preset in http://www.country-linedance.de/daten/Verkehrszeichen-vorlage.zip:
With this patch the preset still produces various error messages and one stacktrace "Attempted to add listener that was already in list: RoadSigns"
I would suggest to blacklist this preset if that is possible. It was last modified in 2012.

@marcello: Yes, your patch avoids the duplicate listener. It also shows the preset in a more reasonable way. Sorry, I really don't have the time to look more closely at it.

comment:42 by stoecker, 2 years ago

Hmm, banning a preset only because we have issues in JOSM isn't ok. Either we should reject it as invalid (when it is invalid) or handle it correctly even if it strange.

comment:43 by GerdP, 2 years ago

I don't know if it is allowed to have presets without a name? The preset has lots of items similar to this:

<item  name="" de.name="Fußweg"  icon="http://www.country-linedance.de/daten/image/DE_239.png" type="way">

Is it expected that JOSM recognizes de.name="Fußweg" as name?

comment:44 by stoecker, 2 years ago

No. That's not allowed, but also not catched by the XML checks. I think this should issue errors. Preset entry ... has no name".

comment:45 by marcello@…, 2 years ago

An empty name makes different presets compare the same with equals and that makes the test fail.

comment:46 by GerdP, 2 years ago

In 18390/josm:

see #21740: IAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

  • improve check for repeatedly registered ActiveLayerChangeListener: check for identity instead of equality, log error with traceback (similar to EDT violations) instead of throwing an IllegalArgumentException

comment:47 by Bjoeni, 2 years ago

@GerdP: Two tests fail since r18390

org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
	at org.openstreetmap.josm.gui.layer.MainLayerManagerTest.testAddActiveLayerChangeListenerTwice(MainLayerManagerTest.java:148)
org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
	at org.openstreetmap.josm.gui.layer.MainLayerManagerTest.testRemoveActiveLayerChangeListenerNotInList(MainLayerManagerTest.java:174)

comment:48 by GerdP, 2 years ago

Ouch, didn't think about this. Is there a way to test if the error message was logged?

comment:49 by taylor.smock, 2 years ago

When I've had to check to see if an error was logged that I was not re-raising, I use Logging.clearLastErrorAndWarnings() just prior to the call expected to log an exception with Logging.getLastErrorAndWarnings() after the call expected to log an exception.

comment:50 by GerdP, 2 years ago

OK, thanks, I'll try to fix the test tomorrow.

comment:51 by Bjoeni, 2 years ago

You could also add a handler to the Logger through Logging.getLogger().addHandler(), for which the publish(LogRecord record) method should be called. See for example /test/unit/org/openstreetmap/josm/tools/LoggingTest.java.

by GerdP, 2 years ago

Attachment: 21740-junit.patch added

comment:52 by GerdP, 2 years ago

Like this? I hope the logged error messages don't produce further problems?

comment:53 by taylor.smock, 2 years ago

Pretty much. With a few caveats. For example, you probably would want to check the content of the error log. See https://gitlab.com/gokaart/JOSM_MapWithAI/-/blob/master/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/backend/MapWithAIDataUtilsTest.java#L181 for an example of what I did.

Alternatively, you could use Bjoeni's suggestion. I should probably look into creating a JUnit5 annotation for adding handlers though. That way users don't have to worry about removing the handler in a finally block.

Also, you probably don't want to commit tools/eclipse/JOSM. :)

comment:54 by GerdP, 2 years ago

Problem is that Logging.getLastErrorAndWarnings() contains only the last 10 warnings, in my case parts of the stacktrace.
So, it's hard to check for a special string.

comment:55 by GerdP, 2 years ago

In 18393/josm:

see #21740: IAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

  • fix unit tests

comment:56 by GerdP, 2 years ago

Owner: changed from GerdP to team
Status: assignednew

I leave further improvements to the team. Does anybody know how to contact Lutz, the author of the preset?

in reply to:  55 comment:57 by Bjoeni, 2 years ago

Replying to GerdP:

In 18393/josm:

see #21740: IAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

  • fix unit tests

Tbh I'm not too fond of that because it doesn't really test the issue anymore. There are many reasons why something (anything) is logged. I'd suggest doing it like in the attached patch:

by Bjoeni, 2 years ago

comment:58 by GerdP, 2 years ago

In 18394/josm:

see #21740: IAE: Attempted to add listener that was already in list: external preset with group name RoadSigns

  • improve unit test (patch by Bjoeni)

comment:59 by GerdP, 2 years ago

Yes, better! Thanks!

comment:60 by taylor.smock, 2 years ago

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to anonymous.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.