﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
18850	ArrayIndexOutOfBoundsException after undoing adding additional node	skyper	kolesar	"==== What steps will reproduce the problem?
1. Have a closed way and an unclosed way sharing segments. See attached example [attachment:josm_improve_way_example.osm.bz2 file]
1. Select the unclosed way (`name=select`) in Impove Way Mode
1. Add an additional node between A and B
1. undo 

==== What is the expected result?
No exception

==== What happens instead?
ArrayIndexOutOfBoundsException

==== Please provide any additional information below. Attach a screenshot if possible.
The bug report even opens twice for one undo of one action.

{{{
Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-03-02 23:50:44 +0100 (Mon, 02 Mar 2020)
Revision:16002
Build-Date:2020-03-02 22:52:33
URL:https://josm.openstreetmap.de/svn/trunk

Plugins:
+ ImproveWay (29)
+ utilsplugin2 (35248)

Last errors/warnings:
- E: Handled by bug report queue: java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 7
- W: Warning - <html>JOSM could not find information about the following plugins:<ul><li>ImproveWay</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 (18) of main
java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 7
	at org.openstreetmap.josm.data.osm.Way.getNode(Way.java:99)
	at org.openstreetmap.josm.data.osm.WaySegment.getSecondNode(WaySegment.java:50)
	at org.openstreetmap.josm.plugins.improveway.ImproveWayAccuracyAction.paint(ImproveWayAccuracyAction.java:338)
	at org.openstreetmap.josm.gui.MapView.drawTemporaryLayers(MapView.java:647)
	at org.openstreetmap.josm.gui.MapView.drawMapContent(MapView.java:584)
	at org.openstreetmap.josm.gui.MapView.paint(MapView.java:487)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JSplitPane.paintChildren(JSplitPane.java:1024)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5255)
	at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5203)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5013)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:865)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
}}}
"	defect	new	normal		Plugin ImproveWay			template_report undo new node	
