Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14759 closed defect (fixed)

[Plugin Cadastre-fr] Crash when closing "Address tool"

Reported by: Binnette Owned by: pieren
Priority: normal Milestone:
Component: Plugin cadastre-fr Version: latest
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Open JOSM
  2. Download a part of French city (example Versailles)
  3. Launch fr-cadastre's "Address tool" (en:Add Address)(fr: Outil d'aide pour l'adresse (E))
  4. Close the popup "Sasir les adresses"
  5. JOSM crash ! Popup "Vous avez rencontré une erreur dans JOSM" is displayed

What is the expected result?

Simply close the popup.

What happens instead?

JOSM Crash

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

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-05-02 23:28:33 +0200 (Tue, 02 May 2017)
Build-Date:2017-05-02 21:34:40
Revision:12039
Relative:URL: ^/trunk

Identification: JOSM/1.5 (12039 fr) Windows 7 64-Bit
Memory Usage: 217 MB / 247 MB (63 MB allocated, but free)
Java version: 1.8.0_131-b11, Oracle Corporation, Java HotSpot(TM) Client VM
Screen: \Display0 1920x1080, \Display1 1920x1080
Maximum Screen Size: 1920x1080
VM arguments: [-Djava.security.manager, -Djava.security.policy=file:<java.home>\lib\security\javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>\bin, -Djnlpx.origFilenameArg=%UserProfile%\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\56\1ee8cfb8-65a16937, -Djnlpx.remove=false, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.splashport=30195, -Djnlp.application.href=https://josm.openstreetmap.de/download/josm.jnlp, -Djnlpx.jvm=<java.home>\bin\javaw.exe]
Dataset consistency test: No problems found

Plugins:
+ cadastre-fr (33279)
+ ejml (32680)
+ geotools (33042)
+ jts (32699)

Last errors/warnings:
- W: extended font config - overriding 'allfonts.symbol=Symbol' with 'Segoe UI Symbol'
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Listener cadastre_fr.Address@3a22db (instance of cadastre_fr.Address) was not registered before or already removed.


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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-2 (47) of javawsApplicationThreadGroup
java.lang.IllegalArgumentException: Listener cadastre_fr.Address@3a22db (instance of cadastre_fr.Address) was not registered before or already removed.
	at org.openstreetmap.josm.tools.ListenerList.failRemove(ListenerList.java:134)
	at org.openstreetmap.josm.tools.ListenerList$TracingListenerList.failRemove(ListenerList.java:211)
	at org.openstreetmap.josm.tools.ListenerList.removeListener(ListenerList.java:128)
	at org.openstreetmap.josm.tools.ListenerList$TracingListenerList.removeListener(ListenerList.java:195)
	at org.openstreetmap.josm.data.Preferences.removePreferenceChangeListener(Preferences.java:249)
	at org.openstreetmap.josm.actions.mapmode.MapMode.exitMode(MapMode.java:110)
	at cadastre_fr.Address.exitMode(Address.java:115)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:437)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:419)
	at cadastre_fr.Address$4.windowClosing(Address.java:516)
	at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
	at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
	at java.awt.Window.processWindowEvent(Unknown Source)
	at javax.swing.JDialog.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 (2)

20170509 Crash Cadastre-fr.txt (7.8 KB ) - added by Binnette 8 years ago.
Java Console logs
patch.diff (376 bytes ) - added by Binnette 8 years ago.

Download all attachments as: .zip

Change History (11)

by Binnette, 8 years ago

Java Console logs

comment:1 by anonymous, 8 years ago

I can reproduce the bug whith JOSM-latest.jar (12090)

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-05-08 22:03:16 +0200 (Mon, 08 May 2017)
Build-Date:2017-05-09 01:33:49
Revision:12090
Relative:URL: ^/trunk

Identification: JOSM/1.5 (12090 fr) Windows 7 64-Bit
Memory Usage: 918 MB / 3454 MB (402 MB allocated, but free)
Java version: 1.8.0_131-b11, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Screen: \Display0 1920x1080, \Display1 1920x1080
Maximum Screen Size: 1920x1080
Dataset consistency test: No problems found

