#2672 closed defect (fixed)
[PATCH] java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158)
Reported by: | phobie | Owned by: | dmuecke |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Plugin | Version: | |
Keywords: | plugin measurement NullPointerException | Cc: |
Description
- OS: Debian/sid
- JOSM: 1621
- Java: 1.6.0_13-b03
IMHO I did nothing special.
Measurement plugin was installed but not activated in the GUI.
I am unable to reproduce this bug.
GET http://api.openstreetmap.org/api/capabilities... OK Kommunikation mit http://api.openstreetmap.org/api mittels Protokollversion 0.6 etabliert. java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) at org.openstreetmap.josm.plugins.measurement.MeasurementDialog$1.selectionChanged(MeasurementDialog.java:122) at org.openstreetmap.josm.data.osm.DataSet.fireSelectionChanged(DataSet.java:203) at org.openstreetmap.josm.data.osm.DataSet.setSelected(DataSet.java:154) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor$5.valueChanged(GenericRelationEditor.java:187) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:147) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:194) at javax.swing.DefaultListSelectionModel.insertIndexInterval(DefaultListSelectionModel.java:615) at javax.swing.JTable.tableRowsInserted(JTable.java:4468) at javax.swing.JTable.tableChanged(JTable.java:4404) at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280) at javax.swing.table.AbstractTableModel.fireTableRowsInserted(AbstractTableModel.java:215) at javax.swing.table.DefaultTableModel.insertRow(DefaultTableModel.java:359) at javax.swing.table.DefaultTableModel.addRow(DefaultTableModel.java:333) at javax.swing.table.DefaultTableModel.addRow(DefaultTableModel.java:344) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.refreshTables(GenericRelationEditor.java:401) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.access$100(GenericRelationEditor.java:61) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor$11.actionPerformed(GenericRelationEditor.java:278) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272) at java.awt.Component.processMouseEvent(Component.java:6216) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5981) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4583) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4413) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) GET http://api.openstreetmap.org/api/capabilities... OK
Attachments (1)
Change History (10)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Hello,
I am able to reproduce this bug. It is like "jttt" said. Select incomplete nodes in the relation editor and select to incomplete nodes.
I used this URL for downloading: http://www.openstreetmap.org/?lat=53.64091&lon=10.08213&zoom=15
Then i selected the Relation "HVV-S-Bahnline-S1". Select the third node in the relation, press shift and select the fourth node.
Path: trunk URL: http://josm.openstreetmap.de/svn/trunk Repository Root: http://josm.openstreetmap.de/svn Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Revision: 1679 Node Kind: directory Last Changed Author: Gubaer Last Changed Rev: 1679 Last Changed Date: 2009-06-17 18:21:46 +0200 (Wed, 17 Jun 2009) Memory Usage: 27 MB / 254 MB (4 MB allocated, but free) Java version: 1.5.0_14 Plugins: AgPifoJIntersect_waymeasurementopenstreetbugsopenvisibleremotecontrolroutingtageditortagging-preset-testerusertoolsutilspluginvalidatorwaydownloader Plugin AgPifoJ Version: 15960 Plugin Intersect_way Version: 12781 Plugin measurement Version: 15953 Plugin openstreetbugs Version: 15960 Plugin openvisible Version: 15707 Plugin remotecontrol Version: 14991 Plugin routing Version: 15710 Plugin tageditor Version: 15707 Plugin tagging-preset-tester Version: 14015 Plugin usertools Version: 14125 Plugin utilsplugin Version: 15960 Plugin validator Version: 15127 Plugin waydownloader Version: 15707 java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:150) at org.openstreetmap.josm.plugins.measurement.MeasurementDialog$1.selectionChanged(MeasurementDialog.java:120) at org.openstreetmap.josm.data.osm.DataSet.fireSelectionChanged(DataSet.java:212) at org.openstreetmap.josm.data.osm.DataSet.setSelected(DataSet.java:160) at org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor$5.valueChanged(GenericRelationEditor.java:193) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167) at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214) at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:408) at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:417) at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:441) at javax.swing.JTable.changeSelectionModel(JTable.java:1621) at javax.swing.JTable.changeSelection(JTable.java:1680) at javax.swing.plaf.basic.BasicTableUI$Handler.makeSelectionChange(BasicTableUI.java:1012) at javax.swing.plaf.basic.BasicTableUI$Handler.adjustFocusAndSelection(BasicTableUI.java:968) at javax.swing.plaf.basic.BasicTableUI$Handler.mousePressed(BasicTableUI.java:922) at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222) at java.awt.Component.processMouseEvent(Component.java:5514) at javax.swing.JComponent.processMouseEvent(JComponent.java:3135) at java.awt.Component.processEvent(Component.java:5282) at java.awt.Container.processEvent(Container.java:1966) at java.awt.Component.dispatchEventImpl(Component.java:3984) at java.awt.Container.dispatchEventImpl(Container.java:2024) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3889) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822) at java.awt.Container.dispatchEventImpl(Container.java:2010) at java.awt.Window.dispatchEventImpl(Window.java:1791) at java.awt.Component.dispatchEvent(Component.java:3819) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
comment:3 by , 16 years ago
Measurement plugin does not properly handle incomplete elements in selection (i.e. ignore them).
comment:4 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 16 years ago
Summary: | java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) → [PATCH] java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) |
---|
Perfect description of the issue! I was able to find the issue in minutes. Patch attached.
comment:6 by , 16 years ago
Summary: | [PATCH] java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) → java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) |
---|
The patch is wrong. there is an flag for this: "Node.incomplete".
Don't assume something like zero coordinate. This may change.
by , 16 years ago
Attachment: | measure.txt added |
---|
comment:7 by , 16 years ago
Summary: | java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) → [PATCH] java.lang.NullPointerException at org.openstreetmap.josm.plugins.measurement.MeasurementLayer.calcDistance(MeasurementLayer.java:158) |
---|
Changed patch as suggested!
The same thing happend to me. I had opened relation editor and I was selecting different members of E49 relation.
I'm unable to reproduce it even with the same area and relation. I looks like incomplete node (without coor set) gets into selection. Measurement plugin doesn't check for incomplete nodes so it end up with NPE.
I'm not sure whether measurement plugin should check for incomplete nodes or selection handling code shouldn't allow incomplete nodes in selection.