﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
20555	Trying to turn of MapWithAI plugin after downloading data	TAYbalt	taylor.smock	"==== What steps will reproduce the problem?
1. At JOSM startup MapWithAI plugin is on
2. Downloaded data in a bounding box, using the green download arrow. It downloads MapWithAI data.
3. I try turning off the MapWithAI plugin and it generates this stack trace.

==== What is the expected result?
1. Graceful dialog saying ""Hey you can't turn that plugin off, b/c it's in use!""

==== What happens instead?
1. Throws error with stack trace below:

==== 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: 2020-12-28 22:03:23 +0100 (Mon, 28 Dec 2020)
Build-Date:2020-12-30 02:30:55
Revision:17428
Relative:URL: ^/trunk

Identification: JOSM/1.5 (17428 en) Mac OS X 10.13.6
OS Build number: Mac OS X 10.13.6 (17G14042)
Memory Usage: 854 MB / 1820 MB (402 MB allocated, but free)
Java version: 1.8.0_281-b09, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel: com.apple.laf.AquaLookAndFeel
Screen: Display 69731904 1440×900 (scaling 1.00×1.00)
Maximum Screen Size: 1440×900
Best cursor sizes: 16×16→16×16, 32×32→32×32
VM arguments: [-Djava.security.policy=file:<java.home>/lib/security/javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>/bin, -Djava.security.manager, -Djnlpx.origFilenameArg=/Applications/josm.jnlp, -Djnlpx.remove=false, -Dsun.awt.warmup=true, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.heapsize=NULL,2048m, -Dmacosx.jnlpx.dock.name=JOSM, -Dmacosx.jnlpx.dock.icon=${HOME}/Library/Application Support/Oracle/Java/Deployment/cache/6.0/25/4c122699-6a402f6d.icns, -Djnlpx.jvm=""<java.home>/bin/java""]

Plugins:
+ ImportImagePlugin (35567)
+ apache-commons (35524)
+ apache-http (35589)
+ ejml (35458)
+ geotools (35458)
+ jna (35662)
+ jts (35458)
+ log4j (35458)
+ measurement (35640)
+ utilsplugin2 (35691)

Map paint styles:
- https://github.com/igitov/forest-josm-style/archive/master.zip

Last errors/warnings:
- 00013.209 E: Failed to locate image 'MapWithAI'
- 00073.395 W: Could not move autosaved file MapWithAI_20210302_161530710.osm to deleted_layers folder
- 00073.397 W: Unable to delete backup file <josm.userdata>/autosave/MapWithAI_20210302_161530710.osm
- 00073.610 W: java.io.IOException: java.security.AccessControlException: access denied (""java.io.FilePermission"" ""<josm.cache>/mirror_https___josm.openstreetmap.de_josmfile_page_Styles_MapWithAI_zip_1"" ""read""). Cause: java.security.AccessControlException: access denied (""java.io.FilePermission"" ""<josm.cache>/mirror_https___josm.openstreetmap.de_josmfile_page_Styles_MapWithAI_zip_1"" ""read"")
- 00073.618 E: Handled by bug report queue: java.security.AccessControlException: access denied (""java.io.FilePermission"" ""<josm.pref>/preferences.xml"" ""read"")



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-2 (41) of javawsApplicationThreadGroup
java.security.AccessControlException: access denied (""java.io.FilePermission"" ""/Users/thayer/Library/Preferences/JOSM/preferences.xml"" ""read"")
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
	at java.security.AccessController.checkPermission(AccessController.java:886)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
	at java.io.File.exists(File.java:814)
	at org.openstreetmap.josm.data.Preferences.save(Preferences.java:438)
	at org.openstreetmap.josm.data.Preferences.save(Preferences.java:418)
	at org.openstreetmap.josm.data.Preferences.putSetting(Preferences.java:707)
	at org.openstreetmap.josm.spi.preferences.AbstractPreferences.putListOfMaps(AbstractPreferences.java:126)
	at org.openstreetmap.josm.data.preferences.sources.SourcePrefHelper.put(SourcePrefHelper.java:95)
	at org.openstreetmap.josm.gui.mappaint.MapPaintStyles.refreshStyles(MapPaintStyles.java:437)
	at org.openstreetmap.josm.gui.mappaint.MapPaintStyles.removeStyle(MapPaintStyles.java:432)
	at org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils.lambda$removeMapWithAIPaintStyles$4(MapPaintUtils.java:117)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
}}}
"	defect	closed	normal		Plugin mapwithai		fixed	template_report	
