Modify

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#11169 closed defect (fixed)

NPE trying to save as .osm.pbf

Reported by: zeke76 Owned by: Don-vip
Priority: major Milestone:
Component: Plugin pbf Version:
Keywords: template_report Cc: fernandodunha@…, GerdP

Description

What steps will reproduce the problem?

  1. Open an osm file
  2. From the file menu, select Save As
  3. From the Files of type dropdown, select OSM Server Files pbf compressed(*.osm.pbf)
  4. Provide a name and click save.

What is the expected result?

I was hoping for the file to save as an .osm.pbf file.

What happens instead?

  1. Message Box - Update Plugins - Attached
  2. Select Update Plugin
  3. Message Box - Unexpected Exception - Attached

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

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2015-02-01 02:33:54
Last Changed Author: Don-vip
Revision: 7995
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Relative URL: ^/trunk
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2015-01-31 15:17:59 +0100 (Sat, 31 Jan 2015)
Last Changed Rev: 7995

Identification: JOSM/1.5 (7995 en) Windows 7 64-Bit
Memory Usage: 411 MB / 910 MB (165 MB allocated, but free)
Java version: 1.7.0_72, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Dataset consistency test: No problems found

Plugins:
- LaneConnector (UNKNOWN)
- SimplifyArea (30892)
- buildings_tools (30892)
- pbf (31010)
- reltoolbox (30892)
- utilsplugin2 (30892)

Last errors/warnings:
- E: java.lang.NullPointerException