Plugins:
+ cadastre-fr (33279)
+ ejml (32680)
+ geotools (33042)
+ jts (32699)

Last errors/warnings:
- W: extended font config - overriding 'allfonts.symbol=Symbol' with 'Segoe UI Symbol'
- W: Mettre à jour - org.openstreetmap.josm.plugins.PluginHandler$UpdatePluginsMessagePanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
- E: Handled by bug report queue: java.lang.IllegalArgumentException: Listener cadastre_fr.Address@5043c68c (instance of cadastre_fr.Address) was not registered before or already removed.


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

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (21) of main
java.lang.IllegalArgumentException: Listener cadastre_fr.Address@5043c68c (instance of cadastre_fr.Address) was not registered before or already removed.
	at org.openstreetmap.josm.tools.ListenerList.failRemove(ListenerList.java:134)
	at org.openstreetmap.josm.tools.ListenerList$TracingListenerList.failRemove(ListenerList.java:211)
	at org.openstreetmap.josm.tools.ListenerList.removeListener(ListenerList.java:128)
	at org.openstreetmap.josm.tools.ListenerList$TracingListenerList.removeListener(ListenerList.java:195)
	at org.openstreetmap.josm.data.Preferences.removePreferenceChangeListener(Preferences.java:249)
	at org.openstreetmap.josm.actions.mapmode.MapMode.exitMode(MapMode.java:110)
	at cadastre_fr.Address.exitMode(Address.java:115)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:437)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:419)
	at cadastre_fr.Address$4.windowClosing(Address.java:516)
	at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
	at java.awt.AWTEventMulticaster.windowClosing(Unknown Source)
	at java.awt.Window.processWindowEvent(Unknown Source)
	at javax.swing.JDialog.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)

comment:3 by Binnette, 8 years ago

I can reproduce this error on an other computer with a fresh install of JOSM with Java 8 Update 131 (build 1.8.0_131-b11).

comment:4 by stoecker, 8 years ago

Resolution: duplicate
Status: newclosed

Closed as duplicate of #13863.

comment:5 by Binnette, 8 years ago

Ok here is the problem with a possible fix that needs review.

The problem is that when I close popup "Sasir les adresses", there is a listerner on "WindowsClosing" that call exitMode(). exitMode() have the effet to remove the listener "cadatre_fr.Address" from the list of listeners.
Then after calling exitMode, we call Main.map.selectMapMode(...). This function also call exitMode(). So JOSM try to remove the listener "cadastre_fr.Address" a second time ! But the listener is not in the listeners list anymore ! That's why the method failRemove() is called and an exception is thrown. This exception is not catched anywhere, so the application just crash.

The solution is to change file "Address.java" and to commant the call to "exitMode();" in the WindowClosing listener of the popup (line 514).

I tried it and it fix the problem.

Can anyone review my solution and apply the fix on cadastre_fr plugin if it is valid ?
In attachment, I place the "patch.diff" for file Address.java

Thanks you. Binnette

by Binnette, 8 years ago

Attachment: patch.diff added

comment:6 by stoecker, 8 years ago

Resolution: duplicatefixed

Fixed in [o33301:33302]. Thanks a lot for finding the reason.

P.S. A note for the future - most projects prefer patches in unified diff format (diff -u) which is also output by the version control tools like "svn diff" or "git diff". Also a note for this bug tracker (and many others) - marking the subject with the text "[patch]" prevents overlooking patches a bit more.

Feel free to fix some other issues as well...

comment:7 by Don-vip, 8 years ago

thanks! :)

comment:8 by anonymous, 8 years ago

For those who want to test my "fix" here is the jar file. Close JOSM then replace the existing jar in plugin folder inside josm directory.
Here are the instructions : https://josm.openstreetmap.de/wiki/Help/Preferences/Plugins#Manuallyinstallingplugins

comment:9 by stoecker, 8 years ago

The "Fixed in ​[o33301:33302]." means the fix was applied and a new version released. There is no need to do something special. Simply update!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain pieren.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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