Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12442 closed defect (fixed)

[patch] save session as caused NPE when there were no layers

Reported by: kolesar Owned by: team
Priority: normal Milestone: 16.02
Component: Core Version:
Keywords: template_report Cc:

Description

What steps will reproduce the problem?

  1. Create a new layer.
  2. Delete that layer. MOTD appears again.

What is the expected result?

File / Save Session As... menu item gets inactive.

What happens instead?

File / Save Session As... menu item is still active, selecting causes NPE.

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

Attached patch that fixes NPE by disabling this menu item when there are no layers by implementing MapFrameListener in SessionSaveAsAction.

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2016-01-06 17:30:31 +0100 (Wed, 06 Jan 2016)
Build-Date:2016-01-06 16:32:31
Revision:9329
Relative:URL: ^/trunk

Identification: JOSM/1.5 (9329 en) Linux Ubuntu 14.04.3 LTS
Memory Usage: 167 MB / 910 MB (87 MB allocated, but free)
Java version: 1.7.0_85, Oracle Corporation, OpenJDK Server VM
Java package: openjdk-7-jre:i386-7u85-2.6.1-5ubuntu0.14.04.1


Last errors/warnings:
- W: Cannot lock cache directory. Will not use disk cache
- E: java.lang.NullPointerException

java.lang.NullPointerException
	at org.openstreetmap.josm.actions.SessionSaveAsAction$SessionSaveAsDialog.initialize(SessionSaveAsAction.java:203)
	at org.openstreetmap.josm.actions.SessionSaveAsAction$SessionSaveAsDialog.<init>(SessionSaveAsAction.java:191)
	at org.openstreetmap.josm.actions.SessionSaveAsAction.saveSession(SessionSaveAsAction.java:96)
	at org.openstreetmap.josm.actions.SessionSaveAsAction.actionPerformed(SessionSaveAsAction.java:78)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6516)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
	at java.awt.Component.processEvent(Component.java:6281)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4872)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
	at java.awt.Container.dispatchEventImpl(Container.java:2273)
	at java.awt.Window.dispatchEventImpl(Window.java:2719)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:747)
	at java.awt.EventQueue.access$300(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:706)
	at java.awt.EventQueue$3.run(EventQueue.java:704)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.awt.EventQueue$4.run(EventQueue.java:718)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:717)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Attachments (1)

SessionSaveAsMapFrameListener.patch (1.8 KB) - added by kolesar 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by kolesar

comment:1 Changed 8 years ago by bastiK

Resolution: fixed
Status: newclosed

In 9629/josm:

applied #12442 - fix: save session as caused NPE when there were no layers (patch by kolesar)

comment:2 Changed 8 years ago by bastiK

Milestone: 16.02

Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.