java.lang.NullPointerException
	at crosby.binary.StringTable.getIndex(StringTable.java:54)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$Prim.serializeMetadataDense(PbfWriter.java:109)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$NodeGroup.serializeDense(PbfWriter.java:171)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$NodeGroup.serialize(PbfWriter.java:146)
	at crosby.binary.BinarySerializer.processBatch(BinarySerializer.java:121)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$Processor.checkLimit(PbfWriter.java:349)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$Processor.processNode(PbfWriter.java:360)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer.process(PbfWriter.java:452)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter.writeData(PbfWriter.java:478)
	at org.openstreetmap.josm.plugins.pbf.io.PbfWriter.writeLayer(PbfWriter.java:474)
	at org.openstreetmap.josm.plugins.pbf.io.PbfExporter.doSave(PbfExporter.java:32)
	at org.openstreetmap.josm.io.OsmExporter.save(OsmExporter.java:92)
	at org.openstreetmap.josm.io.OsmExporter.exportData(OsmExporter.java:67)
	at org.openstreetmap.josm.io.OsmExporter.exportData(OsmExporter.java:54)
	at org.openstreetmap.josm.actions.SaveActionBase.doInternalSave(SaveActionBase.java:84)
	at org.openstreetmap.josm.actions.SaveActionBase.doSave(SaveActionBase.java:56)
	at org.openstreetmap.josm.actions.SaveActionBase.doSave(SaveActionBase.java:46)
	at org.openstreetmap.josm.actions.SaveActionBase.actionPerformed(SaveActionBase.java:36)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(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$200(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$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.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$1.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)
	Suppressed: java.lang.NullPointerException
		at crosby.binary.StringTable.getIndex(StringTable.java:54)
		at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$Prim.serializeMetadataDense(PbfWriter.java:109)
		at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$NodeGroup.serializeDense(PbfWriter.java:171)
		at org.openstreetmap.josm.plugins.pbf.io.PbfWriter$PbfSerializer$NodeGroup.serialize(PbfWriter.java:146)
		at crosby.binary.BinarySerializer.processBatch(BinarySerializer.java:121)
		at crosby.binary.BinarySerializer.flush(BinarySerializer.java:96)
		at crosby.binary.BinarySerializer.close(BinarySerializer.java:101)
		at org.openstreetmap.josm.plugins.pbf.io.PbfWriter.close(PbfWriter.java:484)
		at org.openstreetmap.josm.plugins.pbf.io.PbfExporter.doSave(PbfExporter.java:36)
		... 46 more

Some environment variables
USER

C:\Users\Jeff\AppData\Roaming\npm\
C:\Users\Jeff\AppData\Local\AutoIt v3\SciTE
%USERPROFILE%\AppData\Local\Temp
%USERPROFILE%\AppData\Local\Temp

SYSTEM

ComSpec - %SystemRoot%\system32\cmd.exe
Path - C:\Program Files\ImageMagick-6.9.0-Q16;

C:\Program Files (x86)\ActiveState Komodo Edit 8\;
C:\Program Files (x86)\AMD APP\bin\x86_64;
C:\Program Files (x86)\AMD APP\bin\x86;
C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;
C:\windows\system32;
C:\windows;
C:\windows\System32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
C:\Program Files (x86)\Windows Live\Shared;
C:\Python33\;
C:\Windows\system32\gs\gs7.05\bin;
C:\Program Files\Microsoft Windows Performance Toolkit\;
C:\Program Files\nodejs\;
C:\Program Files (x86)\QuickTime\QTSystem\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\

PATHEXT - .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PSModulePath - %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\
VS100COMNTOOLS - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\

Attachments (6)

Bug Error.PNG (25.6 KB ) - added by zeke76 9 years ago.
Message Box - Unexpecter Exception
PBF Error.PNG (68.1 KB ) - added by zeke76 9 years ago.
Message Box - Update Plugins
Portsmouth Area.osm.pbf (144 bytes ) - added by zeke76 9 years ago.
Portsmouth osm
Portsmouth Area.7z (1.7 MB ) - added by zeke76 9 years ago.
fix_pbfwriter.patch (3.3 KB ) - added by GerdP 8 years ago.
fix_pbfwriter_v2.patch (5.5 KB ) - added by GerdP 8 years ago.

Download all attachments as: .zip

Change History (20)

by zeke76, 9 years ago

Attachment: Bug Error.PNG added

Message Box - Unexpecter Exception

by zeke76, 9 years ago

Attachment: PBF Error.PNG added

Message Box - Update Plugins

comment:1 by Don-vip, 9 years ago

can you please attach your .osm file?

by zeke76, 9 years ago

Attachment: Portsmouth Area.osm.pbf added

Portsmouth osm

comment:2 by zeke76, 9 years ago

Hi Vincent,

This is what I got when I attempted to save.

Jeff

comment:3 by Don-vip, 9 years ago

I was rather thinking to your source .osm file or your exact downloaded area, as I cannot reproduce the bug.

by zeke76, 9 years ago

Attachment: Portsmouth Area.7z added

comment:4 by zeke76, 9 years ago

Hi Vincent,

Yes, that would make more sense. I had to zip the file because it was to large to add as an attachment. The file is for Portsmouth, NH, USA.

A little background, I am using OSM for scenery in an X-Plane flight simulator program. I have a 3rd party app that converts .osm.pbf to a format X-Plane understands. I would like to test changes I am making prior to uploading them. If I can create the .osm.pbf files I can do that on my local machine.

Thank you for the quick response on this. Let me know if you need anything else.

Jeff

comment:5 by Don-vip, 9 years ago

Ticket #10948 has been marked as a duplicate of this ticket.

comment:6 by Don-vip, 9 years ago

Cc: fernandodunha@… added
Priority: minormajor
Summary: Recieving Errors trying to save as .osm.pbf using the PBF pluginNPE trying to save as .osm.pbf

comment:7 by Don-vip, 9 years ago

Ticket #11267 has been marked as a duplicate of this ticket.

comment:8 by Don-vip, 9 years ago

Ticket #11551 has been marked as a duplicate of this ticket.

comment:9 by anonymous, 8 years ago

I'm getting the same problem with this StringTable class from a different call stack:

java.lang.NullPointerException

at org.openstreetmap.osmosis.osmbinary.StringTable.getIndex(StringTable.java:54)
at crosby.binary.osmosis.OsmosisSerializer$RelationGroup.serialize(OsmosisSerializer.java:323)
at org.openstreetmap.osmosis.osmbinary.BinarySerializer.processBatch(BinarySerializer.java:121)
at crosby.binary.osmosis.OsmosisSerializer.complete(OsmosisSerializer.java:495)

comment:10 by Don-vip, 8 years ago

Cc: GerdP added

@Gerd: I have added a unit test for this in [o32862], maybe you know how to quickly solve it?

comment:11 by GerdP, 8 years ago

I can reproduce the problem, will see if I can find a fix...

by GerdP, 8 years ago

Attachment: fix_pbfwriter.patch added

by GerdP, 8 years ago

Attachment: fix_pbfwriter_v2.patch added

comment:12 by GerdP, 8 years ago

See fix_pbfwriter_v2.patch.
The pbf format doesn't expect incomplete data, so nodes without coordinates, ways without nodes, and relations without
members should be ignored. I am not sure if it makes sense to write new data (with negative ids).
I think pbf format is not meant for this, so maybe the pbf output from JOSM can cause trouble in other programs.

I did not find out what value one should write for a null string, so now an empty string is stored.

comment:13 by Don-vip, 8 years ago

Resolution: fixed
Status: newclosed

Thank you! I have applied the patch slightly modified for the comparator stuff, see [o32865:32866].

comment:14 by GerdP, 8 years ago

Thanks, I like your changes.
The stream() api is still brand new for me, this was the first time that I used it.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
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.